s/icon1()/use_icon1()

s/icon2()/use_icon2()
Let selected icon be darker; it is a much better visual than only
selected icon label
This commit is contained in:
Sanel Zukan 2008-10-03 11:29:56 +00:00
parent 40400c0654
commit bc68297a78
3 changed files with 20 additions and 9 deletions

View File

@ -86,6 +86,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
lwidth = lheight = 0; lwidth = lheight = 0;
focus = false; focus = false;
micon = NULL; micon = NULL;
darker_img = NULL;
/* /*
* GlobalIconSettings is shared from desktop so we only * GlobalIconSettings is shared from desktop so we only
@ -137,6 +138,7 @@ DesktopIcon::~DesktopIcon() {
if(micon) if(micon)
delete micon; delete micon;
delete darker_img;
delete imenu; delete imenu;
} }
@ -181,6 +183,11 @@ void DesktopIcon::load_icon(int face) {
size(img_w + OFFSET_W, img_h + OFFSET_H); size(img_w + OFFSET_W, img_h + OFFSET_H);
image(img); image(img);
// darker icon version for selection
delete darker_img;
darker_img = image()->copy(image()->w(), image()->h());
darker_img->color_average(FL_BLUE, 0.6);
} }
void DesktopIcon::update_label_size(void) { void DesktopIcon::update_label_size(void) {
@ -243,7 +250,6 @@ void DesktopIcon::drag(int x, int y, bool apply) {
micon->show(); micon->show();
} else { } else {
E_ASSERT(micon != NULL); E_ASSERT(micon != NULL);
micon->position(x, y); micon->position(x, y);
} }
@ -301,12 +307,12 @@ int DesktopIcon::icon_type(void) {
return settings->type; return settings->type;
} }
void DesktopIcon::icon1(void) { void DesktopIcon::use_icon1(void) {
load_icon(ICON_FACE_ONE); load_icon(ICON_FACE_ONE);
fast_redraw(); fast_redraw();
} }
void DesktopIcon::icon2(void) { void DesktopIcon::use_icon2(void) {
load_icon(ICON_FACE_TWO); load_icon(ICON_FACE_TWO);
fast_redraw(); fast_redraw();
} }
@ -336,7 +342,11 @@ void DesktopIcon::draw(void) {
ix += x(); ix += x();
iy += y(); iy += y();
im->draw(ix, iy); // darker_img is always present if image() is present
if(is_focused())
darker_img->draw(ix, iy);
else
im->draw(ix, iy);
E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n"); E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n");
} }

View File

@ -40,6 +40,7 @@ class DesktopIcon : public Fl_Widget {
MovableIcon* micon; MovableIcon* micon;
Fl_Image* darker_img;
Fl_Menu_Button* imenu; Fl_Menu_Button* imenu;
void load_icon(int face); void load_icon(int face);
@ -87,9 +88,9 @@ class DesktopIcon : public Fl_Widget {
*/ */
const edelib::String& path(void); const edelib::String& path(void);
int icon_type(void); int icon_type(void);
void icon1(void); void use_icon1(void);
void icon2(void); void use_icon2(void);
}; };
class MovableIcon : public Fl_Window { class MovableIcon : public Fl_Window {

View File

@ -920,9 +920,9 @@ void Desktop::dir_watch(const char* dir, const char* changed, int flags) {
for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) { for(it = icons.begin(), it_end = icons.end(); it != it_end; ++it) {
if((*it)->icon_type() == ICON_TRASH) { if((*it)->icon_type() == ICON_TRASH) {
if(is_empty) if(is_empty)
(*it)->icon1(); (*it)->use_icon1();
else else
(*it)->icon2(); (*it)->use_icon2();
} }
} }