AGW Logo

agw_title TreeListItem

This class holds all the information and methods for every single item in HyperTreeList.

Note

Subclassed from GenericTreeItem.

hierarchy Inheritance Diagram

Inheritance diagram for: TreeListItem

Inheritance diagram of TreeListItem


method_summary Methods Summary

__init__Default class constructor.
DeleteChildrenDeletes the item children.
DeleteWindowDeletes the window associated to the item (if any).
GetCurrentImageReturns the current item image.
GetImageReturns the item image for a particular item state.
GetTextReturns the item text label.
GetTextXReturns the x position of the item text.
GetWindowReturns the window associated to the item.
GetWindowEnabledReturns whether the window associated with an item is enabled or not.
GetWindowSizeReturns the associated window size.
HideHides/shows the TreeListItem.
HitTestHitTest method for an item. Called from the main window HitTest.
IsHiddenReturns whether the item is hidden or not.
OnSetFocusHandles the wx.EVT_SET_FOCUS event for a window associated to an item.
SetImageSets the item image for a particular item state.
SetTextSets the item text label.
SetTextXSets the x position of the item text.
SetWindowSets the window associated to the item.
SetWindowEnabledSets whether the window associated with an item is enabled or not.

API Class API

class TreeListItem(GenericTreeItem)[source]

This class holds all the information and methods for every single item in HyperTreeList.

Note

Subclassed from GenericTreeItem.



__init__(mainWin, parent, text=[], ct_type=0, wnd=None, image=-1, selImage=-1, data=None)[source]

Default class constructor. For internal use: do not call it in your code!

Parameters:
  • mainWin – the main HyperTreeList window, in this case an instance of TreeListMainWindow;
  • parent – the tree item parent (may be None for root items);
  • text – the tree item text;
  • ct_type – the tree item kind. May be one of the following integers:


    ct_type Value Description
    0 A normal item
    1 A checkbox-like item
    2 A radiobutton-type item
  • wnd – if not None, a non-toplevel window to be displayed next to the item;
  • image – an index within the normal image list specifying the image to use for the item in unselected state;
  • selImage – an index within the normal image list specifying the image to use for the item in selected state; if image > -1 and selImage is -1, the same image is used for both selected and unselected items;
  • data – associate the given Python object data with the item.

Note

Regarding radiobutton-type items (with ct_type = 2), the following approach is used:

  • All peer-nodes that are radiobuttons will be mutually exclusive. In other words, only one of a set of radiobuttons that share a common parent can be checked at once. If a radiobutton node becomes checked, then all of its peer radiobuttons must be unchecked.
  • If a radiobutton node becomes unchecked, then all of its child nodes will become inactive.


DeleteChildren(tree)[source]

Deletes the item children.

Parameters:tree – the main TreeListMainWindow instance.


DeleteWindow(column=None)[source]

Deletes the window associated to the item (if any).

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetCurrentImage(column=None)[source]

Returns the current item image.

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetImage(which=wx.TreeItemIcon_Normal, column=None)[source]

Returns the item image for a particular item state.

Parameters:
  • which – can be one of the following bits:


    Item State Description
    TreeItemIcon_Normal To get the normal item image
    TreeItemIcon_Selected To get the selected item image (i.e. the image which is shown when the item is currently selected)
    TreeItemIcon_Expanded To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed)
    TreeItemIcon_SelectedExpanded To get the selected expanded image (which is shown when an expanded item is currently selected)
  • column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetText(column=None)[source]

Returns the item text label.

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetTextX()[source]

Returns the x position of the item text.



GetWindow(column=None)[source]

Returns the window associated to the item.

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetWindowEnabled(column=None)[source]

Returns whether the window associated with an item is enabled or not.

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


GetWindowSize(column=None)[source]

Returns the associated window size.

Parameters:column – if not None, an integer specifying the column index. If it is None, the main column index is used.


Hide(hide)[source]

Hides/shows the TreeListItem.

Parameters:hideTrue to hide the item, False to show it.


HitTest(point, theCtrl, flags, column, level)[source]

HitTest method for an item. Called from the main window HitTest.

Parameters:
  • point – the point to test for the hit (an instance of wx.Point);
  • theCtrl – the main TreeListMainWindow tree;
  • flags – a bitlist of hit locations;
  • column – an integer specifying the column index;
  • level – the item’s level inside the tree hierarchy.

See also

TreeListMainWindow.HitTest() method for the flags explanation.



IsHidden()[source]

Returns whether the item is hidden or not.



OnSetFocus(event)[source]

Handles the wx.EVT_SET_FOCUS event for a window associated to an item.

Parameters:event – a wx.FocusEvent event to be processed.


SetImage(column, image, which)[source]

Sets the item image for a particular item state.

Parameters:
  • column – if not None, an integer specifying the column index. If it is None, the main column index is used;
  • image – an index within the normal image list specifying the image to use;
  • which – the item state.

See also

GetImage for a list of valid item states.



SetText(column, text)[source]

Sets the item text label.

Parameters:
  • column – if not None, an integer specifying the column index. If it is None, the main column index is used;
  • text – a string specifying the new item label.


SetTextX(text_x)[source]

Sets the x position of the item text.

Parameters:text_x – the x position of the item text.


SetWindow(wnd, column=None)[source]

Sets the window associated to the item.

Parameters:
  • wnd – a non-toplevel window to be displayed next to the item;
  • column – if not None, an integer specifying the column index. If it is None, the main column index is used.


SetWindowEnabled(enable=True, column=None)[source]

Sets whether the window associated with an item is enabled or not.

Parameters:
  • enableTrue to enable the associated window, False to disable it;
  • column – if not None, an integer specifying the column index. If it is None, the main column index is used.
Tree

Table Of Contents

Previous topic

TreeListHeaderWindow

Next topic

TreeListMainWindow