CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csTreeItem Class Reference
[Tree box]

This class encapsulates a tree item. More...

#include <cstree.h>

Inheritance diagram for csTreeItem:

csComponent List of all members.

Public Methods

 csTreeItem (csComponent *iParent, const char *iText, int iID=0, csTreeItemStyle iStyle=cstisNormal)
 Tree item constructor: text item with optional style. More...

virtual ~csTreeItem ()
 Tree item destructor. More...

virtual bool HandleEvent (iEvent &Event)
 Handle input events. More...

virtual void Draw ()
 Draw the tree item. More...

virtual void SetState (int mask, bool enable)
 Handle additional state flags. More...

virtual bool SetFocused (csComponent *comp)
 Invalidate ourselves when the focus goes to one of our children. More...

virtual void Insert (csComponent *comp)
 Tell parent to re-position items. More...

virtual void Delete (csComponent *comp)
 Tell parent to re-position items. More...

virtual void SuggestSize (int &w, int &h)
 Report the minimal size of tree item. More...

void SuggestTotalSize (int &w, int &h, int &totw, int &toth)
 Report the minimal size of tree item and total size with children. More...

void SetBitmap (csPixmap *iBitmap, csPixmap *iBitmapOpen=0, bool iDelete=true)
 Set tree item image (possibly for open state too). More...

void SetChildOffset (int ihOffset)
 Set horizontal offset of child items. More...

int Toggle (int iAction=2)
 Toggle the open state of the branch: 0: collapse, 1: expand, other: toggle. More...

csTreeItem * ForEachItem (bool(*func)(csTreeItem *child, void *param), void *param=0, bool iOnlyOpen=false)
 For each subtree item call a function with a optional arg Function returns the first child on which func returnes 'true' Optionally you can pass an "only for opened branches" flag, so that only visible branches will be handled. More...

void ResetButton ()
 Force a reset of button size & position. More...


Friends

class csTreeBox

Detailed Description

This class encapsulates a tree item.

The tree item always contains an "expand/collapse" button, optionally contains two pixmaps (shown depending on the expanded state), and a text string. The button is displayed only if tree has child items. Also the tree item can contain any number of child (subordinate) tree items. Note that the tree item can contain ONLY other csTreeItem's and their derivates; the only exception is the button component which is handled specialy. Inserting something other than a csTreeItem into another csTreeItem will crash, since csTreeItem often does unconditional typecasts to csTreeItem.

Definition at line 247 of file cstree.h.


Constructor & Destructor Documentation

csTreeItem::csTreeItem csComponent   iParent,
const char *    iText,
int    iID = 0,
csTreeItemStyle    iStyle = cstisNormal
 

Tree item constructor: text item with optional style.

virtual csTreeItem::~csTreeItem   [virtual]
 

Tree item destructor.


Member Function Documentation

virtual void csTreeItem::Delete csComponent   comp [virtual]
 

Tell parent to re-position items.

Reimplemented from csComponent.

virtual void csTreeItem::Draw   [virtual]
 

Draw the tree item.

Reimplemented from csComponent.

csTreeItem* csTreeItem::ForEachItem bool(*    func)(csTreeItem *child, void *param),
void *    param = 0,
bool    iOnlyOpen = false
 

For each subtree item call a function with a optional arg Function returns the first child on which func returnes 'true' Optionally you can pass an "only for opened branches" flag, so that only visible branches will be handled.

virtual bool csTreeItem::HandleEvent iEvent   Event [virtual]
 

Handle input events.

Reimplemented from csComponent.

virtual void csTreeItem::Insert csComponent   comp [virtual]
 

Tell parent to re-position items.

Reimplemented from csComponent.

void csTreeItem::ResetButton   [inline]
 

Force a reset of button size & position.

Definition at line 324 of file cstree.h.

References cscmdTreeItemSizeChangeNotify, csComponent::parent, csComponent::SendCommand, and csComponent::SetRect.

void csTreeItem::SetBitmap csPixmap   iBitmap,
csPixmap   iBitmapOpen = 0,
bool    iDelete = true
 

Set tree item image (possibly for open state too).

void csTreeItem::SetChildOffset int    ihOffset [inline]
 

Set horizontal offset of child items.

Definition at line 308 of file cstree.h.

virtual bool csTreeItem::SetFocused csComponent   comp [virtual]
 

Invalidate ourselves when the focus goes to one of our children.

Reimplemented from csComponent.

virtual void csTreeItem::SetState int    mask,
bool    enable
[virtual]
 

Handle additional state flags.

Reimplemented from csComponent.

virtual void csTreeItem::SuggestSize int &    w,
int &    h
[virtual]
 

Report the minimal size of tree item.

Reimplemented from csComponent.

void csTreeItem::SuggestTotalSize int &    w,
int &    h,
int &    totw,
int &    toth
 

Report the minimal size of tree item and total size with children.

int csTreeItem::Toggle int    iAction = 2
 

Toggle the open state of the branch: 0: collapse, 1: expand, other: toggle.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14