A raw tree
PtWidget → PtBasic → PtContainer → PtCompound → PtGenList → PtGenTree → PtRawTree
For more information, see the diagram of the widget hierarchy.
<photon/PtRawTree.h>
PtRawTree is a tree that gives you more control than PtTree over the appearance and behavior of its items. You can supply various functions to draw items, react to events, and so on. If these functions aren't given, the widget uses the default functions defined for PtGenTree or PtGenList.
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_RAWTREE_DRAW_F | See below | Pointer | NULL |
Pt_ARG_RAWTREE_INFLATE_F | See below | Pointer | NULL |
Pt_ARG_RAWTREE_SELECT_F | See below | Pointer | NULL |
Pt_ARG_RAWTREE_STATE_F | See below | Pointer | NULL |
C type | Pt type | Default |
---|---|---|
See below | Pointer | NULL |
A function that's called to draw the widget. If this resource is NULL, the default function for PtGenTree is called.
This function is of type PtRawTreeDrawItemF_t, and has this prototype:
void drawitemf( PtWidget_t *widget, PtGenTreeItem_t *item, PhRect_t const *where, int lmargin, int rmargin );
The arguments are:
The PtGenTree List Draw method is responsible for drawing the lines and boxes representing the tree structure. This function should draw only the item.
C type | Pt type | Default |
---|---|---|
See below | Pointer | NULL |
A function that's called when a balloon widget needs to be created. It should create a balloon and return its widget pointer. If this resource is NULL, the default function for PtGenTree is called.
This function is of type PtRawTreeInflateF_t, and has this prototype:
PtWidget_t *inflatef( PtWidget_t *widget, PtWidget_t *parent, PtGenTreeItem_t *item, unsigned index, int column, PhArea_t *area );
The arguments are:
C type | Pt type | Default |
---|---|---|
See below | Pointer | NULL |
A function that's called when an item is selected or unselected. If this resource is NULL, the default function for PtGenTree is called.
This function is of type PtRawTreeSelectF_t, and has this prototype:
void selectf( PtWidget_t *widget, PtGenTreeItem_t *item, int pos, int column, int nitems, int subtype, PhEvent_t *ev );
The arguments are:
C type | Pt type | Default |
---|---|---|
See below | Pointer | NULL |
A function that's called when an item is expanded or collapsed. If this resource is NULL, the default function for PtGenTree is called.
This function is of type PtRawTreeItemStateF_t, and has this prototype:
int statef( PtWidget_t *widget, PtGenTreeItem_t *item, PhEvent_t *event, int reason );
The arguments are:
If reason is Pt_TREE_EXPANDING, the item is about to be expanded. This function can update the item's branches before the actual expansion. After the function returns, the widget displays a list of items in the expanded branch.
If an item in the list has its Pt_TREE_ITEM_EXPANDED flag set, the items below are displayed too. To permit the expansion, return zero; to prevent it, return a nonzero value.
If reason is Pt_TREE_COLLAPSING, the item has been collapsed. Its branches are concealed and this function can free the associated items.
If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.
In addition to the flags defined by PtGenTree, the following flags are defined:
By default, neither is set. The width and location of the balloon depend on these flags:
For Pt_CB_DND callbacks for a PtRawTree, the cbinfo->cbdata is a pointer to a PtTreeDndCallback_t structure, containing at least the following members:
You can use any of the convenience functions defined for PtGenTree when working with a PtRawTree.