sptk2 logo
SPTK Home Page

sptk::CTreeControl Class Reference
[GUI Classes]

Tree widget. More...

#include <CTreeControl.h>

Inheritance diagram for sptk::CTreeControl:

sptk::CScroll sptk::CLayoutManager sptk::CLayoutClient

List of all members.

Public Member Functions

 CTreeControl (const char *label, int layoutSize=50, CLayoutAlign align=SP_ALIGN_TOP)
CTreeItemaddItem (const char *label, const Fl_Image *openedImage=0L, const Fl_Image *closedImage=0L, void *data=0L)
CTreeItemaddPath (const std::vector< std::string > &path, const Fl_Image *openedImage, const Fl_Image *closedImage, const Fl_Image *itemImage=0L, void *data=0L)
CTreeItemaddPath (const std::vector< std::string > &path, const Fl_Image *itemImage=0L, void *data=0L)
CTreeItemfindItem (const char *item) const
 Finds an item by the item label in the whole tree.
CTreeItemfindData (const void *data) const
 Finds an item by the item user data in the whole tree.
virtual void clear ()
 Removes all the items in the tree.
void moveItem (CTreeItem *item, CTreeItem *beforeItem=0L)
 Moves the item in the tree.
void removeItem (CTreeItem *item)
 Removes all the item and underlying structure from the tree.
CTreeItemroot () const
 Reports the root item.
CTreeItemselected () const
 Reports the currently selected item.
void selectOnly (CTreeItem *item, bool giveFocus=false)
 Selects only one item.
void makeVisible (CTreeItem *item)
 Makes the item visible if it's outside the visible area.
int handle (int event)
 Special handle() function.
void itemCreator (CTreeItemCreator ic)
 The tree item creator creates a tree item' body,.
virtual void load (const CXmlNode &node, bool autoCreate=false) throw (CException)
 Loads group controls data from XML node.
virtual void load (const CXmlNode *node, bool autoCreate=false) throw (CException)
 Loads group controls data from XML node.
virtual void save (CXmlNode &node) const
 Saves group controls data into XML node.
virtual void save (CXmlNode *node) const
 Saves group controls data into XML node.
virtual std::string className () const
 Returns widget class name (internal SPTK RTTI).

Static Protected Member Functions

static CLayoutClientdefaultItemCreator (CTreeItem *item)
 The default tree item creator.

Protected Attributes

bool m_tabPressed
 Internal flag to temporarely block tree items focus acceptance.
CTreeItemCreator m_itemCreator
 The tree item creator creates a tree item' body,.

Friends

class CTreeItem


Detailed Description

Tree widget.

Designed to be used inside CTreeView widget, but also can be used by itself. It's missing for data connection support of CTreeView, though.


Constructor & Destructor Documentation

sptk::CTreeControl::CTreeControl ( const char *  label,
int  layoutSize = 50,
CLayoutAlign  align = SP_ALIGN_TOP 
)

The constructor.

Parameters:
label const char *, the widget's label
layoutSize int, size of widget in layout. See CLayoutClient for details
align CLayoutAlign, widget align in the layout


Member Function Documentation

CTreeItem* sptk::CTreeControl::addItem ( const char *  label,
const Fl_Image *  openedImage = 0L,
const Fl_Image *  closedImage = 0L,
void *  data = 0L 
)

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

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

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

Adds a child item to the root item using the path. The required path items are created automatically. Path elements are separated with '/'. The default images are used for the folders in the path.

Parameters:
path const std::vector<std::string>&, the path to the new child item
itemImage 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::CTreeControl::addPath ( 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 root item using the path. The required path items are created automatically. Path elements are separated with '/'. The default images are used for the folders in the path.

Parameters:
path const std::vector<std::string>&, the path to the new child item
openedImage Fl_Image, the image for the folders in opened state
closedImage Fl_Image, the image for the folders in closed state
itemImage Fl_Image, the image for the child item
data void *, the user data or ID attached to the item
Returns:
the new child item

static CLayoutClient* sptk::CTreeControl::defaultItemCreator ( CTreeItem item  )  [static, protected]

The default tree item creator.

Creates a tree item' body as CBox,

See also:
CTreeItemCreator

CTreeItem* sptk::CTreeControl::findData ( const void *  data  )  const

Finds an item by the item user data in the whole tree.

Parameters:
data void *, user data to find
Returns:
the child item (if found) or NULL

CTreeItem* sptk::CTreeControl::findItem ( const char *  item  )  const

Finds an item by the item label in the whole tree.

Parameters:
item const char *, item label to find
Returns:
the child item (if found) or NULL

int sptk::CTreeControl::handle ( int  event  ) 

Special handle() function.

Parameters:
event int, an FLTK event
Returns:
true, if event was processed

Reimplemented from sptk::CScroll.

void sptk::CTreeControl::itemCreator ( CTreeItemCreator  ic  )  [inline]

The tree item creator creates a tree item' body,.

See also:
CTreeItemCreator

References m_itemCreator.

virtual void sptk::CTreeControl::load ( const CXmlNode node,
bool  autoCreate = false 
) throw (CException) [inline, virtual]

Loads group controls data from XML node.

Parameters:
node const CXmlNode*, node to load data from
autoCreate bool, create widgets if they are not found

References load().

virtual void sptk::CTreeControl::load ( const CXmlNode node,
bool  autoCreate = false 
) throw (CException) [virtual]

Loads group controls data from XML node.

Parameters:
node const CXmlNode&, node to load data from
autoCreate bool, create widgets if they are not found

Referenced by load().

void sptk::CTreeControl::makeVisible ( CTreeItem item  ) 

Makes the item visible if it's outside the visible area.

Parameters:
item CTreeItem, item to make visible

void sptk::CTreeControl::moveItem ( CTreeItem item,
CTreeItem beforeItem = 0L 
)

Moves the item in the tree.

Parameters:
item CTreeItem *, item to insert
beforeItem CTreeItem *, item before the insert point. If 0L - it's moved to the very last position in parent item list of items.

void sptk::CTreeControl::removeItem ( CTreeItem item  ) 

Removes all the item and underlying structure from the tree.

Parameters:
item CTreeItem *, item to remove

virtual void sptk::CTreeControl::save ( CXmlNode node  )  const [inline, virtual]

Saves group controls data into XML node.

Parameters:
node const CXmlNode*, node to save data into

References save().

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

Saves group controls data into XML node.

Parameters:
node const CXmlNode&, node to save data into

Referenced by save().

void sptk::CTreeControl::selectOnly ( CTreeItem item,
bool  giveFocus = false 
)

Selects only one item.

Parameters:
item CTreeItem, item to select
giveFocus bool, should the item be focused?


Member Data Documentation

CTreeItemCreator sptk::CTreeControl::m_itemCreator [protected]

The tree item creator creates a tree item' body,.

See also:
CTreeItemCreator

Referenced by itemCreator().


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

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