This class represents the main window (and thus the main column) in HyperTreeList
.
Note
This is a subclass of CustomTreeCtrl
.
__init__ |
Default class constructor. |
AddRoot |
Adds a root item to the TreeListMainWindow . |
AdjustMyScrollbars |
Internal method used to adjust the ScrolledWindow scrollbars. |
CalculateLevel |
Calculates the level of an item inside the tree hierarchy. |
CalculatePositions |
Recalculates all the items positions. |
CalculateSize |
Calculates overall position and size of an item. |
ChildrenClosing |
We are about to destroy the item’s children. |
Delete |
Deletes an item. |
DeleteAllItems |
Delete all items in the TreeListMainWindow . |
DeleteRoot |
Removes the tree root item (and subsequently all the items in |
DoInsertItem |
Actually inserts an item in the tree. |
EditLabel |
Starts editing an item label. |
EnableItem |
Enables/disables an item. |
GetBestColumnWidth |
Returns the best column’s width based on the items width in this column. |
GetColumnCount |
Returns the total number of columns. |
GetCurrentItem |
Returns the current item. |
GetFirstExpandedItem |
Returns the first item which is in the expanded state. |
GetFirstVisibleItem |
Returns the first visible item. |
GetItemImage |
Returns the item image. |
GetItemText |
Returns the item text label. |
GetItemWidth |
Returns the item width. |
GetItemWindow |
Returns the window associated with an item. |
GetItemWindowEnabled |
Returns whether the window associated with an item is enabled or not. |
GetMainColumn |
Returns the HyperTreeList main column (i.e. the position of the underlying |
GetNextExpanded |
Returns the next expanded item after the input one. |
GetPrevChild |
Returns the previous child of an item. |
GetPrevExpanded |
Returns the previous expanded item before the input one. |
GetPrevVisible |
Returns the previous visible item before the input one. |
HideItem |
Hides/shows an item. |
HideWindows |
Hides the windows associated to the items. Used internally. |
HitTest |
Calculates which (if any) item is under the given point, returning the tree item |
IsItemEnabled |
Returns whether an item is enabled or disabled. |
IsItemVisible |
Returns whether the item is visible or not. |
IsVirtual |
Returns True if TreeListMainWindow has the TR_VIRTUAL flag set. |
OnAcceptEdit |
Called by EditTextCtrl , to accept the changes and to send the |
OnCancelEdit |
Called by EditCtrl , to cancel the changes and to send the |
OnEditTimer |
The timer for editing has expired. Start editing. |
OnEraseBackground |
Handles the wx.EVT_ERASE_BACKGROUND event for TreeListMainWindow . |
OnMouse |
Handles the wx.EVT_MOUSE_EVENTS event for TreeListMainWindow . |
OnPaint |
Handles the wx.EVT_PAINT event for TreeListMainWindow . |
OnScroll |
Handles the wx.EVT_SCROLLWIN event for TreeListMainWindow . |
PaintItem |
Actually draws an item. |
PaintLevel |
Paint a level in the hierarchy of TreeListMainWindow . |
ScrollTo |
Scrolls the specified item into view. |
SetBuffered |
Sets/unsets the double buffering for the main window. |
SetDragItem |
Sets the specified item as member of a current drag and drop operation. |
SetItemImage |
Sets the item image for a particular item state. |
SetItemText |
Sets the item text label. |
SetItemWindow |
Sets the window associated to an item. |
SetItemWindowEnabled |
Sets whether the window associated with an item is enabled or not. |
SetMainColumn |
Sets the HyperTreeList main column (i.e. the position of the underlying |
TreeListMainWindow
(CustomTreeCtrl)¶This class represents the main window (and thus the main column) in HyperTreeList
.
Note
This is a subclass of CustomTreeCtrl
.
__init__
(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=wx.TR_DEFAULT_STYLE, validator=wx.DefaultValidator, name="wxtreelistmainwindow")¶Default class constructor.
Parameters: |
|
---|
AddRoot
(self, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None)¶Adds a root item to the TreeListMainWindow
.
Parameters: |
|
---|
Warning
Only one root is allowed to exist in any given instance of TreeListMainWindow
.
AdjustMyScrollbars
(self)¶Internal method used to adjust the ScrolledWindow
scrollbars.
CalculateLevel
(self, item, dc, level, y, x_colstart)¶Calculates the level of an item inside the tree hierarchy.
Parameters: |
|
---|
CalculatePositions
(self)¶Recalculates all the items positions.
CalculateSize
(self, item, dc)¶Calculates overall position and size of an item.
Parameters: |
|
---|
ChildrenClosing
(self, item)¶We are about to destroy the item’s children.
Parameters: | item – an instance of TreeListItem . |
---|
Delete
(self, item)¶Deletes an item.
Parameters: | item – an instance of TreeListItem . |
---|
DeleteAllItems
(self)¶Delete all items in the TreeListMainWindow
.
DeleteRoot
(self)¶Removes the tree root item (and subsequently all the items in
TreeListMainWindow
.
DoInsertItem
(self, parent, previous, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, separator=False)¶Actually inserts an item in the tree.
Parameters: |
|
---|
EditLabel
(self, item, column=None)¶Starts editing an item label.
Parameters: |
|
---|
EnableItem
(self, item, enable=True, torefresh=True)¶Enables/disables an item.
Parameters: |
|
---|
GetBestColumnWidth
(self, column, parent=None)¶Returns the best column’s width based on the items width in this column.
Parameters: |
|
---|
GetColumnCount
(self)¶Returns the total number of columns.
GetCurrentItem
(self)¶Returns the current item.
GetFirstExpandedItem
(self)¶Returns the first item which is in the expanded state.
GetFirstVisibleItem
(self)¶Returns the first visible item.
GetItemImage
(self, item, column=None, which=wx.TreeItemIcon_Normal)¶Returns the item image.
Parameters: |
|
---|
GetItemText
(self, item, column=None)¶Returns the item text label.
Parameters: |
|
---|
GetItemWidth
(self, item, column)¶Returns the item width.
Parameters: |
|
---|
GetItemWindow
(self, item, column=None)¶Returns the window associated with an item.
Parameters: |
|
---|
GetItemWindowEnabled
(self, item, column=None)¶Returns whether the window associated with an item is enabled or not.
Parameters: |
|
---|
GetMainColumn
(self)¶Returns the HyperTreeList
main column (i.e. the position of the underlying
CustomTreeCtrl
.
GetNextExpanded
(self, item)¶Returns the next expanded item after the input one.
Parameters: | item – an instance of TreeListItem . |
---|
GetPrevChild
(self, item, cookie)¶Returns the previous child of an item.
Parameters: |
|
---|
Note
This method returns None
if there are no further siblings.
GetPrevExpanded
(self, item)¶Returns the previous expanded item before the input one.
Parameters: | item – an instance of TreeListItem . |
---|
GetPrevVisible
(self, item)¶Returns the previous visible item before the input one.
Parameters: | item – an instance of TreeListItem . |
---|
HideItem
(self, item, hide=True)¶Hides/shows an item.
Parameters: |
|
---|
HideWindows
(self)¶Hides the windows associated to the items. Used internally.
HitTest
(self, point, flags=0)¶Calculates which (if any) item is under the given point, returning the tree item at this point plus extra information flags plus the item’s column.
Parameters: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: | the item (if any, |
IsItemEnabled
(self, item)¶Returns whether an item is enabled or disabled.
Parameters: | item – an instance of TreeListItem . |
---|
IsItemVisible
(self, item)¶Returns whether the item is visible or not.
Parameters: | item – an instance of TreeListItem ; |
---|
IsVirtual
(self)¶Returns True
if TreeListMainWindow
has the TR_VIRTUAL
flag set.
OnAcceptEdit
(self, value)¶Called by EditTextCtrl
, to accept the changes and to send the
EVT_TREE_END_LABEL_EDIT
event.
Parameters: | value – the new value of the item label. |
---|
OnCancelEdit
(self)¶Called by EditCtrl
, to cancel the changes and to send the
EVT_TREE_END_LABEL_EDIT
event.
OnEditTimer
(self)¶The timer for editing has expired. Start editing.
OnEraseBackground
(self, event)¶Handles the wx.EVT_ERASE_BACKGROUND
event for TreeListMainWindow
.
Parameters: | event – a EraseEvent event to be processed. |
---|
OnMouse
(self, event)¶Handles the wx.EVT_MOUSE_EVENTS
event for TreeListMainWindow
.
Parameters: | event – a MouseEvent event to be processed. |
---|
OnPaint
(self, event)¶Handles the wx.EVT_PAINT
event for TreeListMainWindow
.
Parameters: | event – a PaintEvent event to be processed. |
---|
OnScroll
(self, event)¶Handles the wx.EVT_SCROLLWIN
event for TreeListMainWindow
.
Parameters: | event – a ScrollEvent event to be processed. |
---|
PaintItem
(self, item, dc)¶Actually draws an item.
Parameters: |
|
---|
PaintLevel
(self, item, dc, level, y, x_maincol)¶Paint a level in the hierarchy of TreeListMainWindow
.
Parameters: |
|
---|
ScrollTo
(self, item)¶Scrolls the specified item into view.
Parameters: | item – an instance of TreeListItem . |
---|
SetBuffered
(self, buffered)¶Sets/unsets the double buffering for the main window.
Parameters: | buffered – True to use double-buffering, False otherwise. |
---|
Note
Currently we are using double-buffering only on Windows XP.
SetDragItem
(self, item)¶Sets the specified item as member of a current drag and drop operation.
Parameters: | item – an instance of TreeListItem . |
---|
SetItemImage
(self, item, image, column=None, which=wx.TreeItemIcon_Normal)¶Sets the item image for a particular item state.
Parameters: |
|
---|
See also
GetItemImage
for a list of valid item states.
SetItemText
(self, item, text, column=None)¶Sets the item text label.
Parameters: |
|
---|
SetItemWindow
(self, item, window, column=None)¶Sets the window associated to an item.
Parameters: |
|
---|
Note
The window parent should not be the HyperTreeList
itself, but actually
an instance of TreeListMainWindow
. The current solution here is to reparent
the window to this class.
SetItemWindowEnabled
(self, item, enable=True, column=None)¶Sets whether the window associated with an item is enabled or not.
Parameters: |
|
---|
SetMainColumn
(self, column)¶Sets the HyperTreeList
main column (i.e. the position of the underlying
CustomTreeCtrl
.
Parameters: | column – if not None , an integer specifying the column index.
If it is None , the main column index is used. |
---|