diff options
| author | Greg Ercolano <erco@seriss.com> | 2010-08-26 13:32:30 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2010-08-26 13:32:30 +0000 |
| commit | c7ef0f1d17f30f98342117f0635702121ce61d9a (patch) | |
| tree | ee7d0742b9e4454d69aec87f363a9c903c444e9d /FL/Fl_Tree_Item.H | |
| parent | 23303736e3cb6a51e72dec08660ca06902925adb (diff) | |
Fl_Tree related mods
* open() / close() now can invoke the callback().
New method callback_reason() lets one determine the cause.
(Used FLU's tree for reference on this)
* new Fl_Tree methods:
> item_pathname()
> show_item(), show_top(), show_middle(), show_bottom().
> next_selected_item() -- loop through the selected items.
> callback_item() -- the item that caused the callback
> callback_reason() -- reason the callback was invoked
FL_TREE_REASON_SELECTED -- item was selected
FL_TREE_REASON_DESELECTED -- item was de-selected
FL_TREE_REASON_OPENED -- item was opened
FL_TREE_REASON_CLOSED -- item was closed
> position()
> display()
* new Fl_Tree_Item methods:
> find_child_item() -- searches children for a path
> find_item() -- searches self and children for a path
> next(item) -- loop forward through tree
> prev(item) -- loop backward through tree
> first_selected_item()
> next_selected_item()
> x(), y(), w(), h()
* deprecated:
> item_clicked(). Use callback_item() instead
* the 'docallback' optional integer argument for all methods
is now back to 0 or 1 only. (Other values became unnecessary
when above new callback() behavior was defined)
* test/tree has new "Test Callback Flags" button to test the
'docallback' flags for eg. open/close/select/deselect
to make sure no bugs creep in.
* INTERNAL: added free_path() to free special path array created by parse_path().
* Various docs strengthened:
* How to use first()/next() and last()/prev() to walk tree
> made sure more method's options use \param[in]
> Added more \see references
* Moved several implementations from .H -> .cxx
* Added autoscroll to keyboard nav and mouse drags
* test/unittests: added Fl_Tree to scrollsize test
TODO:
o Horiz scroll bar (see Johannes Schock's email re. additions he sent)
o Need to allow keyboard nav to move focus to child FLTK widgets
o Fix fast-selections so that no gaps are left behind.
(Select all items from the last selected item to the current)
o Investigate non-default values of when() causing odd behavior.
(See the tree demo's when() pulldown..)
* tree demo modified to include top/mid/bot buttons that test the above.
* Keyboard navigation added:
Up/Down -- move focus
Left/Right -- closes/opens tree item in focus
Spacebar -- toggle selection state of item in focus
Enter -- selects the item in focus, deselecting all others
Tab/Shift-Tab -- change widget focus
* All Fl_Tree select() and deselect() methods now return a value
that indicates if the item's state was changed.
* Fixed focus box drawing (focus box resides more precisely within item's box)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7691 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Tree_Item.H')
| -rw-r--r-- | FL/Fl_Tree_Item.H | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/FL/Fl_Tree_Item.H b/FL/Fl_Tree_Item.H index b10b1e838..983c8c0ab 100644 --- a/FL/Fl_Tree_Item.H +++ b/FL/Fl_Tree_Item.H @@ -83,7 +83,11 @@ public: Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR ~Fl_Tree_Item(); // DTOR Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR - void draw(int X, int &Y, int W, Fl_Widget *tree, const Fl_Tree_Prefs &prefs, int lastchild=1); + int x() const { return(_xywh[0]); } + int y() const { return(_xywh[1]); } + int w() const { return(_xywh[2]); } + int h() const { return(_xywh[3]); } + void draw(int X, int &Y, int W, Fl_Widget *tree, Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1); void show_self(const char *indent = "") const; void label(const char *val); const char *label() const; @@ -163,8 +167,10 @@ public: void clear_children(); void swap_children(int ax, int bx); int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b); - const Fl_Tree_Item *find_item(char **arr) const; - Fl_Tree_Item *find_item(char **arr); + const Fl_Tree_Item *find_child_item(char **arr) const; // const + Fl_Tree_Item *find_child_item(char **arr); // non-const + const Fl_Tree_Item *find_item(char **arr) const; // const + Fl_Tree_Item *find_item(char **arr); // non-const ////////////////// // Adding items ////////////////// @@ -175,12 +181,16 @@ public: int depth() const; Fl_Tree_Item *prev(); Fl_Tree_Item *next(); + Fl_Tree_Item *next_sibling(); + Fl_Tree_Item *prev_sibling(); + Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs); + Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs); - /// Return the parent for this item. + /// Return the parent for this item. Returns NULL if we are the root. Fl_Tree_Item *parent() { return(_parent); } - /// Return the const parent for this item. + /// Return the const parent for this item. Returns NULL if we are the root. const Fl_Tree_Item *parent() const { return(_parent); } @@ -293,6 +303,12 @@ public: char is_active() const { return(_active); } + /// See if the item is visible. + int visible() const { + return(_visible ? 1 : 0); + } + int visible_r() const; + /// Set the user icon's image. '0' will disable. void usericon(Fl_Image *val) { _usericon = val; |
