Selection color fixes, widget screenshot added to top of docs.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8420 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2011-02-13 17:30:17 +00:00
parent 83fab9118e
commit d0d159d17d
4 changed files with 10 additions and 7 deletions

View File

@ -45,6 +45,9 @@
///
/// \brief Tree widget.
///
/// \image html tree-simple.png "Fl_Tree example program"
/// \image latex tree-simple.png "Fl_Tree example program" width=4cm
///
/// \code
/// Fl_Tree // Top level widget
/// |--- Fl_Tree_Item // Items in the tree

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -93,7 +93,7 @@ Fl_Tree::Fl_Tree(int X, int Y, int W, int H, const char *L) : Fl_Group(X,Y,W,H,L
_callback_reason = FL_TREE_REASON_NONE;
_scrollbar_size = 0; // 0: uses Fl::scrollbar_size()
box(FL_DOWN_BOX);
color(FL_WHITE);
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
when(FL_WHEN_CHANGED);
_vscroll = new Fl_Scrollbar(0,0,0,0); // will be resized by draw()
_vscroll->hide();

View File

@ -562,12 +562,12 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
W += prefs.openicon()->w();
}
// Colors, fonts
Fl_Color fg = _selected ? _labelbgcolor : _labelfgcolor; // selected uses bgcolor, unselected uses fgcolor
Fl_Color bg = _selected ? tree->selection_color() : _labelbgcolor; // selected uses selectcolor, unselected uses bgcolor
if ( ! _active ) {
fg = fl_inactive(fg);
if ( _selected ) bg = fl_inactive(bg);
}
Fl_Color fg = _selected ? fl_contrast(_labelfgcolor, tree->selection_color())
: _active ? _labelfgcolor
: fl_inactive(_labelfgcolor);
Fl_Color bg = _selected ? _active ? tree->selection_color()
: fl_inactive(tree->selection_color())
: _labelbgcolor;
// Update the xywh of this item
_xywh[0] = X;
_xywh[1] = Y;