[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2569 - trunk/src
From: |
jave27 |
Subject: |
[Pingus-CVS] r2569 - trunk/src |
Date: |
Thu, 29 Dec 2005 20:10:22 +0100 |
Author: jave27
Date: 2005-12-29 20:10:07 +0100 (Thu, 29 Dec 2005)
New Revision: 2569
Modified:
trunk/src/file_dialog.cxx
trunk/src/file_dialog_item.cxx
Log:
Prettied up the file dialog a bit.
Modified: trunk/src/file_dialog.cxx
===================================================================
--- trunk/src/file_dialog.cxx 2005-12-29 18:55:06 UTC (rev 2568)
+++ trunk/src/file_dialog.cxx 2005-12-29 19:10:07 UTC (rev 2569)
@@ -139,9 +139,12 @@
/** Show it or not */
bool is_hidden;
+ bool hover;
+
public:
FileDialogScrollButton (FileDialog* f, int d, int height_offset)
: file_dialog(f),
+ hover(false),
pos(Vector((float)CL_Display::get_width()/2 + 210,
(float)CL_Display::get_height()/2 +
height_offset)),
direction(d),
@@ -152,9 +155,13 @@
}
void draw (DrawingContext& gc) {
- //FIXME: Should also draw a hover box around it when
the mouse is over it.
if (!is_hidden)
+ {
gc.draw(sprite, pos);
+ if (hover)
+ gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
+ pos.y + sprite.get_height(),
CL_Color(255,255,255,150));
+ }
}
void on_primary_button_click(int x, int y)
@@ -162,6 +169,9 @@
file_dialog->scroll(direction);
}
+ void on_pointer_enter() { hover = true; }
+ void on_pointer_leave() { hover = false; }
+
bool is_at(int x, int y)
{
if (is_hidden)
@@ -186,9 +196,12 @@
/** Image used for the parent folder button */
CL_Sprite sprite;
+ bool hover;
+
public:
FileDialogParentFolderButton (FileDialog* f)
: file_dialog(f),
+ hover(false),
pos(Vector((float)CL_Display::get_width()/2 + 230,
(float)CL_Display::get_height()/2 - 210)),
sprite(Resource::load_sprite("core/menu/parent_folder"))
@@ -196,8 +209,10 @@
}
void draw (DrawingContext& gc) {
- //FIXME: Should also draw a hover box around it when
the mouse is over it.
gc.draw(sprite, pos);
+ if (hover)
+ gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
+ pos.y + sprite.get_height(),
CL_Color(255,255,255,150));
}
void on_primary_button_click(int x, int y)
@@ -208,6 +223,9 @@
file_dialog->set_selected_file(f);
}
+ void on_pointer_enter() { hover = true; }
+ void on_pointer_leave() { hover = false; }
+
bool is_at(int x, int y)
{
return (x > (int)pos.x && x < (int)pos.x +
sprite.get_width()
Modified: trunk/src/file_dialog_item.cxx
===================================================================
--- trunk/src/file_dialog_item.cxx 2005-12-29 18:55:06 UTC (rev 2568)
+++ trunk/src/file_dialog_item.cxx 2005-12-29 19:10:07 UTC (rev 2569)
@@ -126,11 +126,17 @@
pos.y, get_filename());
// FIXME: If mouse over, draw a quick info box about
the file item
- if (mouse_over && !file_item.is_directory)
+ if (mouse_over)
{
- gc.draw_fillrect(pos.x+50, pos.y, pos.x+300,
pos.y+50, CL_Color::azure);
- gc.print_left(Fonts::pingus_small, pos.x+50,
pos.y, file_item.friendly_name);
- gc.print_left(Fonts::pingus_small, pos.x+50,
pos.y+25, file_info);
+ if (file_item.is_directory)
+ gc.draw_rect(pos.x, pos.y, pos.x +
sprite.get_width(),
+ pos.y + sprite.get_height(),
CL_Color(255,255,255,150));
+ else // It's a file
+ {
+ gc.draw_fillrect(pos.x+50, pos.y,
pos.x+300, pos.y+50, CL_Color::azure);
+ gc.print_left(Fonts::pingus_small,
pos.x+50, pos.y, file_item.friendly_name);
+ gc.print_left(Fonts::pingus_small,
pos.x+50, pos.y+25, file_info);
+ }
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2569 - trunk/src,
jave27 <=