mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
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:
parent
40400c0654
commit
bc68297a78
@ -86,6 +86,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) :
|
||||
lwidth = lheight = 0;
|
||||
focus = false;
|
||||
micon = NULL;
|
||||
darker_img = NULL;
|
||||
|
||||
/*
|
||||
* GlobalIconSettings is shared from desktop so we only
|
||||
@ -137,6 +138,7 @@ DesktopIcon::~DesktopIcon() {
|
||||
if(micon)
|
||||
delete micon;
|
||||
|
||||
delete darker_img;
|
||||
delete imenu;
|
||||
}
|
||||
|
||||
@ -181,6 +183,11 @@ void DesktopIcon::load_icon(int face) {
|
||||
size(img_w + OFFSET_W, img_h + OFFSET_H);
|
||||
|
||||
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) {
|
||||
@ -243,7 +250,6 @@ void DesktopIcon::drag(int x, int y, bool apply) {
|
||||
micon->show();
|
||||
} else {
|
||||
E_ASSERT(micon != NULL);
|
||||
|
||||
micon->position(x, y);
|
||||
}
|
||||
|
||||
@ -301,12 +307,12 @@ int DesktopIcon::icon_type(void) {
|
||||
return settings->type;
|
||||
}
|
||||
|
||||
void DesktopIcon::icon1(void) {
|
||||
void DesktopIcon::use_icon1(void) {
|
||||
load_icon(ICON_FACE_ONE);
|
||||
fast_redraw();
|
||||
}
|
||||
|
||||
void DesktopIcon::icon2(void) {
|
||||
void DesktopIcon::use_icon2(void) {
|
||||
load_icon(ICON_FACE_TWO);
|
||||
fast_redraw();
|
||||
}
|
||||
@ -336,7 +342,11 @@ void DesktopIcon::draw(void) {
|
||||
ix += x();
|
||||
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");
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ class DesktopIcon : public Fl_Widget {
|
||||
|
||||
MovableIcon* micon;
|
||||
|
||||
Fl_Image* darker_img;
|
||||
Fl_Menu_Button* imenu;
|
||||
|
||||
void load_icon(int face);
|
||||
@ -87,9 +88,9 @@ class DesktopIcon : public Fl_Widget {
|
||||
*/
|
||||
const edelib::String& path(void);
|
||||
|
||||
int icon_type(void);
|
||||
void icon1(void);
|
||||
void icon2(void);
|
||||
int icon_type(void);
|
||||
void use_icon1(void);
|
||||
void use_icon2(void);
|
||||
};
|
||||
|
||||
class MovableIcon : public Fl_Window {
|
||||
|
@ -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) {
|
||||
if((*it)->icon_type() == ICON_TRASH) {
|
||||
if(is_empty)
|
||||
(*it)->icon1();
|
||||
(*it)->use_icon1();
|
||||
else
|
||||
(*it)->icon2();
|
||||
(*it)->use_icon2();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user