DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2755
Version: 1.3-feature
Option to allow the selection bar to change based on if the browser has kb
focus or not. This makes it more clear when the widget gets and loses
focus.
Link: http://www.fltk.org/str.php?L2755
Version: 1.3-feature
Index: FL/Fl_Browser_.H
===================================================================
--- FL/Fl_Browser_.H (revision 9157)
+++ FL/Fl_Browser_.H (working copy)
@@ -71,7 +71,12 @@
void *redraw1,*redraw2; // minimal update pointers
void* max_width_item; // which item has max_width_
int scrollbar_size_; // size of scrollbar trough
+ int flags_ex_; // extended flags for class
+
+ static const int FLAG_EX_FOCUS_COLOR_CHANGE=2; // change selection color
based on focus
+
+
void update_top();
protected:
@@ -360,6 +365,14 @@
*/
void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); }
void sort(int flags=0);
+ /**
+ enable or disable changing color of the selection bar depending on if the
+ browser control has focus or not
+ */
+ void enable_focus_color_change() { flags_ex_|=FLAG_EX_FOCUS_COLOR_CHANGE; };
+ void disable_focus_color_change() { flags_ex_&=~FLAG_EX_FOCUS_COLOR_CHANGE;
};
+ bool using_focus_color_change(void) { return (flags_ex_ &
FLAG_EX_FOCUS_COLOR_CHANGE)!=0; };
+
};
#endif
Index: src/Fl_Browser_.cxx
===================================================================
--- src/Fl_Browser_.cxx (revision 9157)
+++ src/Fl_Browser_.cxx (working copy)
@@ -399,7 +399,7 @@
if (hh <= 0) continue;
if ((damage()&(FL_DAMAGE_SCROLL|FL_DAMAGE_ALL)) || l == redraw1 || l ==
redraw2) {
if (item_selected(l)) {
- fl_color(active_r() ? selection_color() :
fl_inactive(selection_color()));
+ fl_color((active_r() && (!using_focus_color_change() ||
Fl::focus()==this)) ? selection_color() : fl_inactive(selection_color()));
fl_rectf(X, yy+Y, W, hh);
} else if (!(damage()&FL_DAMAGE_ALL)) {
fl_push_clip(X, yy+Y, W, hh);
@@ -974,6 +974,7 @@
max_width_item = 0;
scrollbar_size_ = 0;
redraw1 = redraw2 = 0;
+ flags_ex_= 0;
end();
}
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev