summaryrefslogtreecommitdiff
path: root/src/Fl_Tree.cxx
AgeCommit message (Collapse)Author
2 dayswi[maxim nikonov
2024-07-17Fix last_visible_item() to check parents (#1012)Greg Ercolano
2024-06-30Fl_Tree +/- buttons are no longer drawn using bitmaps, different default ↵Cyprinus Carpio
line color (#995) Fl_Tree changed to support system color themes (PR #995) merging CyprinusCarpio's mods carried over from from issue #972. * Fl_Tree: use named (colormap) colors to support system color themes (see issue #972). changed connectorcolor() default from gray ramp color to FL_INACTIVE_COLOR (Fl_Color(8)), and similar named colormap colors for icon drawing. * Fl_Tree ⊞ / ⊟ icons (and on macs, ▶ / ▼icons) are now drawn w/fl_draw() functions instead of with xpm bitmaps for colormap control --------- Co-authored-by: Greg Ercolano <erco@seriss.com>
2024-05-09Followup: avoid dereference null pointer (#971)Greg Ercolano
Changing _root->find_clicked(..) to just find_clicked(..) includes the check of _root for NULL, which is probably better than doing a repeat explicit check and early exit.
2024-05-08Avoid possible dereferencing of null pointer (#971)ManoloFLTK
2023-01-05Add close buttons for individual tabs in Fl_Tabs (#628)Matthias Melcher
Add close buttons for Fl_Tabs Introducing callback reasons FLUID shows all FL_WHEN_... options Adding Fl_Tabs overflow types Improved test/tabs to show new features
2022-09-26Replace all calls to sprintf() by calls to snprintf().ManoloFLTK
2022-01-16Rename FL/fl_string.h to FL/fl_string_functions.hAlbrecht Schlosser
This is part 1 of the final fix for a previous name clash on case insensitive file systems (fl_string.h vs. Fl_String.H).
2020-08-01Implement + deploy fl_strdup()Greg Ercolano
2020-07-06Remove $Id$ tags, update URL's, and moreAlbrecht Schlosser
- remove obsolete svn '$Id$' tags from all source files - update .fl files and generated files accordingly - replace 'http://www.fltk.org' URL's with 'https://...' - replace bug report URL 'str.php' with 'bugs.php' - remove trailing whitespace - fix other whitespace errors flagged by Git - add and/or fix missing or wrong standard headers - convert tabs to spaces in all source files The only relevant code changes are in the fluid/ folder where some .fl files and other source files were used to generate the '$Id' headers and footers.
2019-08-27Fix STR #3432: fixed drag+drop on folderGreg Ercolano
With reference to Sanch's patch from the STR, plus some extra mods for handling edge conditions (such as root()) and comment clarifications.
2019-08-25More fixes for STR #3527; handle usericons, etcGreg Ercolano
2019-08-24Fixes STR #3527: Fl_Tree small drags on open/close icons change selectionGreg Ercolano
2019-01-25Fix Fl_Tree::insert() with pos out ouf range (#18)Albrecht Schlosser
The given position to insert a new item was not checked against the valid range so the program could crash if a position less than zero or greater than children() was given. The position is now clamped to the valid range, i.e. the item is either prepended or appended. Fixes issue #18.
2018-08-06Fl_Tree documentation fixes for html/pdf, doxygen 1.8.5Greg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13008 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-23Doxygen only: fixed all block comments starting with an asterisk to ↵Matthias Melcher
space-only, fixed doxygen keywords prepended with @ to use a backward slash instead. No code was changed. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12970 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-26Bringing over fix [r11986] from 1.3 current to the porting branch.Greg Ercolano
Small doc clarification for omitted word, caught by Albrecht via private email. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11987 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-24Fl_Tree documentation fixes and two missing statements.Albrecht Schlosser
Missing statements found while merging fixes from branch-1.3. Todo: check if they have been 'lost' in the porting process or removed deliberately in branch-1.3-porting. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11976 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-07-19Bringing over this fix from 1.3 current to the porting branch.Greg Ercolano
Applies small code simplification as suggested in comment #15 of STR#2828. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11821 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-13Remove FL_ABI_VERSION clauses from the Fl_Tree class source codeManolo Gouy
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11602 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-21Fix some, but not all doxygen warnings.Albrecht Schlosser
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11395 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-14More carry from r11173 to porting..Greg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11363 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-14Carrying fix from 1.3-current (r11177) to the new porting branch.Greg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11361 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-18Fix and improve Fl_Table docs, fix some other typos.Albrecht Schlosser
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10799 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-12-19Fixes STR #3169, comments #4, #5 and #7.Greg Ercolano
Prevents warnings from the OSX 10.9.x clang compiler. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10493 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-05Add support for dragging to reorder in Fl_Tree, STR #2828 (I)Lauri Kasanen
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10275 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-27Fixes STR#3041, int -> size_tGreg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10086 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-24More Fl_Tree doc improvements.Greg Ercolano
Only docs changed here, no code changed.. one method's definition moved to match similar method organization. Some redundant docs (for const vs. non-const) changed by referring the non-const method to the const one, to reduce size. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-23Small doc tweaks to Fl_Tree's insert()/insert_above() docs.Greg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10080 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-23Added some code examples to docs forGreg Ercolano
Fl_Tree::insert() Fl_Tree::insert_above() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10079 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-21Added missing non-const versions of find_clicked()Greg Ercolano
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10072 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-20o Added draw_item_content() to Fl_Tree_Item,Greg Ercolano
a volatile method that can be overridden by subclasses to take drawing control of tree item's content. This replaces the old "item_draw_callback()" technique added a few months ago as an ABI feature; turned out the new technique is a better way to go. o The examples/tree-custom-draw-items.cxx demo adjusted accordingly. o Added missing docs for some methods that had none, including label_[xywh](). o Added related methods needed to implement this, including: Fl_Tree_Item_Array::replace() Fl_Tree_Item::replace() Fl_Tree::root(item) Fl_Tree::add() variations Fl_Tree_Item::drawbgcolor()/drawfgcolor() o Carefully worked the FLTK_ABI_VERSION macros so as to be ABI compatible with 1.3.0. o Verified 1.3.0 ABI compatibility with ABI Compliance Checker 1.99.8.5: http://ispras.linuxbase.org/index.php/ABI_compliance_checker git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10071 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-16ABI fixes.Greg Ercolano
These are problems "ABI Compliance Checker" found with the recent Fl_Tree mods. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10062 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-01-13Fix small memleak in parse_path() if user tries to add() paths like "" or "/".Greg Ercolano
Also shrunk implementation code. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10054 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-12-28* Fixes STR#3024 issue with Fl_Tree::find_item()Greg Ercolano
* Removes redundant const vs. non-const code using technique from Scott Meyers' book "Effective C++", 3rd Ed. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10038 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-12-15Adds horizontal scrollbar to Fl_Tree as an ABI 1.3.3 feature.Greg Ercolano
*************************************************************** NOTE: You MUST uncomment the FLTK_ABI_VERSION in Enumerations.H to use these changes. *************************************************************** Also: separated tree size calculation from draw() code, so that one can cause the tree to recalculate immediately after making modifications to the tree by calling Fl_Tree::calc_tree(). Numerous improvements to docs for the tree as well, enough to create a rather large diff. Large internal changes were needed to do this properly. The following was added to the CHANGES file: - Fl_Tree: various related changes: o Added horizontal scrollbar o Separated draw() and tree size calculation o Added new public methods: > resize() -- uses optimized dim calc, avoids tree recalc > next_item() -- added parameters: direction, visibility > extend_selection() -- added parameters, improved algorithm > calc_dimensions() -- calc tix/y/w/h, tox/y/w/h and scrollbars > calc_tree() -- calc tree_w/tree_h > recalc_tree() -- schedules calc_tree() > first_visible_item(), last_visible_item(), next_visible_item() > first_selected_item(), last_selected_item(), next_selected_item() o Added protected variables: > _tix/y/w/h -- tree widget 'inner' dimension > _tox/y/w/h -- tree widget 'outer' dimension > _tree_w,_tree_h -- entire tree hierarchy width/height o Deprecated: > item_clicked() -- use callback_item() instead > first_visible() -- use first_visible_item() instead > last_visible() -- use last_visible_item() instead - Fl_Tree_Item: various related changes: o Added Fl_Tree ptr: needed for auto-recalc when item modified directly o Added new methods tree(), recalc_tree() o Added new ctor that accepts Fl_Tree* o draw() parameters changed to include tree size calculations o Deprecated: > ctor using Fl_Tree_Prefs parameter (Fl_Tree* version better, and must be used for 1.3.3 ABI features to work correctly) > next_displayed() -- use next_visible() instead > prev_displayed() -- use prev_visible() instead - test/tree: added tests for newly added features git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10034 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-11-10o Added Fl_Tree::item_draw_callback(), letting one define a custom draw ↵Greg Ercolano
function for Fl_Tree_Item's. o Added examples/tree-custom-draw-items.cxx to demonstrate its use. o Fixed small doc error for recent Fl_Tree::get_selected_items() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10018 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-11-06Fl_Tree:Greg Ercolano
o Added new method Fl_Tree::get_selected_items() o Modified Fl_Tree_Item_Array to usable in a general way (i.e. beyond Fl_Tree's internal use) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10016 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2013-11-06Fix problem with Fl_Tree::select_only() invoking select callbacksGreg Ercolano
before all other items have first been deselected. Also: added some related demo code to tree-simple to demonstrate 'reselect' callbacks, where a callback can be invoked when an item that's selected already is 're-selected'. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10015 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-11-06Replaced 10302 with 10301 for FLTK_ABI_VERSIONMatthias Melcher
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9706 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-29Fixed some keynav problems:Greg Ercolano
No focus, hitting down would skip first item Enter key to toggle was falling through to other widgets Removing an item that has focus clears item focus (to prevent wild ptr) Added new methods: Fl_Tree::get_item_focus() Fl_Tree::first_visible() Fl_Tree::last_visible() Fl_Tree::is_vscroll_visible() Simplified + fixed Fl_Tree_Item::next_displayed() Fixed Fl_Tree_Item::visible_r(), was skipping item if it was a closed branch. tree demo: fixed button ordering for "Test Suggestions" button git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9555 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-05-09o Added new 0xffffffff 'transparent' color behavior for the item's bg color;Greg Ercolano
with this as the default color, Fl_Tree::color() can control the tree's background. Tests added to the test/tree application. o test/tree.fl modified: o Added a 'Test Suggestions' button to document various tests o Added tests for new 'transparent' color behavior o Added test for STR#2832 to check if items can be drawn to the /right/ of child widgets o Added new methods to Fl_Tree_Prefs: item_labelfont() -- obsoletes labelfont() item_labelsize() -- obsoletes labelsize() item_labelfgcolor() -- obsoletes labelfgcolor() item_labelbgcolor() -- obsoletes labelbgcolor() o Added 'Fonts and Colors' section to Fl_Tree docs o Fl_Tree_Item ABI feature added: using bitflags instead of chars to keep the class small, as it gets instanced a lot. (fast + LIGHT) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9478 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-30Fixes focus issues:Greg Ercolano
o Nav keys were being used even if widget didn't have focus o When Fl_Input was used as immediate child, wasn't redrawing properly when typing into input fields. (noticed problem with test program in STR# 2832) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-27o Added FL_TREE_ITEM_HEIGHT_FROM_WIDGET option to item_draw_mode()Greg Ercolano
to allow widgets to control the size of items in the tree (instead of vice versa). o Added item_draw_mode(int) to allow for easier bitflag maintenance, since enums don't seem to be typesafe yet. o Tree demo modified to demonstrate this feature. An important feature for adding large widgets to tree items. Will probably add an example, 'tree-of-tables' to demo this usage. o Small doc fixes. o Had to rename FL_TREE_ITEM_DRAW_WIDGET_ONLY to FL_TREE_ITEM_DRAW_DEFAULT. Its meaning for the bit fields changed when new bit fields were added. (The prev name just didn't make sense in the new context. Since it was just a few svn commits old and an unreleased ABI feature, it shouldn't affect anyone not in R&D) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9404 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-24Fixes STR #2796Greg Ercolano
Prevent situations where user finds themselves scrolled past bottom of tree. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9400 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-23Various Fl_Tree enhancements:Greg Ercolano
o Added keyboard navigation table o Added Shift-Click to extend selection, Ctrl-Space to toggle selection, Enter key toggle o Added protected extend_selection(from_item,to_item) o Cleanup of Fl_Tree::handle() o Limit ^A to multi-select mode only o Disable focus box in SELECT_NONE mode o test/tree: changed default mode to 'multiselect' (most often needs testing) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9385 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-22o doc fixesGreg Ercolano
o new calc_item_height() -> const o Added a needed ABI ifdef git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9380 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-22Various mods for Fl_TreeGreg Ercolano
o Fix STR#2828 (E): {Vertical|Widget} Gap o Moved Fabien's reselected methods to Fl_Tree_Prefs, return method made const, doxygen, removed underbars from methods (to follow general API) o Widgets can now appear to the right of labels. This can be controlled with item_draw_mode(FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET) o Cleaned up Fl_Tree_Item::draw(), Fl_Tree::draw() o New methods: marginbottom() -- [ABI feature] extra space below last tree element when scrolling widgetmarginleft() -- [ABI feature] space to left of widget usericonmarginleft() -- space to left of usericon labelmarginleft() -- space to left of label item_draw_mode() -- control how items, widget() are drawn o Updated Fl_Tree docs, tree-elements.png o test/tree: added sliders to test the above new features, added "open all" and "close all" buttons o Probably other stuff.. TODO: Fix "scroll-beyond-bottom" (STR#2796) TODO: Fix other items in STR#2828 git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9377 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-19> Added ^A to 'select all' when tree has focusGreg Ercolano
> A user click on the tree's background does a 'deselect all' git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9359 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2012-04-19STR# 2827 cont'd:Greg Ercolano
> Prevent 'changed' flag from being set during reselect > test/tree.fl: added chooser so user can test with item reselect enabled|disabled (Chooser deactivated if the ABI option is not enabled) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9358 ea41ed52-d2ee-0310-a9c1-e6b18d33e121