Fl_Tree: improved draw() behavior when deactivated;
icons draw deactivated now. test/tree: Added 'deactivate tree' button to test deactivating entire widget. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10723 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e4f645d60f
commit
81654d15eb
@ -100,6 +100,9 @@ class FL_EXPORT Fl_Tree_Item {
|
|||||||
int _label_xywh[4]; // xywh of label
|
int _label_xywh[4]; // xywh of label
|
||||||
Fl_Widget *_widget; // item's label widget (optional)
|
Fl_Widget *_widget; // item's label widget (optional)
|
||||||
Fl_Image *_usericon; // item's user-specific icon (optional)
|
Fl_Image *_usericon; // item's user-specific icon (optional)
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
Fl_Image *_userdeicon; // deactivated usericon
|
||||||
|
#endif
|
||||||
Fl_Tree_Item_Array _children; // array of child items
|
Fl_Tree_Item_Array _children; // array of child items
|
||||||
Fl_Tree_Item *_parent; // parent item (=0 if root)
|
Fl_Tree_Item *_parent; // parent item (=0 if root)
|
||||||
void *_userdata; // user data that can be associated with an item
|
void *_userdata; // user data that can be associated with an item
|
||||||
@ -425,12 +428,29 @@ public:
|
|||||||
/// Set the item's user icon to an Fl_Image. '0' will disable.
|
/// Set the item's user icon to an Fl_Image. '0' will disable.
|
||||||
void usericon(Fl_Image *val) {
|
void usericon(Fl_Image *val) {
|
||||||
_usericon = val;
|
_usericon = val;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
// Update deactivated version of icon..
|
||||||
|
if ( _userdeicon ) delete _userdeicon;
|
||||||
|
if ( _usericon ) {
|
||||||
|
_userdeicon = _usericon->copy();
|
||||||
|
_userdeicon->inactive();
|
||||||
|
} else {
|
||||||
|
_userdeicon = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
recalc_tree(); // may change tree geometry
|
recalc_tree(); // may change tree geometry
|
||||||
}
|
}
|
||||||
/// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
|
/// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
|
||||||
Fl_Image *usericon() const {
|
Fl_Image *usericon() const {
|
||||||
return(_usericon);
|
return(_usericon);
|
||||||
}
|
}
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
/// Return the deactivated version of the user icon, if any.
|
||||||
|
/// Returns 0 if none.
|
||||||
|
Fl_Image* userdeicon() const {
|
||||||
|
return _userdeicon;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//////////////////
|
//////////////////
|
||||||
// Events
|
// Events
|
||||||
//////////////////
|
//////////////////
|
||||||
|
@ -132,6 +132,11 @@ class FL_EXPORT Fl_Tree_Prefs {
|
|||||||
Fl_Image *_openimage; // the 'open' icon [+]
|
Fl_Image *_openimage; // the 'open' icon [+]
|
||||||
Fl_Image *_closeimage; // the 'close' icon [-]
|
Fl_Image *_closeimage; // the 'close' icon [-]
|
||||||
Fl_Image *_userimage; // user's own icon
|
Fl_Image *_userimage; // user's own icon
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
Fl_Image *_opendeimage; // deactivated 'open' icon
|
||||||
|
Fl_Image *_closedeimage; // deactivated 'close' icon
|
||||||
|
Fl_Image *_userdeimage; // deactivated user icon
|
||||||
|
#endif
|
||||||
char _showcollapse; // 1=show collapse icons, 0=don't
|
char _showcollapse; // 1=show collapse icons, 0=don't
|
||||||
char _showroot; // show the root item as part of the tree
|
char _showroot; // show the root item as part of the tree
|
||||||
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
|
Fl_Tree_Sort _sortorder; // none, ascening, descending, etc.
|
||||||
@ -147,6 +152,9 @@ class FL_EXPORT Fl_Tree_Prefs {
|
|||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
Fl_Tree_Prefs();
|
Fl_Tree_Prefs();
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
~Fl_Tree_Prefs();
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Labels
|
// Labels
|
||||||
@ -340,7 +348,35 @@ public:
|
|||||||
///
|
///
|
||||||
inline void usericon(Fl_Image *val) {
|
inline void usericon(Fl_Image *val) {
|
||||||
_userimage = val;
|
_userimage = val;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
// Update deactivated version of icon..
|
||||||
|
if ( _userdeimage ) delete _userdeimage;
|
||||||
|
if ( _userimage ) {
|
||||||
|
_userdeimage = _userimage->copy();
|
||||||
|
_userdeimage->inactive();
|
||||||
|
} else {
|
||||||
|
_userdeimage = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
/// Return the deactivated version of the open icon, if any.
|
||||||
|
/// Returns 0 if none.
|
||||||
|
inline Fl_Image *opendeicon() const {
|
||||||
|
return _opendeimage;
|
||||||
|
}
|
||||||
|
/// Return the deactivated version of the close icon, if any.
|
||||||
|
/// Returns 0 if none.
|
||||||
|
inline Fl_Image *closedeicon() const {
|
||||||
|
return _closedeimage;
|
||||||
|
}
|
||||||
|
/// Return the deactivated version of the user icon, if any.
|
||||||
|
/// Returns 0 if none.
|
||||||
|
inline Fl_Image *userdeicon() const {
|
||||||
|
return _userdeimage;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// Options
|
// Options
|
||||||
|
@ -78,6 +78,9 @@ void Fl_Tree_Item::_Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree) {
|
|||||||
_label_xywh[2] = 0;
|
_label_xywh[2] = 0;
|
||||||
_label_xywh[3] = 0;
|
_label_xywh[3] = 0;
|
||||||
_usericon = 0;
|
_usericon = 0;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
_userdeicon = 0;
|
||||||
|
#endif
|
||||||
_userdata = 0;
|
_userdata = 0;
|
||||||
_parent = 0;
|
_parent = 0;
|
||||||
#if FLTK_ABI_VERSION >= 10303
|
#if FLTK_ABI_VERSION >= 10303
|
||||||
@ -111,6 +114,9 @@ Fl_Tree_Item::~Fl_Tree_Item() {
|
|||||||
}
|
}
|
||||||
_widget = 0; // Fl_Group will handle destruction
|
_widget = 0; // Fl_Group will handle destruction
|
||||||
_usericon = 0; // user handled allocation
|
_usericon = 0; // user handled allocation
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
if ( _userdeicon ) delete _userdeicon; // delete our copy (if any) for deactivated icon
|
||||||
|
#endif
|
||||||
//_children.clear(); // array's destructor handles itself
|
//_children.clear(); // array's destructor handles itself
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,8 +934,8 @@ int Fl_Tree_Item::calc_item_height(const Fl_Tree_Prefs &prefs) const {
|
|||||||
///
|
///
|
||||||
Fl_Color Fl_Tree_Item::drawfgcolor() const {
|
Fl_Color Fl_Tree_Item::drawfgcolor() const {
|
||||||
return is_selected() ? fl_contrast(_labelfgcolor, tree()->selection_color())
|
return is_selected() ? fl_contrast(_labelfgcolor, tree()->selection_color())
|
||||||
: is_active() ? _labelfgcolor
|
: (is_active() && tree()->active_r()) ? _labelfgcolor
|
||||||
: fl_inactive(_labelfgcolor);
|
: fl_inactive(_labelfgcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the recommended background color used for drawing this item.
|
/// Returns the recommended background color used for drawing this item.
|
||||||
@ -938,8 +944,8 @@ Fl_Color Fl_Tree_Item::drawfgcolor() const {
|
|||||||
///
|
///
|
||||||
Fl_Color Fl_Tree_Item::drawbgcolor() const {
|
Fl_Color Fl_Tree_Item::drawbgcolor() const {
|
||||||
const Fl_Color unspecified = 0xffffffff;
|
const Fl_Color unspecified = 0xffffffff;
|
||||||
return is_selected() ? is_active() ? tree()->selection_color()
|
return is_selected() ? is_active() && tree()->active_r() ? tree()->selection_color()
|
||||||
: fl_inactive(tree()->selection_color())
|
: fl_inactive(tree()->selection_color())
|
||||||
: _labelbgcolor == unspecified ? tree()->color()
|
: _labelbgcolor == unspecified ? tree()->color()
|
||||||
: _labelbgcolor;
|
: _labelbgcolor;
|
||||||
}
|
}
|
||||||
@ -1142,6 +1148,9 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
|
|||||||
}
|
}
|
||||||
char clipped = ((Y+H) < tree_top) || (Y>tree_bot) ? 1 : 0;
|
char clipped = ((Y+H) < tree_top) || (Y>tree_bot) ? 1 : 0;
|
||||||
if (!render) clipped = 0; // NOT rendering? Then don't clip, so we calc unclipped items
|
if (!render) clipped = 0; // NOT rendering? Then don't clip, so we calc unclipped items
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
char active = (is_active() && tree()->active_r()) ? 1 : 0;
|
||||||
|
#endif
|
||||||
char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
|
char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
|
||||||
if ( !clipped ) {
|
if ( !clipped ) {
|
||||||
Fl_Color fg = drawfgcolor();
|
Fl_Color fg = drawfgcolor();
|
||||||
@ -1170,13 +1179,36 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
|
|||||||
// Draw collapse icon
|
// Draw collapse icon
|
||||||
if ( render && has_children() && prefs.showcollapse() ) {
|
if ( render && has_children() && prefs.showcollapse() ) {
|
||||||
// Draw icon image
|
// Draw icon image
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
if ( is_open() ) {
|
||||||
|
if ( active ) prefs.closeicon()->draw(icon_x,icon_y);
|
||||||
|
else prefs.closedeicon()->draw(icon_x,icon_y);
|
||||||
|
} else {
|
||||||
|
if ( active ) prefs.openicon()->draw(icon_x,icon_y);
|
||||||
|
else prefs.opendeicon()->draw(icon_x,icon_y);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( is_open() ) {
|
if ( is_open() ) {
|
||||||
prefs.closeicon()->draw(icon_x,icon_y);
|
prefs.closeicon()->draw(icon_x,icon_y);
|
||||||
} else {
|
} else {
|
||||||
prefs.openicon()->draw(icon_x,icon_y);
|
prefs.openicon()->draw(icon_x,icon_y);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Draw user icon (if any)
|
// Draw user icon (if any)
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
if ( render && usericon() ) {
|
||||||
|
// Item has user icon? Use it
|
||||||
|
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
||||||
|
if ( active ) usericon()->draw(uicon_x,uicon_y);
|
||||||
|
else userdeicon()->draw(uicon_x,uicon_y);
|
||||||
|
} else if ( render && prefs.usericon() ) {
|
||||||
|
// Prefs has user icon? Use it
|
||||||
|
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
||||||
|
if ( active ) prefs.usericon()->draw(uicon_x,uicon_y);
|
||||||
|
else prefs.userdeicon()->draw(uicon_x,uicon_y);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( render && usericon() ) {
|
if ( render && usericon() ) {
|
||||||
// Item has user icon? Use it
|
// Item has user icon? Use it
|
||||||
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
||||||
@ -1186,6 +1218,7 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
|
|||||||
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
||||||
prefs.usericon()->draw(uicon_x,uicon_y);
|
prefs.usericon()->draw(uicon_x,uicon_y);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Draw item's content
|
// Draw item's content
|
||||||
xmax = draw_item_content(render);
|
xmax = draw_item_content(render);
|
||||||
} // end non-child damage
|
} // end non-child damage
|
||||||
@ -1336,13 +1369,15 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
|
|||||||
}
|
}
|
||||||
char clipped = ((Y+H) < tree_top) || (Y>tree_bot) ? 1 : 0;
|
char clipped = ((Y+H) < tree_top) || (Y>tree_bot) ? 1 : 0;
|
||||||
char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
|
char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
|
||||||
|
char active = (is_active() && tree->active_r()) ? 1 : 0;
|
||||||
if ( !clipped ) {
|
if ( !clipped ) {
|
||||||
const Fl_Color unspecified = 0xffffffff;
|
const Fl_Color unspecified = 0xffffffff;
|
||||||
|
|
||||||
Fl_Color fg = is_selected() ? fl_contrast(_labelfgcolor, tree->selection_color())
|
Fl_Color fg = is_selected() ? fl_contrast(_labelfgcolor, tree->selection_color())
|
||||||
: is_active() ? _labelfgcolor
|
: active ? _labelfgcolor
|
||||||
: fl_inactive(_labelfgcolor);
|
: fl_inactive(_labelfgcolor);
|
||||||
Fl_Color bg = is_selected() ? is_active() ? tree->selection_color()
|
Fl_Color bg = is_selected() ? active ? tree->selection_color()
|
||||||
: fl_inactive(tree->selection_color())
|
: fl_inactive(tree->selection_color())
|
||||||
: _labelbgcolor == unspecified ? tree->color()
|
: _labelbgcolor == unspecified ? tree->color()
|
||||||
: _labelbgcolor;
|
: _labelbgcolor;
|
||||||
// See if we should draw this item
|
// See if we should draw this item
|
||||||
@ -1369,11 +1404,21 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
|
|||||||
// Draw collapse icon
|
// Draw collapse icon
|
||||||
if ( has_children() && prefs.showcollapse() ) {
|
if ( has_children() && prefs.showcollapse() ) {
|
||||||
// Draw icon image
|
// Draw icon image
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
if ( is_open() ) {
|
||||||
|
if ( active ) prefs.closeicon()->draw(icon_x,icon_y);
|
||||||
|
else prefs.closedeicon()->draw(icon_x,icon_y);
|
||||||
|
} else {
|
||||||
|
if ( active ) prefs.openicon()->draw(icon_x,icon_y);
|
||||||
|
else prefs.opendeicon()->draw(icon_x,icon_y);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( is_open() ) {
|
if ( is_open() ) {
|
||||||
prefs.closeicon()->draw(icon_x,icon_y);
|
prefs.closeicon()->draw(icon_x,icon_y);
|
||||||
} else {
|
} else {
|
||||||
prefs.openicon()->draw(icon_x,icon_y);
|
prefs.openicon()->draw(icon_x,icon_y);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Draw background for the item.. only if different from tree's bg color
|
// Draw background for the item.. only if different from tree's bg color
|
||||||
if ( bg != tree->color() || is_selected() ) {
|
if ( bg != tree->color() || is_selected() ) {
|
||||||
@ -1386,6 +1431,19 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
|
|||||||
if ( widget() ) widget()->damage(FL_DAMAGE_ALL); // if there's a child widget, we just damaged it
|
if ( widget() ) widget()->damage(FL_DAMAGE_ALL); // if there's a child widget, we just damaged it
|
||||||
}
|
}
|
||||||
// Draw user icon (if any)
|
// Draw user icon (if any)
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
if ( usericon() ) {
|
||||||
|
// Item has user icon? Use it
|
||||||
|
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
||||||
|
if ( active ) usericon()->draw(uicon_x,uicon_y);
|
||||||
|
else userdeicon()->draw(uicon_x,uicon_y);
|
||||||
|
} else if ( prefs.usericon() ) {
|
||||||
|
// Prefs has user icon? Use it
|
||||||
|
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
||||||
|
if ( active ) prefs.usericon()->draw(uicon_x,uicon_y);
|
||||||
|
else prefs.userdeicon()->draw(uicon_x,uicon_y);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if ( usericon() ) {
|
if ( usericon() ) {
|
||||||
// Item has user icon? Use it
|
// Item has user icon? Use it
|
||||||
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
int uicon_y = item_y_center - (usericon()->h() >> 1);
|
||||||
@ -1395,6 +1453,7 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
|
|||||||
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
int uicon_y = item_y_center - (prefs.usericon()->h() >> 1);
|
||||||
prefs.usericon()->draw(uicon_x,uicon_y);
|
prefs.usericon()->draw(uicon_x,uicon_y);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// Draw label
|
// Draw label
|
||||||
#if FLTK_ABI_VERSION >= 10301
|
#if FLTK_ABI_VERSION >= 10301
|
||||||
if ( _label &&
|
if ( _label &&
|
||||||
|
@ -107,6 +107,16 @@ static Fl_Pixmap L_closepixmap(L_close_xpm);
|
|||||||
///
|
///
|
||||||
void Fl_Tree_Prefs::openicon(Fl_Image *val) {
|
void Fl_Tree_Prefs::openicon(Fl_Image *val) {
|
||||||
_openimage = val ? val : &L_openpixmap;
|
_openimage = val ? val : &L_openpixmap;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
// Update deactivated version of icon..
|
||||||
|
if ( _opendeimage ) delete _opendeimage;
|
||||||
|
if ( _openimage ) {
|
||||||
|
_opendeimage = _openimage->copy();
|
||||||
|
_opendeimage->inactive();
|
||||||
|
} else {
|
||||||
|
_opendeimage = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the icon to be used as the 'close' icon.
|
/// Sets the icon to be used as the 'close' icon.
|
||||||
@ -116,6 +126,16 @@ void Fl_Tree_Prefs::openicon(Fl_Image *val) {
|
|||||||
///
|
///
|
||||||
void Fl_Tree_Prefs::closeicon(Fl_Image *val) {
|
void Fl_Tree_Prefs::closeicon(Fl_Image *val) {
|
||||||
_closeimage = val ? val : &L_closepixmap;
|
_closeimage = val ? val : &L_closepixmap;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
// Update deactivated version of icon..
|
||||||
|
if ( _closedeimage ) delete _closedeimage;
|
||||||
|
if ( _closeimage ) {
|
||||||
|
_closedeimage = _closeimage->copy();
|
||||||
|
_closedeimage->inactive();
|
||||||
|
} else {
|
||||||
|
_closedeimage = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fl_Tree_Prefs constructor
|
/// Fl_Tree_Prefs constructor
|
||||||
@ -145,6 +165,13 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
|
|||||||
_openimage = &L_openpixmap;
|
_openimage = &L_openpixmap;
|
||||||
_closeimage = &L_closepixmap;
|
_closeimage = &L_closepixmap;
|
||||||
_userimage = 0;
|
_userimage = 0;
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
_opendeimage = _openimage->copy();
|
||||||
|
_opendeimage->inactive();
|
||||||
|
_closedeimage = _closeimage->copy();
|
||||||
|
_closedeimage->inactive();
|
||||||
|
_userdeimage = 0;
|
||||||
|
#endif
|
||||||
_showcollapse = 1;
|
_showcollapse = 1;
|
||||||
_showroot = 1;
|
_showroot = 1;
|
||||||
_connectorwidth = 17;
|
_connectorwidth = 17;
|
||||||
@ -167,6 +194,15 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if FLTK_ABI_VERSION >= 10304
|
||||||
|
/// Fl_Tree_Prefs destructor
|
||||||
|
Fl_Tree_Prefs::~Fl_Tree_Prefs() {
|
||||||
|
if ( _opendeimage ) delete _opendeimage;
|
||||||
|
if ( _closedeimage ) delete _closedeimage;
|
||||||
|
if ( _userdeimage ) delete _userdeimage;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id$".
|
// End of "$Id$".
|
||||||
//
|
//
|
||||||
|
38
test/tree.fl
38
test/tree.fl
@ -346,7 +346,7 @@ Function {} {open
|
|||||||
} {
|
} {
|
||||||
Fl_Window window {
|
Fl_Window window {
|
||||||
label tree open
|
label tree open
|
||||||
xywh {115 293 1045 580} type Double hide
|
xywh {600 253 1045 580} type Double visible
|
||||||
} {
|
} {
|
||||||
Fl_Group tree {
|
Fl_Group tree {
|
||||||
label Tree
|
label Tree
|
||||||
@ -640,7 +640,7 @@ switch ( selectmode_chooser->value() ) {
|
|||||||
case 2: tree->selectmode(FL_TREE_SELECT_MULTI); break; // Multi
|
case 2: tree->selectmode(FL_TREE_SELECT_MULTI); break; // Multi
|
||||||
case 3: tree->selectmode(FL_TREE_SELECT_SINGLE_DRAGGABLE); break; // Single draggable
|
case 3: tree->selectmode(FL_TREE_SELECT_SINGLE_DRAGGABLE); break; // Single draggable
|
||||||
default: tree->selectmode(FL_TREE_SELECT_SINGLE); break; // Single
|
default: tree->selectmode(FL_TREE_SELECT_SINGLE); break; // Single
|
||||||
}} open selected
|
}} open
|
||||||
tooltip {Tests Fl_Tree::selectmode()
|
tooltip {Tests Fl_Tree::selectmode()
|
||||||
Sets how Fl_Tree handles mouse selection of tree items.
|
Sets how Fl_Tree handles mouse selection of tree items.
|
||||||
NONE -- Not selectable by keyboard/mouse
|
NONE -- Not selectable by keyboard/mouse
|
||||||
@ -1205,9 +1205,9 @@ tree->redraw();}
|
|||||||
tooltip {Sets the Fl_Tree_Item::labelbgcolor() for the selected items. If none selected, all are changed.} xywh {863 99 16 16} box DOWN_BOX labelsize 11 align 7
|
tooltip {Sets the Fl_Tree_Item::labelbgcolor() for the selected items. If none selected, all are changed.} xywh {863 99 16 16} box DOWN_BOX labelsize 11 align 7
|
||||||
code0 {o->color(GetSelectedItemBGColor());}
|
code0 {o->color(GetSelectedItemBGColor());}
|
||||||
}
|
}
|
||||||
Fl_Light_Button deactivate_toggle {
|
Fl_Light_Button deactivate_items_toggle {
|
||||||
label { Deactivate}
|
label { Deactivate Items}
|
||||||
callback {int onoff = deactivate_toggle->value() ? 0 : 1;
|
callback {int onoff = deactivate_items_toggle->value() ? 0 : 1;
|
||||||
|
|
||||||
Fl_Tree_Item *item;
|
Fl_Tree_Item *item;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -1226,7 +1226,15 @@ if ( count == 0 ) {
|
|||||||
|
|
||||||
tree->redraw();}
|
tree->redraw();}
|
||||||
tooltip {Toggle the deactivation state of the selected items.
|
tooltip {Toggle the deactivation state of the selected items.
|
||||||
If none are selected, all are set.} xywh {769 134 95 16} selection_color 1 labelsize 9
|
If none are selected, all are set.} xywh {758 134 100 16} selection_color 1 labelsize 9
|
||||||
|
}
|
||||||
|
Fl_Light_Button deactivate_tree_toggle {
|
||||||
|
label { Deactivate Tree}
|
||||||
|
callback {if ( deactivate_tree_toggle->value() )
|
||||||
|
tree->deactivate();
|
||||||
|
else
|
||||||
|
tree->activate();} selected
|
||||||
|
tooltip {Deactivates the entire tree widget} xywh {758 154 100 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button bold_toggle {
|
Fl_Light_Button bold_toggle {
|
||||||
label { Bold Font}
|
label { Bold Font}
|
||||||
@ -1251,7 +1259,7 @@ if ( ! count ) {
|
|||||||
|
|
||||||
tree->redraw();}
|
tree->redraw();}
|
||||||
tooltip {Toggles bold font for selected items
|
tooltip {Toggles bold font for selected items
|
||||||
If nothing selected, all are changed} xywh {769 154 95 16} selection_color 1 labelsize 9
|
If nothing selected, all are changed} xywh {758 174 100 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Button showselected_button {
|
Fl_Button showselected_button {
|
||||||
label {Show Selected}
|
label {Show Selected}
|
||||||
@ -1312,13 +1320,13 @@ Swaps two selected items (items must be siblings)} xywh {864 174 95 16} labelsiz
|
|||||||
label {Select All}
|
label {Select All}
|
||||||
callback {tree->select_all(0);
|
callback {tree->select_all(0);
|
||||||
tree->redraw();}
|
tree->redraw();}
|
||||||
tooltip {Selects all items in the tree} xywh {724 199 95 16} labelsize 9
|
tooltip {Selects all items in the tree} xywh {714 199 95 16} labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Button deselectall_button {
|
Fl_Button deselectall_button {
|
||||||
label {Deselect All}
|
label {Deselect All}
|
||||||
callback {tree->deselect_all(0);
|
callback {tree->deselect_all(0);
|
||||||
tree->redraw();}
|
tree->redraw();}
|
||||||
tooltip {Deselects all items in the tree} xywh {724 219 95 16} labelsize 9
|
tooltip {Deselects all items in the tree} xywh {714 219 95 16} labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Button nextselected_button {
|
Fl_Button nextselected_button {
|
||||||
label {next_selected()}
|
label {next_selected()}
|
||||||
@ -1332,7 +1340,7 @@ printf(" // Walk up the tree (backwards)\\n");
|
|||||||
for ( Fl_Tree_Item *i=tree->last_selected_item(); i; i=tree->next_selected_item(i, FL_Up) ) {
|
for ( Fl_Tree_Item *i=tree->last_selected_item(); i; i=tree->next_selected_item(i, FL_Up) ) {
|
||||||
printf(" Selected item: %s\\n", i->label()?i->label():"<nolabel>");
|
printf(" Selected item: %s\\n", i->label()?i->label():"<nolabel>");
|
||||||
}}
|
}}
|
||||||
tooltip {Tests the Fl_Tree::next_selected() function} xywh {723 239 95 16} labelsize 9
|
tooltip {Tests the Fl_Tree::next_selected() function} xywh {713 239 95 16} labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button bbbselect_toggle {
|
Fl_Light_Button bbbselect_toggle {
|
||||||
label { Select Bbb}
|
label { Select Bbb}
|
||||||
@ -1346,7 +1354,7 @@ int onoff = bbbselect_toggle->value();
|
|||||||
if ( onoff ) tree->select(bbb); // select /Bbb
|
if ( onoff ) tree->select(bbb); // select /Bbb
|
||||||
else tree->deselect(bbb); // deselect /Bbb}
|
else tree->deselect(bbb); // deselect /Bbb}
|
||||||
tooltip {Toggle selection of just the /Bbb item
|
tooltip {Toggle selection of just the /Bbb item
|
||||||
(Not children)} xywh {819 199 95 16} selection_color 1 labelsize 9
|
(Not children)} xywh {814 199 95 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button bbbselect2_toggle {
|
Fl_Light_Button bbbselect2_toggle {
|
||||||
label { Select Bbb+}
|
label { Select Bbb+}
|
||||||
@ -1359,7 +1367,7 @@ if ( !bbb) {
|
|||||||
int onoff = bbbselect2_toggle->value();
|
int onoff = bbbselect2_toggle->value();
|
||||||
if ( onoff ) tree->select_all(bbb); // select /Bbb and its children
|
if ( onoff ) tree->select_all(bbb); // select /Bbb and its children
|
||||||
else tree->deselect_all(bbb); // deselect /Bbb and its children}
|
else tree->deselect_all(bbb); // deselect /Bbb and its children}
|
||||||
tooltip {Toggle selection of the /Bbb item and its children} xywh {819 219 95 16} selection_color 1 labelsize 9
|
tooltip {Toggle selection of the /Bbb item and its children} xywh {814 219 95 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button bbbchild02select_toggle {
|
Fl_Light_Button bbbchild02select_toggle {
|
||||||
label { Toggle child-02}
|
label { Toggle child-02}
|
||||||
@ -1374,7 +1382,7 @@ if ( err == -1 ) {
|
|||||||
fl_alert("FAIL: Couldn't find item '%s'",pathname);
|
fl_alert("FAIL: Couldn't find item '%s'",pathname);
|
||||||
return;
|
return;
|
||||||
}}
|
}}
|
||||||
tooltip {Toggle the single item "/Bbb/child-02" using the item's "pathname".} xywh {819 239 95 16} selection_color 1 labelsize 9
|
tooltip {Toggle the single item "/Bbb/child-02" using the item's "pathname".} xywh {814 239 95 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button rootselect_toggle {
|
Fl_Light_Button rootselect_toggle {
|
||||||
label {Select ROOT}
|
label {Select ROOT}
|
||||||
@ -1387,7 +1395,7 @@ if ( !item) {
|
|||||||
int onoff = rootselect_toggle->value();
|
int onoff = rootselect_toggle->value();
|
||||||
if ( onoff ) tree->select(item); // select /ROOT and its children
|
if ( onoff ) tree->select(item); // select /ROOT and its children
|
||||||
else tree->deselect(item); // deselect /ROOT and its children}
|
else tree->deselect(item); // deselect /ROOT and its children}
|
||||||
tooltip {Toggle selection of the ROOT item} xywh {914 199 95 16} selection_color 1 labelsize 9
|
tooltip {Toggle selection of the ROOT item} xywh {914 199 100 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Light_Button rootselect2_toggle {
|
Fl_Light_Button rootselect2_toggle {
|
||||||
label {Select ROOT+}
|
label {Select ROOT+}
|
||||||
@ -1400,7 +1408,7 @@ if ( !item) {
|
|||||||
int onoff = rootselect2_toggle->value();
|
int onoff = rootselect2_toggle->value();
|
||||||
if ( onoff ) tree->select_all(item); // select /ROOT and its children
|
if ( onoff ) tree->select_all(item); // select /ROOT and its children
|
||||||
else tree->deselect_all(item); // deselect /ROOT and its children}
|
else tree->deselect_all(item); // deselect /ROOT and its children}
|
||||||
tooltip {Toggle selection of the ROOT item and all children} xywh {914 219 95 16} selection_color 1 labelsize 9
|
tooltip {Toggle selection of the ROOT item and all children} xywh {914 219 100 16} selection_color 1 labelsize 9
|
||||||
}
|
}
|
||||||
Fl_Box {} {
|
Fl_Box {} {
|
||||||
label {Tree Fonts + Colors}
|
label {Tree Fonts + Colors}
|
||||||
|
Loading…
Reference in New Issue
Block a user