Updated Fl_Tabs to check the contrast of the label color against
the tab background, and to highlight the top 5 lines of the tab pane with the selection color so that selected tabs stand out more. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4295 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
2eb4d42349
commit
668ef918e8
4
CHANGES
4
CHANGES
@ -2,6 +2,10 @@ CHANGES IN FLTK 1.1.7
|
|||||||
|
|
||||||
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
- Documentation fixes (STR #648, STR #692, STR #730, STR
|
||||||
#744, STR #745)
|
#744, STR #745)
|
||||||
|
- Updated Fl_Tabs to check the contrast of the label
|
||||||
|
color against the tab background, and to highlight the
|
||||||
|
top 5 lines of the tab pane with the selection color so
|
||||||
|
that selected tabs stand out more.
|
||||||
- The example programs can now compile separate from the
|
- The example programs can now compile separate from the
|
||||||
FLTK source distribution (STR #809)
|
FLTK source distribution (STR #809)
|
||||||
- The example programs are now installed with the
|
- The example programs are now installed with the
|
||||||
|
@ -238,7 +238,21 @@ void Fl_Tabs::draw() {
|
|||||||
int H = tab_height();
|
int H = tab_height();
|
||||||
|
|
||||||
if (damage() & FL_DAMAGE_ALL) { // redraw the entire thing:
|
if (damage() & FL_DAMAGE_ALL) { // redraw the entire thing:
|
||||||
draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), v ? v->color() : color());
|
Fl_Color c = v ? v->color() : color();
|
||||||
|
|
||||||
|
draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), c);
|
||||||
|
|
||||||
|
if (selection_color() != c) {
|
||||||
|
// Draw the top 5 lines of the tab pane in the selection color so
|
||||||
|
// that the user knows which tab is selected...
|
||||||
|
if (H >= 0) fl_push_clip(x(), y() + H, w(), 5);
|
||||||
|
else fl_push_clip(x(), y() + h() - H - 4, w(), 5);
|
||||||
|
|
||||||
|
draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H),
|
||||||
|
selection_color());
|
||||||
|
|
||||||
|
fl_pop_clip();
|
||||||
|
}
|
||||||
if (v) draw_child(*v);
|
if (v) draw_child(*v);
|
||||||
} else { // redraw the child
|
} else { // redraw the child
|
||||||
if (v) update_child(*v);
|
if (v) update_child(*v);
|
||||||
@ -272,12 +286,23 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
|
|||||||
|
|
||||||
H += dh;
|
H += dh;
|
||||||
|
|
||||||
draw_box(box(), x1, y(), W, H,
|
Fl_Color c = sel ? selection_color() : o->selection_color();
|
||||||
sel ? fl_color_average(selection_color(), o->selection_color(), 0.5f)
|
|
||||||
: o->selection_color());
|
|
||||||
|
|
||||||
|
draw_box(box(), x1, y(), W, H, c);
|
||||||
|
|
||||||
|
// Make sure that the label contrasts the tab color...
|
||||||
|
c = fl_contrast(o->labelcolor(), c);
|
||||||
|
|
||||||
|
// Save the previous label color
|
||||||
|
Fl_Color oc = o->labelcolor();
|
||||||
|
|
||||||
|
// Draw the label using the contrast color...
|
||||||
|
o->labelcolor(c);
|
||||||
o->draw_label(x1, y(), W, H, FL_ALIGN_CENTER);
|
o->draw_label(x1, y(), W, H, FL_ALIGN_CENTER);
|
||||||
|
|
||||||
|
// Restore the original label color...
|
||||||
|
o->labelcolor(oc);
|
||||||
|
|
||||||
if (Fl::focus() == this && o->visible())
|
if (Fl::focus() == this && o->visible())
|
||||||
draw_focus(box(), x1, y(), W, H);
|
draw_focus(box(), x1, y(), W, H);
|
||||||
|
|
||||||
@ -290,12 +315,23 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
|
|||||||
|
|
||||||
H += dh;
|
H += dh;
|
||||||
|
|
||||||
draw_box(box(), x1, y() + h() - H, W, H,
|
Fl_Color c = sel ? selection_color() : o->selection_color();
|
||||||
sel ? fl_color_average(selection_color(), o->selection_color(), 0.5f)
|
|
||||||
: o->selection_color());
|
|
||||||
|
|
||||||
|
draw_box(box(), x1, y() + h() - H, W, H, c);
|
||||||
|
|
||||||
|
// Make sure that the label contrasts the tab color...
|
||||||
|
c = fl_contrast(o->labelcolor(), c);
|
||||||
|
|
||||||
|
// Save the previous label color
|
||||||
|
Fl_Color oc = o->labelcolor();
|
||||||
|
|
||||||
|
// Draw the label using the contrast color...
|
||||||
|
o->labelcolor(c);
|
||||||
o->draw_label(x1, y() + h() - H, W, H, FL_ALIGN_CENTER);
|
o->draw_label(x1, y() + h() - H, W, H, FL_ALIGN_CENTER);
|
||||||
|
|
||||||
|
// Restore the original label color...
|
||||||
|
o->labelcolor(oc);
|
||||||
|
|
||||||
if (Fl::focus() == this && o->visible())
|
if (Fl::focus() == this && o->visible())
|
||||||
draw_focus(box(), x1, y() + h() - H, W, H);
|
draw_focus(box(), x1, y() + h() - H, W, H);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user