29#include <sptk5/gui/CDataControl.h>
30#include <sptk5/gui/CPngImage.h>
31#include <sptk5/gui/CTreeControl.h>
74#ifdef __COMPATIBILITY_MODE__
83 CTreeView(
int x,
int y,
int w,
int h,
const char* label = 0);
116 void* data =
nullptr)
118 return m_treeControl->
addItem(label.c_str(), openedImage, closedImage, data);
130 CTreeItem*
addPath(
const std::vector<String>& path,
const Fl_Image* openedImage,
const Fl_Image* closedImage,
131 const Fl_Image* itemImage =
nullptr,
void* data =
nullptr)
133 return m_treeControl->
addPath(path, openedImage, closedImage, itemImage, data);
143 CTreeItem*
addPath(
const std::vector<String>& path,
const Fl_Image* itemImage = 0L,
void* data =
nullptr)
145 return m_treeControl->
addPath(path, itemImage, itemImage, itemImage, data);
153 m_treeControl->removeItem(item);
174 m_treeControl->clear();
182 m_treeControl->relayout();
193 void resize(
int x,
int y,
int w,
int h)
override;
222 void load(
const xdoc::SNode& node)
override;
231 void save(
const xdoc::SNode& node)
const override;
Base class for most of SPTK widgets.
Definition: CControl.h:222
Definition: CLayoutClient.h:82
Tree widget.
Definition: CTreeControl.h:463
Tree widget item.
Definition: CTreeControl.h:66
bool selected() const
Returns selection state of the item.
Definition: CTreeControl.h:352
CTreeItem * addItem(const char *label, const Fl_Image *openedImage=nullptr, const Fl_Image *closedImage=nullptr, void *data=nullptr)
CTreeItem * addPath(const std::vector< String > &path, const Fl_Image *openedImage, const Fl_Image *closedImage, const Fl_Image *itemImage=0L, void *data=0L)
Tree view widget.
Definition: CTreeView.h:47
void relayout()
Relayouts the tree. May be necessary after you've changed items data a lot.
Definition: CTreeView.h:180
bool valid() const override
Returns true if data is valid.
Definition: CTreeView.h:236
~CTreeView() override=default
Destructor.
Variant data() const override
Returns the currently selected item ID (or user_data)
CTreeItem * addPath(const std::vector< String > &path, const Fl_Image *itemImage=0L, void *data=nullptr)
Adds a child item to the item using the default folder images.
Definition: CTreeView.h:143
CTreeItem * addPath(const std::vector< String > &path, const Fl_Image *openedImage, const Fl_Image *closedImage, const Fl_Image *itemImage=nullptr, void *data=nullptr)
Adds a child item to the item using the path. The required path items are created automatically.
Definition: CTreeView.h:130
void load(const xdoc::SNode &node) override
Loads the the widget from XML node.
String selectedPath() const
Returns currently selected item path in the tree.
static CLayoutClient * creator(const xdoc::SNode &node)
Creates a widget based on the XML node information.
CTreeView(const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
Constructor in SPTK style.
static void internal_callback(Fl_Widget *, void *)
Internal tree control callback.
CTreeItem * selected() const
Returns currently selected item.
Definition: CTreeView.h:159
void data(const Variant &v) override
Selects the item with matching ID (or user_data)
void resize(int x, int y, int w, int h) override
Resizes the control and inside widgets.
String className() const override
Returns controls' class name (internal SPTK RTTI).
Definition: CTreeView.h:102
void save(Query *) override
Data connection isn't implemented yet.
virtual void clear()
Removes all the tree items.
Definition: CTreeView.h:172
CTreeItem * addItem(const String &label, const Fl_Image *openedImage, const Fl_Image *closedImage=nullptr, void *data=nullptr)
Adds a child item to the item. If the closedImage parameter is omitted the openedImage is used instea...
Definition: CTreeView.h:115
void save(const xdoc::SNode &node) const override
Saves the the widget to XML node.
void removeItem(CTreeItem *item)
Removes an item from the parent tree item.
Definition: CTreeView.h:151
CControlKind kind() const override
Returns controls' kind (internal SPTK RTTI).
Definition: CTreeView.h:94
void load(Query *) override
Data connection isn't implemented yet.
Definition: Variant.h:372
CControlKind
Control kind is the constant to report the internal SPTK RTTI.
Definition: CControl.h:50
CLayoutAlign
Definition: CLayoutClient.h:44