Doc fix for issue #1310
Some checks failed
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled

This commit is contained in:
Greg Ercolano
2025-10-09 11:28:48 -07:00
parent a24bb896c5
commit 3ee58d2820

View File

@@ -1,5 +1,3 @@
//
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -77,7 +75,10 @@ void Fl_Tree_Item::_Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree) {
} }
/// Constructor. /// Constructor.
/// Makes a new instance of Fl_Tree_Item for \p 'tree'. /// Makes a new instance of Fl_Tree_Item for \p 'tree' with an empty label ("").
/// It's up to you to set the label() of the item before adding it to the tree
/// so that it draws the item's name, and helps methods like Fl_Tree::find_item(path)
/// find the item by name.
/// ///
/// This must be used instead of the older, deprecated Fl_Tree_Item(Fl_Tree_Prefs) /// This must be used instead of the older, deprecated Fl_Tree_Item(Fl_Tree_Prefs)
/// constructor for proper horizontal scrollbar calculation. /// constructor for proper horizontal scrollbar calculation.
@@ -865,8 +866,7 @@ Fl_Color Fl_Tree_Item::drawbgcolor() const {
/// \code /// \code
/// class MyTreeItem : public Fl_Tree_Item { /// class MyTreeItem : public Fl_Tree_Item {
/// public: /// public:
/// MyTreeItem() { } /// MyTreeItem(Fl_Tree *tree_val) : Fl_Tree_Item(tree_val) { }
/// ~MyTreeItem() { }
/// // DRAW OUR CUSTOM CONTENT FOR THE ITEM /// // DRAW OUR CUSTOM CONTENT FOR THE ITEM
/// int draw_item_content(int render) { /// int draw_item_content(int render) {
/// // Our item's dimensions + text content /// // Our item's dimensions + text content
@@ -893,21 +893,23 @@ Fl_Color Fl_Tree_Item::drawbgcolor() const {
/// using any of the fl_draw.H functions, as long as it's /// using any of the fl_draw.H functions, as long as it's
/// within the label's xywh area. /// within the label's xywh area.
/// ///
/// To add instances of your custom item to the tree, you can use: /// To add instances of your custom item to the tree, you can use, e.g.:
/// ///
/// \code /// \code
/// // Example #1: using add() /// // Example #1: using add()
/// MyTreeItem *bart = new MyTreeItem(..); // class derived from Fl_Tree_Item /// MyTreeItem *item = new MyTreeItem(tree); // class derived from Fl_Tree_Item
/// tree->add("/Simpsons/Bart", bart); // Add item as /Simpsons/Bart /// item->label("Bart");
/// tree->add("/Simpsons/.", item); // Adds custom item as "/Simpsons/Bart"
/// \endcode /// \endcode
/// ///
/// ..or you can insert or replace existing items: /// ..or you can insert or replace existing items:
/// ///
/// \code /// \code
/// // Example #2: using replace() /// // Example #2: using replace()
/// MyTreeItem *marge = new MyTreeItem(..); // class derived from Fl_Tree_Item /// MyTreeItem *marge = new MyTreeItem(tree); // class derived from Fl_Tree_Item
/// item = tree->add("/Simpsons/Marge"); // create item /// marge->label("Marge");
/// item->replace(mi); // replace it with our own /// Fl_Tree_Item *item = tree->add("/Simpsons/Marge"); // create default item
/// item->replace(marge); // replace default item with custom item
/// \endcode /// \endcode
/// ///
/// \param[in] render Whether we should render content (1), or just tally /// \param[in] render Whether we should render content (1), or just tally