sptk2 logo
SPTK Home Page

sptk::CTreeView Class Reference
[GUI Classes]

Tree view widget. More...

#include <CTreeView.h>

Inheritance diagram for sptk::CTreeView:

sptk::CControl sptk::CLayoutClient

List of all members.

Public Member Functions

 CTreeView (const char *label=0, int layoutSize=10, CLayoutAlign layoutAlign=SP_ALIGN_TOP)
 Constructor in SPTK style.
 ~CTreeView ()
 Destructor.
virtual CControlKind kind () const
 Returns controls' kind (internal SPTK RTTI).
virtual std::string className () const
 Returns controls' class name (internal SPTK RTTI).
CTreeItemaddItem (std::string label, const Fl_Image *openedImage, const Fl_Image *closedImage=0L, void *data=0L)
 Adds a child item to the item. If the closedImage parameter is omitted the openedImage is used instead.
CTreeItemaddPath (const std::vector< std::string > &path, const Fl_Image *openedImage, const Fl_Image *closedImage, const Fl_Image *itemImage=0L, void *data=0L)
 Adds a child item to the item using the path. The required path items are created automatically.
CTreeItemaddPath (const std::vector< std::string > &path, const Fl_Image *itemImage=0L, void *data=0L)
 Adds a child item to the item using the default folder images.
void removeItem (CTreeItem *item)
 Removes an item from the parent tree item.
CTreeItemselected () const
 Returns currently selected item.
std::string selectedPath () const
 Returns currently selected item path in the tree.
virtual void clear ()
 Removes all the tree items.
void relayout ()
 Relayouts the tree. May be necessary after you've changed items data a lot.
virtual void resize (int x, int y, int w, int h)
 Resizes the control and inside widgets.
virtual CVariant data () const
 Returns the currently selected item ID (or user_data).
virtual void data (const CVariant v)
 Selects the item with matching ID (or user_data).
virtual void load (CQuery *)
 Data connection isn't implemented yet.
virtual void save (CQuery *)
 Data connection isn't implemented yet.
virtual void load (const CXmlNode *node)
 Loads the the widget from XML node.
virtual void save (CXmlNode *node) const
 Saves the the widget to XML node.
virtual bool valid () const
 Returns tru if data is valid.

Static Public Member Functions

static CLayoutClientcreator (CXmlNode *node)
 Creates a widget based on the XML node information.

Static Protected Member Functions

static void internal_callback (Fl_Widget *, void *)
 Internal tree control callback.


Detailed Description

Tree view widget.

Shows tree items with icons. Can use different icons for opened/closed folders.


Constructor & Destructor Documentation

sptk::CTreeView::CTreeView ( const char *  label = 0,
int  layoutSize = 10,
CLayoutAlign  layoutAlign = SP_ALIGN_TOP 
)

Constructor in SPTK style.

Parameters:
label const char *, label
layoutSize int, widget align in layout
layoutAlign CLayoutAlign, widget align in layout


Member Function Documentation

CTreeItem* sptk::CTreeView::addItem ( std::string  label,
const Fl_Image *  openedImage,
const Fl_Image *  closedImage = 0L,
void *  data = 0L 
) [inline]

Adds a child item to the item. If the closedImage parameter is omitted the openedImage is used instead.

Parameters:
label std::string, the item label
openedImage const Fl_Image *, the image for the opened state
closedImage const Fl_Image *, the image for the closed state
data void *, the user data or ID attached to the item
Returns:
the new child item

References sptk::CTreeItem::addItem().

CTreeItem* sptk::CTreeView::addPath ( const std::vector< std::string > &  path,
const Fl_Image *  itemImage = 0L,
void *  data = 0L 
) [inline]

Adds a child item to the item using the default folder images.

Parameters:
path const CStrings&, the item full path in the tree starting with '/'
itemImage const Fl_Image *, the image for the child item
data void *, the user data or ID attached to the item
Returns:
the new child item

CTreeItem* sptk::CTreeView::addPath ( const std::vector< std::string > &  path,
const Fl_Image *  openedImage,
const Fl_Image *  closedImage,
const Fl_Image *  itemImage = 0L,
void *  data = 0L 
) [inline]

Adds a child item to the item using the path. The required path items are created automatically.

Parameters:
path const CStrings&, the path to the new child item relatively to the item
openedImage const Fl_Image *, the image for the opened folder
closedImage const Fl_Image *, the image for the closed folder
itemImage const Fl_Image *, the image for the child item
data void *, the user data or ID attached to the item
Returns:
the new child item

References sptk::CTreeItem::addPath().

static CLayoutClient* sptk::CTreeView::creator ( CXmlNode node  )  [static]

Creates a widget based on the XML node information.

Parameters:
node CXmlNode*, an XML node with widget information

virtual void sptk::CTreeView::load ( const CXmlNode node  )  [virtual]

Loads the the widget from XML node.

The widget information may include widget attributes and widget data

Parameters:
node CXmlNode*, XML node

virtual void sptk::CTreeView::resize ( int  x,
int  y,
int  w,
int  h 
) [virtual]

Resizes the control and inside widgets.

Parameters:
x int, x-position
y int, y-position
w int, width
h int, height

Reimplemented from sptk::CControl.

virtual void sptk::CTreeView::save ( CXmlNode node  )  const [virtual]

Saves the the widget to XML node.

The widget information may include widget attributes and widget data

Parameters:
node CXmlNode*, XML node


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:20 2012: SPTK 3.5.7