标签:exclusive iat pass already dba effect nim sig pop
转自 http://xoomer.virgilio.it/infinity77/Phoenix/lib.agw.customtreectrl.CustomTreeCtrl.html这个网址中有许多控件的讲解
CustomTreeCtrl is a class that mimics the behaviour of TreeCtrl, with almost the same base functionalities plus some more enhancements. This class does not rely on the native control, as it is a full owner-drawn tree control.
Inheritance diagram for class CustomTreeCtrl
PyScrolledWindow
__init__ | Default class constructor. |
AcceptsFocus | Can this window be given focus by mouse click? |
AddRoot | Adds a root item to the CustomTreeCtrl. |
AdjustMyScrollbars | Internal method used to adjust the PyScrolledWindow scrollbars. |
AppendItem | Appends an item as a last child of its parent. |
AppendSeparator | Appends an horizontal line separator as a last child of its parent. |
AssignButtonsImageList | Assigns the button image list. |
AssignImageList | Assigns the normal image list. |
AssignLeftImageList | Assigns the image list for CustomTreeCtrl filled with images to be used on |
AssignStateImageList | Assigns the state image list. |
AutoCheckChild | Transverses the tree and checks/unchecks the items. |
AutoCheckParent | Traverses up the tree and checks/unchecks parent items. |
AutoToggleChild | Transverses the tree and toggles the items. |
CalculateLevel | Calculates the level of an item inside the tree hierarchy. |
CalculateLineHeight | Calculates the height of a line. |
CalculatePositions | Calculates all the positions of the visible items. |
CalculateSize | Calculates overall position and size of an item. |
CheckChilds | Programatically check/uncheck item children. |
CheckItem | Actually checks/uncheks an item, sending (eventually) the two |
CheckItem2 | Used internally to avoid EVT_TREE_ITEM_CHECKED events. |
CheckSameLevel | Uncheck radio items which are on the same level of the checked one. |
ChildrenClosing | We are about to destroy the item children. |
Collapse | Collapse an item, sending a EVT_TREE_ITEM_COLLAPSING and |
CollapseAndReset | Collapse the given item and deletes its children. |
Delete | Deletes an item. |
DeleteAllItems | Deletes all items in the CustomTreeCtrl. |
DeleteChildren | Delete all the item’s children. |
DeleteItemWindow | Deletes the window associated to an item (if any). |
DoGetBestSize | Gets the size which best suits the window: for a control, it would be the |
DoInsertItem | Actually inserts an item in the tree. |
DoSelectItem | Actually selects/unselects an item, sending EVT_TREE_SEL_CHANGING and |
DrawHorizontalGradient | Gradient fill from colour 1 to colour 2 from left to right. |
DrawVerticalGradient | Gradient fill from colour 1 to colour 2 from top to bottom. |
DrawVistaRectangle | Draws the selected item(s) with the Windows Vista style. |
Edit | Internal function. Starts the editing of an item label, sending a |
EditLabel | Starts editing an item label. |
EnableChildren | Enables/disables the item children. |
EnableItem | Enables/disables an item. |
EnableSelectionGradient | Globally enables/disables drawing of gradient selections. |
EnableSelectionVista | Globally enables/disables drawing of Windows Vista selections. |
EnsureVisible | Scrolls and/or expands items to ensure that the given item is visible. |
Expand | Expands an item, sending a EVT_TREE_ITEM_EXPANDING and |
ExpandAll | Expands all CustomTreeCtrl items. |
ExpandAllChildren | Expands all the items children of the input item. |
FillArray | Internal function. Used to populate an array of selected items when |
FindItem | Finds the first item starting with the given prefix after the given parent. |
Freeze | Freeze CustomTreeCtrl. |
GetAGWWindowStyleFlag | Returns the CustomTreeCtrl style. |
GetBackgroundImage | Returns the CustomTreeCtrl background image (if any). |
GetBorderPen | Returns the pen used to draw the selected item border. |
GetBoundingRect | Retrieves the rectangle bounding the item. |
GetButtonsImageList | Returns the buttons image list associated with CustomTreeCtrl (from |
GetChildrenCount | Returns the item children count. |
GetClassDefaultAttributes | Returns the default font and colours which are used by the control. This is |
GetConnectionPen | Returns the pen used to draw the connecting lines between items. |
GetControlBmp | Returns a native looking checkbox or radio button bitmap. |
GetCount | Returns the global number of items in the tree. |
GetDisabledColour | Returns the colour for items in a disabled state. |
GetEditControl | Returns a pointer to the edit TreeTextCtrl if the item is being edited or |
GetFirstChild | Returns the item’s first child and an integer value ‘cookie’. |
GetFirstGradientColour | Returns the first gradient colour for gradient-style selections. |
GetFirstVisibleItem | Returns the first visible item. |
GetGradientStyle | Returns the gradient style for gradient-style selections. |
GetHilightFocusColour | Returns the colour used to highlight focused selected items. |
GetHilightNonFocusColour | Returns the colour used to highlight unfocused selected items. |
GetHyperTextFont | Returns the font used to render hypertext items. |
GetHyperTextNewColour | Returns the colour used to render a non-visited hypertext item. |
GetHyperTextVisitedColour | Returns the colour used to render a visited hypertext item. |
GetImageList | Returns the normal image list associated with CustomTreeCtrl. |
GetImageListCheck | Returns the image list used to build the check/radio buttons in CustomTreeCtrl. |
GetIndent | Returns the item indentation, in pixels. |
GetItem3StateValue | Gets the state of a 3-state checkbox item. |
GetItemBackgroundColour | Returns the item background colour. |
GetItemFont | Returns the item font. |
GetItemImage | Returns the item image. |
GetItemLeftImage | Returns the item leftmost image, i.e. the image associated to the item on the leftmost |
GetItemParent | Returns the item parent (can be None for root items). |
GetItemSize | Returns the horizontal space available in CustomTreeCtrl, in pixels, to draw this item. |
GetItemText | Returns the item text. |
GetItemTextColour | Returns the item text colour or separator horizontal line colour. |
GetItemType | Returns the item type. |
GetItemVisited | Returns whether an hypertext item was visited. |
GetItemWindow | Returns the window associated to the item (if any). |
GetItemWindowEnabled | Returns whether the window associated to the item is enabled. |
GetLastChild | Returns the item last child. |
GetLeftImageList | Returns the image list for CustomTreeCtrl filled with images to be used on |
GetLineHeight | Returns the line height for the given item. |
GetMaxWidth | Returns the maximum width of the CustomTreeCtrl. |
GetNext | Returns the next item. Only for internal use right now. |
GetNextActiveItem | Returns the next active item. Used Internally at present. |
GetNextChild | Returns the item’s next child. |
GetNextExpanded | Returns the next expanded item after the input one. |
GetNextSibling | Returns the next sibling of an item. |
GetNextVisible | Returns the next visible item. |
GetPrev | Returns the previous item. Only for internal use right now. |
GetPrevExpanded | Returns the previous expanded item before the input one. |
GetPrevSibling | Returns the previous sibling of an item. |
GetPrevVisible | Returns the previous visible item. |
GetPyData | Returns the data associated to an item. |
GetRootItem | Returns the root item, an instance of GenericTreeItem. |
GetSecondGradientColour | Returns the second gradient colour for gradient-style selections. |
GetSelection | Returns the current selection. |
GetSelections | Returns a list of selected items. |
GetSeparatorColour | Returns the pen colour for separator-type items. |
GetSpacing | Returns the spacing between the start and the text, in pixels. |
GetStateImageList | Returns the state image list associated with CustomTreeCtrl (from which |
HandleHyperLink | Handles the hyperlink items, sending the EVT_TREE_ITEM_HYPERLINK event. |
HasAGWFlag | Returns True if CustomTreeCtrl has the flag bit set. |
HasButtons | Returns whether CustomTreeCtrl has the TR_HAS_BUTTONS flag set. |
HasChildren | Returns whether an item has children or not. |
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 |
InsertItem | Inserts an item after the given previous. |
InsertItemByIndex | Inserts an item after the given previous. |
InsertItemByItem | Inserts an item after the given previous. |
InsertSeparator | Inserts a separator item after the given previous. |
IsBold | Returns whether the item font is bold or not. |
IsDescendantOf | Checks if the given item is under another one in the tree hierarchy. |
IsExpanded | Returns whether the item is expanded or not. |
IsItalic | Returns whether the item font is italic or not. |
IsItem3State | Returns whether or not the checkbox item is a 3-state checkbox. |
IsItemChecked | Returns whether an item is checked or not. |
IsItemEnabled | Returns whether an item is enabled or disabled. |
IsItemHyperText | Returns whether an item is hypertext or not. |
IsItemSeparator | Returns whether an item is of separator type or not. |
IsSelected | Returns whether the item is selected or not. |
IsVisible | Returns whether the item is visible or not (i.e., its hierarchy is expanded |
ItemHasChildren | Returns whether the item has children or not. |
OnAcceptEdit | Called by TreeTextCtrl, to accept the changes and to send the |
OnCancelEdit | Called by TreeTextCtrl, to cancel the changes and to send the |
OnCompareItems | Returns whether 2 items have the same text. |
OnDestroy | Handles the EVT_WINDOW_DESTROY event for CustomTreeCtrl. |
OnEditTimer | The timer for editing has expired. Start editing. |
OnEraseBackground | Handles the EVT_ERASE_BACKGROUND event for CustomTreeCtrl. |
OnGetToolTip | Process the tooltip event, to speed up event processing. Does not actually |
OnInternalIdle | This method is normally only used internally, but sometimes an application |
OnKeyDown | Handles the EVT_KEY_DOWN event for CustomTreeCtrl, sending a |
OnKillFocus | Handles the EVT_KILL_FOCUS event for CustomTreeCtrl. |
OnMouse | Handles a bunch of EVT_MOUSE_EVENTS events for CustomTreeCtrl. |
OnPaint | Handles the EVT_PAINT event for CustomTreeCtrl. |
OnSetFocus | Handles the EVT_SET_FOCUS event for CustomTreeCtrl. |
OnSize | Handles the EVT_SIZE event for CustomTreeCtrl. |
PaintItem | Actually draws an item. |
PaintLevel | Paint a level in the hierarchy of CustomTreeCtrl. |
PrependItem | Prepends an item as a first child of parent. |
PrependSeparator | Prepends a separator item as a first child of parent. |
RecurseOnChildren | Recurses over all the children of the spcified items, calculating their |
RefreshItemWithWindows | Refreshes the items with which a window is associated. |
RefreshLine | Refreshes a damaged item line. |
RefreshSelected | Refreshes a damaged selected item line. |
RefreshSelectedUnder | Refreshes the selected items under the given item. |
RefreshSubtree | Refreshes a damaged subtree of an item. |
ResetEditControl | Called by TreeTextCtrl when it marks itself for deletion. |
ScrollTo | Scrolls the specified item into view. |
SelectAll | Selects all the item in the tree. |
SelectAllChildren | Selects all the children of the given item. |
SelectItem | Selects/deselects an item. |
SelectItemRange | Selects all the items between item1 and item2. |
SendDeleteEvent | Actually sends the EVT_TREE_DELETE_ITEM event. |
SetAGWWindowStyleFlag | Sets the CustomTreeCtrl window style. |
SetBackgroundColour | Changes the background colour of CustomTreeCtrl. |
SetBackgroundImage | Sets the CustomTreeCtrl background image. |
SetBorderPen | Sets the pen used to draw the selected item border. |
SetButtonsImageList | Sets the buttons image list for CustomTreeCtrl (from which application-defined |
SetConnectionPen | Sets the pen used to draw the connecting lines between items. |
SetDisabledColour | Sets the colour for items in a disabled state. |
SetFirstGradientColour | Sets the first gradient colour for gradient-style selections. |
SetFont | Sets the CustomTreeCtrl font. |
SetForegroundColour | Changes the foreground colour of CustomTreeCtrl. |
SetGradientStyle | Sets the gradient style for gradient-style selections. |
SetHilightFocusColour | Sets the colour used to highlight focused selected items. |
SetHilightNonFocusColour | Sets the colour used to highlight unfocused selected items. |
SetHyperTextFont | Sets the font used to render hypertext items. |
SetHyperTextNewColour | Sets the colour used to render a non-visited hypertext item. |
SetHyperTextVisitedColour | Sets the colour used to render a visited hypertext item. |
SetImageList | Sets the normal image list for CustomTreeCtrl. |
SetImageListCheck | Sets the checkbox/radiobutton image list. |
SetIndent | Sets the indentation for CustomTreeCtrl. |
SetItem3State | Sets whether the item has a 3-state value checkbox assigned to it or not. |
SetItem3StateValue | Sets the checkbox item to the given state. |
SetItemBackgroundColour | Sets the item background colour. |
SetItemBold | Sets the item font as bold/unbold. |
SetItemDropHighlight | Gives the item the visual feedback for drag and drop operations. |
SetItemFont | Sets the item font. |
SetItemHasChildren | Forces the appearance/disappearance of the button next to the item. |
SetItemHyperText | Sets whether the item is hypertext or not. |
SetItemImage | Sets the item image, depending on the item state. |
SetItemItalic | Sets the item font as italic/non-italic. |
SetItemLeftImage | Sets the item leftmost image, i.e. the image associated to the item on the leftmost |
SetItemText | Sets the item text. |
SetItemTextColour | Sets the item text colour or separator horizontal line colour. |
SetItemType | Sets the item type. |
SetItemVisited | Sets whether an hypertext item was visited. |
SetItemWindow | Sets the window for the given item. |
SetItemWindowEnabled | Enables/disables the window associated to the item. |
SetLeftImageList | Sets the image list for CustomTreeCtrl filled with images to be used on |
SetPyData | Sets the data associated to an item. |
SetSecondGradientColour | Sets the second gradient colour for gradient-style selections. |
SetSeparatorColour | Sets the pen colour for separator-type items. |
SetSpacing | Sets the spacing between items in CustomTreeCtrl. |
SetStateImageList | Sets the state image list for CustomTreeCtrl (from which application-defined |
ShouldInheritColours | Return True from here to allow the colours of this window to be |
SortChildren | Sorts the children of the given item using the OnCompareItems method of |
TagAllChildrenUntilLast | Used internally. |
TagNextChildren | Used internally. |
Thaw | Thaw CustomTreeCtrl. |
TileBackground | Tiles the background image to fill all the available area. |
Toggle | Toggles the item state (collapsed/expanded). |
ToggleItemSelection | Toggles the item selection. |
UnCheckRadioParent | Used internally to handle radio node parent correctly. |
Unselect | Unselects the current selection. |
UnselectAll | Unselect all the items. |
UnselectAllChildren | Unselects all the children of the given item. |
CustomTreeCtrl is a class that mimics the behaviour of TreeCtrl, with almost the same base functionalities plus some more enhancements. This class does not rely on the native control, as it is a full owner-drawn tree control.
Default class constructor.
Parameters: |
|
---|
Can this window be given focus by mouse click?
Note
This method always returns True as we always accept focus from mouse click.
Note
Overridden from PyScrolledWindow.
Adds a root item to the CustomTreeCtrl.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception in the following cases:
|
Warning
Only one root is allowed to exist in any given instance of CustomTreeCtrl.
Internal method used to adjust the PyScrolledWindow scrollbars.
Appends an item as a last child of its parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Appends an horizontal line separator as a last child of its parent.
Parameters: | parentId – an instance of GenericTreeItem representing the separator’s parent. |
---|---|
Returns: | An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Assigns the button image list.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the normal image list.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the state image list.
Parameters: | imageList – an instance of ImageList. |
---|
Transverses the tree and checks/unchecks the items.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Traverses up the tree and checks/unchecks parent items.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Transverses the tree and toggles the items.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Calculates the level of an item inside the tree hierarchy.
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns: |
The new y vertical position inside the PyScrolledWindow. |
Calculates the height of a line.
Calculates all the positions of the visible items.
Calculates overall position and size of an item.
Parameters: |
|
---|
Programatically check/uncheck item children.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Note
This method does not generate EVT_TREE_ITEM_CHECKING and EVT_TREE_ITEM_CHECKED events.
Actually checks/uncheks an item, sending (eventually) the two events EVT_TREE_ITEM_CHECKING and EVT_TREE_ITEM_CHECKED.
Parameters: |
|
---|
Used internally to avoid EVT_TREE_ITEM_CHECKED events.
Parameters: |
|
---|
Uncheck radio items which are on the same level of the checked one. Used internally.
Parameters: |
|
---|
Note
This method is meaningful only for radiobutton-like items.
We are about to destroy the item children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Collapse an item, sending a EVT_TREE_ITEM_COLLAPSING and EVT_TREE_ITEM_COLLAPSED events.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if you try to collapse a hidden root (i.e., when the TR_HIDE_ROOT style is set for CustomTreeCtrl). |
Collapse the given item and deletes its children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Deletes an item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method sends the EVT_TREE_DELETE_ITEM event.
Deletes all items in the CustomTreeCtrl.
Delete all the item’s children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Deletes the window associated to an item (if any).
Parameters: | item – an instance of GenericTreeItem. |
---|
Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call toFit().
Returns: | An instance of Size. |
---|
Note
Overridden from PyScrolledWindow.
Actually inserts an item in the tree.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception in the following cases:
|
Note
Separator items should not have children, text labels or an associated window.
Actually selects/unselects an item, sending EVT_TREE_SEL_CHANGING and EVT_TREE_SEL_CHANGED events.
Parameters: |
|
---|
Gradient fill from colour 1 to colour 2 from left to right.
Parameters: |
|
---|
Gradient fill from colour 1 to colour 2 from top to bottom.
Parameters: |
|
---|
Draws the selected item(s) with the Windows Vista style.
Parameters: |
|
---|
Internal function. Starts the editing of an item label, sending a EVT_TREE_BEGIN_LABEL_EDIT event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Warning
Separator-type items can not be edited.
Starts editing an item label.
Parameters: | item – an instance of GenericTreeItem. |
---|
Enables/disables the item children.
Parameters: |
|
---|
Note
This method is used internally.
Enables/disables an item.
Parameters: |
|
---|
Globally enables/disables drawing of gradient selections.
Parameters: | enable (bool) – True to enable gradient-style selections, False to disable it. |
---|
Note
Calling this method disables any Vista-style selection previously enabled.
Globally enables/disables drawing of Windows Vista selections.
Parameters: | enable (bool) – True to enable Vista-style selections, False to disable it. |
---|
Note
Calling this method disables any gradient-style selection previously enabled.
Scrolls and/or expands items to ensure that the given item is visible.
Parameters: | item – an instance of GenericTreeItem. |
---|
Expands an item, sending a EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if you try to expand a hidden root (i.e., when the TR_HIDE_ROOT style is set for CustomTreeCtrl). |
Expands all CustomTreeCtrl items.
Note
This method suppresses the EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events because expanding many items int the control would be too slow then.
Expands all the items children of the input item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method suppresses the EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events because expanding many items int the control would be too slow then.
Internal function. Used to populate an array of selected items when the style TR_MULTIPLE is used.
Parameters: |
|
---|---|
Returns: |
A Python list containing the selected items. |
Finds the first item starting with the given prefix after the given parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem or None if no item has been found. |
Freeze CustomTreeCtrl.
Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all. Thaw must be called to reenable window redrawing. Calls to these two functions may be nested.
Note
This method is useful for visual appearance optimization (for example, it is a good idea to use it before doing many large text insertions in a row into a TextCtrl under wxGTK) but is not implemented on all platforms nor for all controls so it is mostly just a hint to wxWidgets and not a mandatory directive.
Returns the CustomTreeCtrl style.
See also
The __init__ method for a list of possible style flags.
Returns the CustomTreeCtrl background image (if any).
Returns: | An instance of Bitmap if a background image is present, None otherwise. |
---|
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
Returns the pen used to draw the selected item border.
Returns: | An instance of Pen. |
---|
Note
The border pen is not used if the Windows Vista selection style is applied.
Retrieves the rectangle bounding the item.
Parameters: |
|
---|---|
Returns: |
An instance of Rect. |
Note
The rectangle coordinates are logical, not physical ones. So, for example, the x coordinate may be negative if the tree has a horizontal scrollbar and its position is not 0.
Returns the buttons image list associated with CustomTreeCtrl (from which application-defined button images are taken).
Returns: | An instance of ImageList. |
---|
Returns the item children count.
Parameters: |
|
---|
Returns the default font and colours which are used by the control. This is useful if you want to use the same font or colour in your own control as in a standard control – which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the users system, especially if it uses themes.
This static method is “overridden’’ in many derived classes and so calling, for example, Button.GetClassDefaultAttributes () will typically return the values appropriate for a button which will be normally different from those returned by, say, ListCtrl.GetClassDefaultAttributes ().
Returns: | An instance of VisualAttributes. |
---|
Note
The VisualAttributes structure has at least the fields font, colFg and colBg. All of them may be invalid if it was not possible to determine the default control appearance or, especially for the background colour, if the field doesn’t make sense as is the case for colBg for the controls with themed background.
Note
Overridden from PyControl.
Returns the pen used to draw the connecting lines between items.
Returns: | An instance of Pen. |
---|
Returns a native looking checkbox or radio button bitmap.
Parameters: |
|
---|---|
Returns: |
An instance of Bitmap, representing a native looking checkbox or radiobutton. |
Returns the global number of items in the tree.
Returns the colour for items in a disabled state.
Returns: | An instance of Colour. |
---|
Returns a pointer to the edit TreeTextCtrl if the item is being edited or None otherwise (it is assumed that no more than one item may be edited simultaneously).
Returns the item’s first child and an integer value ‘cookie’. Call GetNextChild for the next child using this very ‘cookie’ return value as an input.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | A tuple with the first value being an instance of GenericTreeItem or None if there are no further children, and as second value an integer parameter ‘cookie’. |
Note
This method returns None if there are no further children.
Returns the first gradient colour for gradient-style selections.
Returns: | An instance of Colour. |
---|
Returns the first visible item.
Returns: | An instance of GenericTreeItem or None if there are no visible items. |
---|
Returns the gradient style for gradient-style selections.
Returns: | 0 for horizontal gradient-style selections, 1 for vertical gradient-style selections. |
---|
Returns the colour used to highlight focused selected items.
Returns: | An instance of Colour. |
---|
Note
This is used only if gradient and Windows Vista selection styles are disabled.
Returns the colour used to highlight unfocused selected items.
Returns: | An instance of Colour. |
---|
Note
This is used only if gradient and Windows Vista selection styles are disabled.
Returns the font used to render hypertext items.
Returns: | An instance of Font. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the colour used to render a non-visited hypertext item.
Returns: | An instance of Colour. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the colour used to render a visited hypertext item.
Returns: | An instance of Colour. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the normal image list associated with CustomTreeCtrl.
Returns: | An instance of ImageList. |
---|
Returns the image list used to build the check/radio buttons in CustomTreeCtrl.
Returns: | An instance of ImageList. |
---|
Returns the item indentation, in pixels.
Gets the state of a 3-state checkbox item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | CHK_UNCHECKED when the checkbox is unchecked, CHK_CHECKED when it is checked and CHK_UNDETERMINED when it’s in the undetermined state. |
Note
This method raises an exception when the function is used with a 2-state checkbox item.
Note
This method is meaningful only for checkbox-like items.
Returns the item background colour.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Colour. |
Returns the item font.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Font. |
Returns the item image.
Parameters: |
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
An integer index that can be used to retrieve the item image inside a ImageList. |
Returns the item leftmost image, i.e. the image associated to the item on the leftmost part of the CustomTreeCtrl client area.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An integer index that can be used to retrieve the item leftmost image inside a ImageList. |
Returns the item parent (can be None for root items).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None for root items. |
Returns the horizontal space available in CustomTreeCtrl, in pixels, to draw this item.
Parameters: | item – an instance of GenericTreeItem. |
---|
New in version 0.9.3.
Returns the item text.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns the item text colour or separator horizontal line colour.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Colour. |
Returns the item type.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An integer representing the item type. |
See also
SetItemType for a description of valid item types.
Returns whether an hypertext item was visited.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the hypertext item has been visited, False otherwise. |
Note
This method is meaningful only for hypertext-like items.
Returns the window associated to the item (if any).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Window if the item has an associated window, None otherwise. |
Returns whether the window associated to the item is enabled.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has an associated window and this window is enabled, False in all other cases. |
Returns the item last child.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further children. |
Returns the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Returns: | An instance of ImageList. |
---|
Returns the line height for the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | the item height, in pixels. |
Returns the maximum width of the CustomTreeCtrl.
Parameters: | respect_expansion_state (bool) – if True, only the expanded items (and their children) will be measured. Otherwise all the items are expanded and their width measured. |
---|---|
Returns: | the maximum width of CustomTreeCtrl, in pixels. |
Returns the next item. Only for internal use right now.
Returns: | An instance of GenericTreeItem or None if there are no further items. |
---|---|
Parameters: | item – an instance of GenericTreeItem. |
Returns the next active item. Used Internally at present.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem if an active item has been found or None if none has been found. |
Returns the item’s next child.
Parameters: |
|
---|---|
Returns: |
A tuple with the first value being an instance of GenericTreeItem or None if there are no further children, and as second value an integer parameter ‘cookie’. |
Note
This method returns None if there are no further children.
Returns the next expanded item after the input one.
Parameters: | item – an instance of TreeListItem. |
---|
Returns the next sibling of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further siblings. |
Note
This method returns None if there are no further siblings.
Returns the next visible item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no next visible items. |
Returns the previous item. Only for internal use right now.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem |
Returns the previous expanded item before the input one.
Parameters: | item – an instance of TreeListItem. |
---|
Returns the previous sibling of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further siblings. |
Note
This method returns None if there are no further siblings.
Returns the previous visible item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no previous visible items. |
Returns the data associated to an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | A Python object representing the item data, or None if no data has been assigned to this item. |
Returns the root item, an instance of GenericTreeItem.
Returns the second gradient colour for gradient-style selections.
Returns: | An instance of Colour. |
---|
Returns the current selection.
Returns: | An instance of GenericTreeItem. |
---|
Note
This method is valid only with the style TR_SINGLE set. Use GetSelections for multiple-selections trees.
Returns a list of selected items.
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Returns: | A Python list containing the selected items, all instances of GenericTreeItem. |
---|
Returns the pen colour for separator-type items.
Returns: | An instance of Colour representing the separator pen colour. |
---|
Returns the spacing between the start and the text, in pixels.
Returns the state image list associated with CustomTreeCtrl (from which application-defined state images are taken).
Returns: | An instance of ImageList. |
---|
Handles the hyperlink items, sending the EVT_TREE_ITEM_HYPERLINK event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns True if CustomTreeCtrl has the flag bit set.
Parameters: | flag (integer) – any possible window style for CustomTreeCtrl. |
---|
See also
The __init__ method for the flag parameter description.
Returns whether CustomTreeCtrl has the TR_HAS_BUTTONS flag set.
Returns: | True if CustomTreeCtrl has the TR_HAS_BUTTONS flag set, False otherwise. |
---|
Returns whether an item has children or not.
Parameters: | item – an instance of GenericTreeItem. |
---|
Hides the windows associated to the items. Used internally.
Calculates which (if any) item is under the given point, returning the tree item at this point plus extra information flags.
Parameters: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
A tuple with the first value being an instance of GenericTreeItem or None if no item has been hit-tested, and as second value an integer parameter flag. |
Note
both the item (if any, None otherwise) and the flags are always returned as a tuple.
Inserts an item after the given previous.
Returns: | An instance of GenericTreeItem upon successful insertion. |
---|
See also
InsertItemByIndex and InsertItemByItem for an explanation of the input parameters.
See also
DoInsertItem for possible exceptions generated by this method.
Inserts an item after the given previous.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Inserts an item after the given previous.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception if the previous item is not a sibling. |
See also
DoInsertItem for other possible exceptions generated by this method.
Inserts a separator item after the given previous.
Returns: | An instance of GenericTreeItem upon successful insertion. |
---|
See also
InsertItemByIndex and InsertItemByItem for an explanation of the input parameters.
See also
DoInsertItem for possible exceptions generated by this method.
Returns whether the item font is bold or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has bold text, False otherwise. |
Checks if the given item is under another one in the tree hierarchy.
Parameters: |
|
---|---|
Returns: |
True if item is a descendant of parent, False otherwise. |
Returns whether the item is expanded or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is expanded, False if it is collapsed. |
Returns whether the item font is italic or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has italic text, False otherwise. |
Returns whether or not the checkbox item is a 3-state checkbox.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if this checkbox is a 3-state checkbox, False if it’s a 2-state checkbox item. |
Note
This method is meaningful only for checkbox-like items.
Returns whether an item is checked or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is in a ‘checked’ state, False otherwise. |
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Returns whether an item is enabled or disabled.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether an item is hypertext or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is hypertext-like, False otherwise. |
Returns whether an item is of separator type or not.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether the item is selected or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is selected, False otherwise. |
Returns whether the item is visible or not (i.e., its hierarchy is expanded enough to show the item).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is visible, False if it is hidden. |
Returns whether the item has children or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has children, False otherwise. |
Called by TreeTextCtrl, to accept the changes and to send the EVT_TREE_END_LABEL_EDIT event.
Parameters: |
|
---|---|
Returns: |
True if the editing has not been vetoed, False otherwise. |
Called by TreeTextCtrl, to cancel the changes and to send the EVT_TREE_END_LABEL_EDIT event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether 2 items have the same text.
Override this function in the derived class to change the sort order of the items in the CustomTreeCtrl. The function should return a negative, zero or positive value if the first item is less than, equal to or greater than the second one.
Parameters: |
|
---|---|
Returns: |
The return value is negative if item1 < item2, zero if item1 == item2 and strictly positive if item1 < item2. |
Note
The base class version compares items alphabetically.
Handles the EVT_WINDOW_DESTROY event for CustomTreeCtrl.
Parameters: | event – a WindowDestroyEvent event to be processed. |
---|
The timer for editing has expired. Start editing.
Handles the EVT_ERASE_BACKGROUND event for CustomTreeCtrl.
Parameters: | event – a EraseEvent event to be processed. |
---|
Process the tooltip event, to speed up event processing. Does not actually get a tooltip.
Parameters: | event – a CommandTreeEvent event to be processed. |
---|
This method is normally only used internally, but sometimes an application may need it to implement functionality that should not be disabled by an application defining an OnIdle handler in a derived class.
This method may be used to do delayed painting, for example, and most implementations call Window.UpdateWindowUI in order to send update events to the window in idle time.
Handles the EVT_KEY_DOWN event for CustomTreeCtrl, sending a EVT_TREE_KEY_DOWN event.
Parameters: | event – a KeyEvent event to be processed. |
---|
Handles the EVT_KILL_FOCUS event for CustomTreeCtrl.
Parameters: | event – a FocusEvent event to be processed. |
---|
Handles a bunch of EVT_MOUSE_EVENTS events for CustomTreeCtrl.
Parameters: | event – a MouseEvent event to be processed. |
---|
Handles the EVT_PAINT event for CustomTreeCtrl.
Parameters: | event – a PaintEvent event to be processed. |
---|
Handles the EVT_SET_FOCUS event for CustomTreeCtrl.
Parameters: | event – a FocusEvent event to be processed. |
---|
Handles the EVT_SIZE event for CustomTreeCtrl.
Parameters: | event – a SizeEvent event to be processed. |
---|
Actually draws an item.
Parameters: |
|
---|
Paint a level in the hierarchy of CustomTreeCtrl.
Parameters: |
|
---|
Prepends an item as a first child of parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Prepends a separator item as a first child of parent.
Parameters: | parent – an instance of GenericTreeItem representing the item’s parent. |
---|---|
Returns: | An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Recurses over all the children of the spcified items, calculating their maximum width.
Parameters: |
|
---|---|
Returns: |
A tuple containing the maximum width and item height, in pixels. |
Refreshes the items with which a window is associated.
Parameters: | item – an instance of GenericTreeItem. If item is None, then the recursive refresh starts from the root node. |
---|
Note
This method is called only if the style TR_ALIGN_WINDOWS_RIGHT is used.
Refreshes a damaged item line.
Parameters: | item – an instance of GenericTreeItem. |
---|
Refreshes a damaged selected item line.
Refreshes the selected items under the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Refreshes a damaged subtree of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Called by TreeTextCtrl when it marks itself for deletion.
Scrolls the specified item into view.
Parameters: | item – an instance of GenericTreeItem. |
---|
Selects all the item in the tree.
Raise : | Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
---|
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Selects all the children of the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Selects/deselects an item.
Parameters: |
|
---|
Selects all the items between item1 and item2.
Parameters: |
|
---|---|
Raise : |
Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Actually sends the EVT_TREE_DELETE_ITEM event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Sets the CustomTreeCtrl window style.
Parameters: | agwStyle (integer) – the new CustomTreeCtrl window style. |
---|
See also
The __init__ method for the agwStyle parameter description.
Changes the background colour of CustomTreeCtrl.
Parameters: | colour – the colour to be used as the background colour, pass NullColour to reset to the default colour. |
---|---|
Returns: | False if the underlying PyScrolledWindow does not accept the new colour, True otherwise. |
Note
The background colour is usually painted by the default EraseEvent event handler function under Windows and automatically under GTK.
Note
Setting the background colour does not cause an immediate refresh, so you may wish to call Window.ClearBackground or Window.Refresh after calling this function.
Note
Overridden from PyScrolledWindow.
Sets the CustomTreeCtrl background image.
Parameters: | image – if not None, an instance of Bitmap. |
---|
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
Sets the pen used to draw the selected item border.
Parameters: | pen – an instance of Pen. |
---|
Note
The border pen is not used if the Windows Vista selection style is applied.
Sets the buttons image list for CustomTreeCtrl (from which application-defined button images are taken).
Parameters: | imageList – an instance of ImageList. |
---|
Sets the pen used to draw the connecting lines between items.
Parameters: | pen – an instance of Pen. |
---|
Sets the colour for items in a disabled state.
Parameters: | colour – a valid Colour instance. |
---|
Sets the first gradient colour for gradient-style selections.
Parameters: | colour – if not None, a valid Colour instance. Otherwise, the colour is taken from the system value SYS_COLOUR_HIGHLIGHT . |
---|
Sets the CustomTreeCtrl font.
Parameters: | font – a valid Font instance. |
---|
Note
Overridden from PyScrolledWindow.
Changes the foreground colour of CustomTreeCtrl.
Parameters: | colour – the colour to be used as the foreground colour, pass NullColour to reset to the default colour. |
---|---|
Returns: | False if the underlying PyScrolledWindow does not accept the new colour, True otherwise. |
Note
Overridden from PyScrolledWindow.
Sets the gradient style for gradient-style selections.
Parameters: | vertical (integer) – 0 for horizontal gradient-style selections, 1 for vertical gradient-style selections. |
---|
Sets the colour used to highlight focused selected items.
Parameters: | colour – a valid Colour instance. |
---|
Note
This is applied only if gradient and Windows Vista selection styles are disabled.
Sets the colour used to highlight unfocused selected items.
Parameters: | colour – a valid Colour instance. |
---|
Note
This is applied only if gradient and Windows Vista selection styles are disabled.
Sets the font used to render hypertext items.
Parameters: | font – a valid Font instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the colour used to render a non-visited hypertext item.
Parameters: | colour – a valid Colour instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the colour used to render a visited hypertext item.
Parameters: | colour – a valid Colour instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the normal image list for CustomTreeCtrl.
Parameters: | imageList – an instance of ImageList. |
---|
Sets the checkbox/radiobutton image list.
Parameters: |
|
---|
Sets the indentation for CustomTreeCtrl.
Parameters: | indent (integer) – an integer representing the indentation for the items in the tree. |
---|
Sets whether the item has a 3-state value checkbox assigned to it or not.
Parameters: |
|
---|---|
Returns: |
True if the change was successful, False otherwise. |
Note
This method is meaningful only for checkbox-like items.
Sets the checkbox item to the given state.
Parameters: |
|
---|
Note
This method raises an exception when the checkbox item is a 2-state checkbox and setting the state to CHK_UNDETERMINED .
Note
This method is meaningful only for checkbox-like items.
Sets the item background colour.
Parameters: |
|
---|
Sets the item font as bold/unbold.
Parameters: |
|
---|
Gives the item the visual feedback for drag and drop operations. This is useful when something is dragged from outside the CustomTreeCtrl.
Parameters: |
|
---|
Sets the item font.
Parameters: |
|
---|
Forces the appearance/disappearance of the button next to the item.
Parameters: |
|
---|
Sets whether the item is hypertext or not.
Parameters: |
|
---|
Sets the item image, depending on the item state.
Parameters: |
|
---|
See also
GetItemImage for an explanation of the which parameter.
Sets the item font as italic/non-italic.
Parameters: |
|
---|
Sets the item leftmost image, i.e. the image associated to the item on the leftmost part of the CustomTreeCtrl client area.
Parameters: |
|
---|
Sets the item text.
Parameters: |
|
---|---|
Raise : |
Exception if the input item is a separator. |
Sets the item text colour or separator horizontal line colour.
Parameters: |
|
---|
Sets the item type.
Parameters: |
|
---|
Note
Regarding radiobutton-type items (with ct_type = 2), the following approach is used:
Sets whether an hypertext item was visited.
Parameters: |
|
---|
Note
This method is meaningful only for hypertext-like items.
Sets the window for the given item.
Parameters: |
|
---|---|
Raise : |
Exception if the input item is a separator and wnd is not None. |
Enables/disables the window associated to the item.
Parameters: |
|
---|
Sets the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Parameters: | imageList – an instance of ImageList. |
---|
Sets the data associated to an item.
Parameters: |
|
---|
Sets the second gradient colour for gradient-style selections.
Parameters: | colour – if not None, a valid Colour instance. Otherwise, the colour generated is a slightly darker version of the CustomTreeCtrl background colour. |
---|
Sets the pen colour for separator-type items.
Parameters: | colour – a valid instance of Colour. |
---|
Sets the spacing between items in CustomTreeCtrl.
Parameters: | spacing (integer) – an integer representing the spacing between items in the tree. |
---|
Sets the state image list for CustomTreeCtrl (from which application-defined state images are taken).
Parameters: | imageList – an instance of ImageList. |
---|
Return True from here to allow the colours of this window to be changed by InheritAttributes, returning False forbids inheriting them from the parent window.
The base class version returns False, but this method is overridden in Control where it returns True.
CustomTreeCtrl does not inherit colours from anyone.
Sorts the children of the given item using the OnCompareItems method of CustomTreeCtrl.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
You should override the OnCompareItems method in your derived class to change the sort order (the default is ascending case-sensitive alphabetical order).
Used internally.
Used internally.
Thaw CustomTreeCtrl.
Reenables window updating after a previous call to Freeze. To really thaw the control, it must be called exactly the same number of times as Freeze.
Raise : | Exception if Thaw has been called without an un-matching Freeze. |
---|
Tiles the background image to fill all the available area.
Parameters: | dc – an instance of DC. |
---|
Todo
Support background images also in stretch and centered modes.
Toggles the item state (collapsed/expanded).
Parameters: | item – an instance of GenericTreeItem. |
---|
Toggles the item selection.
Parameters: | item – an instance of GenericTreeItem. |
---|
Used internally to handle radio node parent correctly.
Parameters: |
|
---|
Unselects the current selection.
Unselect all the items.
Unselects all the children of the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|
---恢复内容结束---
CustomTreeCtrl is a class that mimics the behaviour of TreeCtrl, with almost the same base functionalities plus some more enhancements. This class does not rely on the native control, as it is a full owner-drawn tree control.
Inheritance diagram for class CustomTreeCtrl
PyScrolledWindow
__init__ | Default class constructor. |
AcceptsFocus | Can this window be given focus by mouse click? |
AddRoot | Adds a root item to the CustomTreeCtrl. |
AdjustMyScrollbars | Internal method used to adjust the PyScrolledWindow scrollbars. |
AppendItem | Appends an item as a last child of its parent. |
AppendSeparator | Appends an horizontal line separator as a last child of its parent. |
AssignButtonsImageList | Assigns the button image list. |
AssignImageList | Assigns the normal image list. |
AssignLeftImageList | Assigns the image list for CustomTreeCtrl filled with images to be used on |
AssignStateImageList | Assigns the state image list. |
AutoCheckChild | Transverses the tree and checks/unchecks the items. |
AutoCheckParent | Traverses up the tree and checks/unchecks parent items. |
AutoToggleChild | Transverses the tree and toggles the items. |
CalculateLevel | Calculates the level of an item inside the tree hierarchy. |
CalculateLineHeight | Calculates the height of a line. |
CalculatePositions | Calculates all the positions of the visible items. |
CalculateSize | Calculates overall position and size of an item. |
CheckChilds | Programatically check/uncheck item children. |
CheckItem | Actually checks/uncheks an item, sending (eventually) the two |
CheckItem2 | Used internally to avoid EVT_TREE_ITEM_CHECKED events. |
CheckSameLevel | Uncheck radio items which are on the same level of the checked one. |
ChildrenClosing | We are about to destroy the item children. |
Collapse | Collapse an item, sending a EVT_TREE_ITEM_COLLAPSING and |
CollapseAndReset | Collapse the given item and deletes its children. |
Delete | Deletes an item. |
DeleteAllItems | Deletes all items in the CustomTreeCtrl. |
DeleteChildren | Delete all the item’s children. |
DeleteItemWindow | Deletes the window associated to an item (if any). |
DoGetBestSize | Gets the size which best suits the window: for a control, it would be the |
DoInsertItem | Actually inserts an item in the tree. |
DoSelectItem | Actually selects/unselects an item, sending EVT_TREE_SEL_CHANGING and |
DrawHorizontalGradient | Gradient fill from colour 1 to colour 2 from left to right. |
DrawVerticalGradient | Gradient fill from colour 1 to colour 2 from top to bottom. |
DrawVistaRectangle | Draws the selected item(s) with the Windows Vista style. |
Edit | Internal function. Starts the editing of an item label, sending a |
EditLabel | Starts editing an item label. |
EnableChildren | Enables/disables the item children. |
EnableItem | Enables/disables an item. |
EnableSelectionGradient | Globally enables/disables drawing of gradient selections. |
EnableSelectionVista | Globally enables/disables drawing of Windows Vista selections. |
EnsureVisible | Scrolls and/or expands items to ensure that the given item is visible. |
Expand | Expands an item, sending a EVT_TREE_ITEM_EXPANDING and |
ExpandAll | Expands all CustomTreeCtrl items. |
ExpandAllChildren | Expands all the items children of the input item. |
FillArray | Internal function. Used to populate an array of selected items when |
FindItem | Finds the first item starting with the given prefix after the given parent. |
Freeze | Freeze CustomTreeCtrl. |
GetAGWWindowStyleFlag | Returns the CustomTreeCtrl style. |
GetBackgroundImage | Returns the CustomTreeCtrl background image (if any). |
GetBorderPen | Returns the pen used to draw the selected item border. |
GetBoundingRect | Retrieves the rectangle bounding the item. |
GetButtonsImageList | Returns the buttons image list associated with CustomTreeCtrl (from |
GetChildrenCount | Returns the item children count. |
GetClassDefaultAttributes | Returns the default font and colours which are used by the control. This is |
GetConnectionPen | Returns the pen used to draw the connecting lines between items. |
GetControlBmp | Returns a native looking checkbox or radio button bitmap. |
GetCount | Returns the global number of items in the tree. |
GetDisabledColour | Returns the colour for items in a disabled state. |
GetEditControl | Returns a pointer to the edit TreeTextCtrl if the item is being edited or |
GetFirstChild | Returns the item’s first child and an integer value ‘cookie’. |
GetFirstGradientColour | Returns the first gradient colour for gradient-style selections. |
GetFirstVisibleItem | Returns the first visible item. |
GetGradientStyle | Returns the gradient style for gradient-style selections. |
GetHilightFocusColour | Returns the colour used to highlight focused selected items. |
GetHilightNonFocusColour | Returns the colour used to highlight unfocused selected items. |
GetHyperTextFont | Returns the font used to render hypertext items. |
GetHyperTextNewColour | Returns the colour used to render a non-visited hypertext item. |
GetHyperTextVisitedColour | Returns the colour used to render a visited hypertext item. |
GetImageList | Returns the normal image list associated with CustomTreeCtrl. |
GetImageListCheck | Returns the image list used to build the check/radio buttons in CustomTreeCtrl. |
GetIndent | Returns the item indentation, in pixels. |
GetItem3StateValue | Gets the state of a 3-state checkbox item. |
GetItemBackgroundColour | Returns the item background colour. |
GetItemFont | Returns the item font. |
GetItemImage | Returns the item image. |
GetItemLeftImage | Returns the item leftmost image, i.e. the image associated to the item on the leftmost |
GetItemParent | Returns the item parent (can be None for root items). |
GetItemSize | Returns the horizontal space available in CustomTreeCtrl, in pixels, to draw this item. |
GetItemText | Returns the item text. |
GetItemTextColour | Returns the item text colour or separator horizontal line colour. |
GetItemType | Returns the item type. |
GetItemVisited | Returns whether an hypertext item was visited. |
GetItemWindow | Returns the window associated to the item (if any). |
GetItemWindowEnabled | Returns whether the window associated to the item is enabled. |
GetLastChild | Returns the item last child. |
GetLeftImageList | Returns the image list for CustomTreeCtrl filled with images to be used on |
GetLineHeight | Returns the line height for the given item. |
GetMaxWidth | Returns the maximum width of the CustomTreeCtrl. |
GetNext | Returns the next item. Only for internal use right now. |
GetNextActiveItem | Returns the next active item. Used Internally at present. |
GetNextChild | Returns the item’s next child. |
GetNextExpanded | Returns the next expanded item after the input one. |
GetNextSibling | Returns the next sibling of an item. |
GetNextVisible | Returns the next visible item. |
GetPrev | Returns the previous item. Only for internal use right now. |
GetPrevExpanded | Returns the previous expanded item before the input one. |
GetPrevSibling | Returns the previous sibling of an item. |
GetPrevVisible | Returns the previous visible item. |
GetPyData | Returns the data associated to an item. |
GetRootItem | Returns the root item, an instance of GenericTreeItem. |
GetSecondGradientColour | Returns the second gradient colour for gradient-style selections. |
GetSelection | Returns the current selection. |
GetSelections | Returns a list of selected items. |
GetSeparatorColour | Returns the pen colour for separator-type items. |
GetSpacing | Returns the spacing between the start and the text, in pixels. |
GetStateImageList | Returns the state image list associated with CustomTreeCtrl (from which |
HandleHyperLink | Handles the hyperlink items, sending the EVT_TREE_ITEM_HYPERLINK event. |
HasAGWFlag | Returns True if CustomTreeCtrl has the flag bit set. |
HasButtons | Returns whether CustomTreeCtrl has the TR_HAS_BUTTONS flag set. |
HasChildren | Returns whether an item has children or not. |
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 |
InsertItem | Inserts an item after the given previous. |
InsertItemByIndex | Inserts an item after the given previous. |
InsertItemByItem | Inserts an item after the given previous. |
InsertSeparator | Inserts a separator item after the given previous. |
IsBold | Returns whether the item font is bold or not. |
IsDescendantOf | Checks if the given item is under another one in the tree hierarchy. |
IsExpanded | Returns whether the item is expanded or not. |
IsItalic | Returns whether the item font is italic or not. |
IsItem3State | Returns whether or not the checkbox item is a 3-state checkbox. |
IsItemChecked | Returns whether an item is checked or not. |
IsItemEnabled | Returns whether an item is enabled or disabled. |
IsItemHyperText | Returns whether an item is hypertext or not. |
IsItemSeparator | Returns whether an item is of separator type or not. |
IsSelected | Returns whether the item is selected or not. |
IsVisible | Returns whether the item is visible or not (i.e., its hierarchy is expanded |
ItemHasChildren | Returns whether the item has children or not. |
OnAcceptEdit | Called by TreeTextCtrl, to accept the changes and to send the |
OnCancelEdit | Called by TreeTextCtrl, to cancel the changes and to send the |
OnCompareItems | Returns whether 2 items have the same text. |
OnDestroy | Handles the EVT_WINDOW_DESTROY event for CustomTreeCtrl. |
OnEditTimer | The timer for editing has expired. Start editing. |
OnEraseBackground | Handles the EVT_ERASE_BACKGROUND event for CustomTreeCtrl. |
OnGetToolTip | Process the tooltip event, to speed up event processing. Does not actually |
OnInternalIdle | This method is normally only used internally, but sometimes an application |
OnKeyDown | Handles the EVT_KEY_DOWN event for CustomTreeCtrl, sending a |
OnKillFocus | Handles the EVT_KILL_FOCUS event for CustomTreeCtrl. |
OnMouse | Handles a bunch of EVT_MOUSE_EVENTS events for CustomTreeCtrl. |
OnPaint | Handles the EVT_PAINT event for CustomTreeCtrl. |
OnSetFocus | Handles the EVT_SET_FOCUS event for CustomTreeCtrl. |
OnSize | Handles the EVT_SIZE event for CustomTreeCtrl. |
PaintItem | Actually draws an item. |
PaintLevel | Paint a level in the hierarchy of CustomTreeCtrl. |
PrependItem | Prepends an item as a first child of parent. |
PrependSeparator | Prepends a separator item as a first child of parent. |
RecurseOnChildren | Recurses over all the children of the spcified items, calculating their |
RefreshItemWithWindows | Refreshes the items with which a window is associated. |
RefreshLine | Refreshes a damaged item line. |
RefreshSelected | Refreshes a damaged selected item line. |
RefreshSelectedUnder | Refreshes the selected items under the given item. |
RefreshSubtree | Refreshes a damaged subtree of an item. |
ResetEditControl | Called by TreeTextCtrl when it marks itself for deletion. |
ScrollTo | Scrolls the specified item into view. |
SelectAll | Selects all the item in the tree. |
SelectAllChildren | Selects all the children of the given item. |
SelectItem | Selects/deselects an item. |
SelectItemRange | Selects all the items between item1 and item2. |
SendDeleteEvent | Actually sends the EVT_TREE_DELETE_ITEM event. |
SetAGWWindowStyleFlag | Sets the CustomTreeCtrl window style. |
SetBackgroundColour | Changes the background colour of CustomTreeCtrl. |
SetBackgroundImage | Sets the CustomTreeCtrl background image. |
SetBorderPen | Sets the pen used to draw the selected item border. |
SetButtonsImageList | Sets the buttons image list for CustomTreeCtrl (from which application-defined |
SetConnectionPen | Sets the pen used to draw the connecting lines between items. |
SetDisabledColour | Sets the colour for items in a disabled state. |
SetFirstGradientColour | Sets the first gradient colour for gradient-style selections. |
SetFont | Sets the CustomTreeCtrl font. |
SetForegroundColour | Changes the foreground colour of CustomTreeCtrl. |
SetGradientStyle | Sets the gradient style for gradient-style selections. |
SetHilightFocusColour | Sets the colour used to highlight focused selected items. |
SetHilightNonFocusColour | Sets the colour used to highlight unfocused selected items. |
SetHyperTextFont | Sets the font used to render hypertext items. |
SetHyperTextNewColour | Sets the colour used to render a non-visited hypertext item. |
SetHyperTextVisitedColour | Sets the colour used to render a visited hypertext item. |
SetImageList | Sets the normal image list for CustomTreeCtrl. |
SetImageListCheck | Sets the checkbox/radiobutton image list. |
SetIndent | Sets the indentation for CustomTreeCtrl. |
SetItem3State | Sets whether the item has a 3-state value checkbox assigned to it or not. |
SetItem3StateValue | Sets the checkbox item to the given state. |
SetItemBackgroundColour | Sets the item background colour. |
SetItemBold | Sets the item font as bold/unbold. |
SetItemDropHighlight | Gives the item the visual feedback for drag and drop operations. |
SetItemFont | Sets the item font. |
SetItemHasChildren | Forces the appearance/disappearance of the button next to the item. |
SetItemHyperText | Sets whether the item is hypertext or not. |
SetItemImage | Sets the item image, depending on the item state. |
SetItemItalic | Sets the item font as italic/non-italic. |
SetItemLeftImage | Sets the item leftmost image, i.e. the image associated to the item on the leftmost |
SetItemText | Sets the item text. |
SetItemTextColour | Sets the item text colour or separator horizontal line colour. |
SetItemType | Sets the item type. |
SetItemVisited | Sets whether an hypertext item was visited. |
SetItemWindow | Sets the window for the given item. |
SetItemWindowEnabled | Enables/disables the window associated to the item. |
SetLeftImageList | Sets the image list for CustomTreeCtrl filled with images to be used on |
SetPyData | Sets the data associated to an item. |
SetSecondGradientColour | Sets the second gradient colour for gradient-style selections. |
SetSeparatorColour | Sets the pen colour for separator-type items. |
SetSpacing | Sets the spacing between items in CustomTreeCtrl. |
SetStateImageList | Sets the state image list for CustomTreeCtrl (from which application-defined |
ShouldInheritColours | Return True from here to allow the colours of this window to be |
SortChildren | Sorts the children of the given item using the OnCompareItems method of |
TagAllChildrenUntilLast | Used internally. |
TagNextChildren | Used internally. |
Thaw | Thaw CustomTreeCtrl. |
TileBackground | Tiles the background image to fill all the available area. |
Toggle | Toggles the item state (collapsed/expanded). |
ToggleItemSelection | Toggles the item selection. |
UnCheckRadioParent | Used internally to handle radio node parent correctly. |
Unselect | Unselects the current selection. |
UnselectAll | Unselect all the items. |
UnselectAllChildren | Unselects all the children of the given item. |
CustomTreeCtrl is a class that mimics the behaviour of TreeCtrl, with almost the same base functionalities plus some more enhancements. This class does not rely on the native control, as it is a full owner-drawn tree control.
Default class constructor.
Parameters: |
|
---|
Can this window be given focus by mouse click?
Note
This method always returns True as we always accept focus from mouse click.
Note
Overridden from PyScrolledWindow.
Adds a root item to the CustomTreeCtrl.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception in the following cases:
|
Warning
Only one root is allowed to exist in any given instance of CustomTreeCtrl.
Internal method used to adjust the PyScrolledWindow scrollbars.
Appends an item as a last child of its parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Appends an horizontal line separator as a last child of its parent.
Parameters: | parentId – an instance of GenericTreeItem representing the separator’s parent. |
---|---|
Returns: | An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Assigns the button image list.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the normal image list.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Parameters: | imageList – an instance of ImageList. |
---|
Assigns the state image list.
Parameters: | imageList – an instance of ImageList. |
---|
Transverses the tree and checks/unchecks the items.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Traverses up the tree and checks/unchecks parent items.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Transverses the tree and toggles the items.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Calculates the level of an item inside the tree hierarchy.
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Returns: |
The new y vertical position inside the PyScrolledWindow. |
Calculates the height of a line.
Calculates all the positions of the visible items.
Calculates overall position and size of an item.
Parameters: |
|
---|
Programatically check/uncheck item children.
Parameters: |
|
---|
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Note
This method does not generate EVT_TREE_ITEM_CHECKING and EVT_TREE_ITEM_CHECKED events.
Actually checks/uncheks an item, sending (eventually) the two events EVT_TREE_ITEM_CHECKING and EVT_TREE_ITEM_CHECKED.
Parameters: |
|
---|
Used internally to avoid EVT_TREE_ITEM_CHECKED events.
Parameters: |
|
---|
Uncheck radio items which are on the same level of the checked one. Used internally.
Parameters: |
|
---|
Note
This method is meaningful only for radiobutton-like items.
We are about to destroy the item children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Collapse an item, sending a EVT_TREE_ITEM_COLLAPSING and EVT_TREE_ITEM_COLLAPSED events.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if you try to collapse a hidden root (i.e., when the TR_HIDE_ROOT style is set for CustomTreeCtrl). |
Collapse the given item and deletes its children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Deletes an item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method sends the EVT_TREE_DELETE_ITEM event.
Deletes all items in the CustomTreeCtrl.
Delete all the item’s children.
Parameters: | item – an instance of GenericTreeItem. |
---|
Deletes the window associated to an item (if any).
Parameters: | item – an instance of GenericTreeItem. |
---|
Gets the size which best suits the window: for a control, it would be the minimal size which doesn’t truncate the control, for a panel - the same size as it would have after a call toFit().
Returns: | An instance of Size. |
---|
Note
Overridden from PyScrolledWindow.
Actually inserts an item in the tree.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception in the following cases:
|
Note
Separator items should not have children, text labels or an associated window.
Actually selects/unselects an item, sending EVT_TREE_SEL_CHANGING and EVT_TREE_SEL_CHANGED events.
Parameters: |
|
---|
Gradient fill from colour 1 to colour 2 from left to right.
Parameters: |
|
---|
Gradient fill from colour 1 to colour 2 from top to bottom.
Parameters: |
|
---|
Draws the selected item(s) with the Windows Vista style.
Parameters: |
|
---|
Internal function. Starts the editing of an item label, sending a EVT_TREE_BEGIN_LABEL_EDIT event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Warning
Separator-type items can not be edited.
Starts editing an item label.
Parameters: | item – an instance of GenericTreeItem. |
---|
Enables/disables the item children.
Parameters: |
|
---|
Note
This method is used internally.
Enables/disables an item.
Parameters: |
|
---|
Globally enables/disables drawing of gradient selections.
Parameters: | enable (bool) – True to enable gradient-style selections, False to disable it. |
---|
Note
Calling this method disables any Vista-style selection previously enabled.
Globally enables/disables drawing of Windows Vista selections.
Parameters: | enable (bool) – True to enable Vista-style selections, False to disable it. |
---|
Note
Calling this method disables any gradient-style selection previously enabled.
Scrolls and/or expands items to ensure that the given item is visible.
Parameters: | item – an instance of GenericTreeItem. |
---|
Expands an item, sending a EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if you try to expand a hidden root (i.e., when the TR_HIDE_ROOT style is set for CustomTreeCtrl). |
Expands all CustomTreeCtrl items.
Note
This method suppresses the EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events because expanding many items int the control would be too slow then.
Expands all the items children of the input item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
This method suppresses the EVT_TREE_ITEM_EXPANDING and EVT_TREE_ITEM_EXPANDED events because expanding many items int the control would be too slow then.
Internal function. Used to populate an array of selected items when the style TR_MULTIPLE is used.
Parameters: |
|
---|---|
Returns: |
A Python list containing the selected items. |
Finds the first item starting with the given prefix after the given parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem or None if no item has been found. |
Freeze CustomTreeCtrl.
Freezes the window or, in other words, prevents any updates from taking place on screen, the window is not redrawn at all. Thaw must be called to reenable window redrawing. Calls to these two functions may be nested.
Note
This method is useful for visual appearance optimization (for example, it is a good idea to use it before doing many large text insertions in a row into a TextCtrl under wxGTK) but is not implemented on all platforms nor for all controls so it is mostly just a hint to wxWidgets and not a mandatory directive.
Returns the CustomTreeCtrl style.
See also
The __init__ method for a list of possible style flags.
Returns the CustomTreeCtrl background image (if any).
Returns: | An instance of Bitmap if a background image is present, None otherwise. |
---|
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
Returns the pen used to draw the selected item border.
Returns: | An instance of Pen. |
---|
Note
The border pen is not used if the Windows Vista selection style is applied.
Retrieves the rectangle bounding the item.
Parameters: |
|
---|---|
Returns: |
An instance of Rect. |
Note
The rectangle coordinates are logical, not physical ones. So, for example, the x coordinate may be negative if the tree has a horizontal scrollbar and its position is not 0.
Returns the buttons image list associated with CustomTreeCtrl (from which application-defined button images are taken).
Returns: | An instance of ImageList. |
---|
Returns the item children count.
Parameters: |
|
---|
Returns the default font and colours which are used by the control. This is useful if you want to use the same font or colour in your own control as in a standard control – which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the users system, especially if it uses themes.
This static method is “overridden’’ in many derived classes and so calling, for example, Button.GetClassDefaultAttributes () will typically return the values appropriate for a button which will be normally different from those returned by, say, ListCtrl.GetClassDefaultAttributes ().
Returns: | An instance of VisualAttributes. |
---|
Note
The VisualAttributes structure has at least the fields font, colFg and colBg. All of them may be invalid if it was not possible to determine the default control appearance or, especially for the background colour, if the field doesn’t make sense as is the case for colBg for the controls with themed background.
Note
Overridden from PyControl.
Returns the pen used to draw the connecting lines between items.
Returns: | An instance of Pen. |
---|
Returns a native looking checkbox or radio button bitmap.
Parameters: |
|
---|---|
Returns: |
An instance of Bitmap, representing a native looking checkbox or radiobutton. |
Returns the global number of items in the tree.
Returns the colour for items in a disabled state.
Returns: | An instance of Colour. |
---|
Returns a pointer to the edit TreeTextCtrl if the item is being edited or None otherwise (it is assumed that no more than one item may be edited simultaneously).
Returns the item’s first child and an integer value ‘cookie’. Call GetNextChild for the next child using this very ‘cookie’ return value as an input.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | A tuple with the first value being an instance of GenericTreeItem or None if there are no further children, and as second value an integer parameter ‘cookie’. |
Note
This method returns None if there are no further children.
Returns the first gradient colour for gradient-style selections.
Returns: | An instance of Colour. |
---|
Returns the first visible item.
Returns: | An instance of GenericTreeItem or None if there are no visible items. |
---|
Returns the gradient style for gradient-style selections.
Returns: | 0 for horizontal gradient-style selections, 1 for vertical gradient-style selections. |
---|
Returns the colour used to highlight focused selected items.
Returns: | An instance of Colour. |
---|
Note
This is used only if gradient and Windows Vista selection styles are disabled.
Returns the colour used to highlight unfocused selected items.
Returns: | An instance of Colour. |
---|
Note
This is used only if gradient and Windows Vista selection styles are disabled.
Returns the font used to render hypertext items.
Returns: | An instance of Font. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the colour used to render a non-visited hypertext item.
Returns: | An instance of Colour. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the colour used to render a visited hypertext item.
Returns: | An instance of Colour. |
---|
Note
This method is meaningful only for hypertext-like items.
Returns the normal image list associated with CustomTreeCtrl.
Returns: | An instance of ImageList. |
---|
Returns the image list used to build the check/radio buttons in CustomTreeCtrl.
Returns: | An instance of ImageList. |
---|
Returns the item indentation, in pixels.
Gets the state of a 3-state checkbox item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | CHK_UNCHECKED when the checkbox is unchecked, CHK_CHECKED when it is checked and CHK_UNDETERMINED when it’s in the undetermined state. |
Note
This method raises an exception when the function is used with a 2-state checkbox item.
Note
This method is meaningful only for checkbox-like items.
Returns the item background colour.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Colour. |
Returns the item font.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Font. |
Returns the item image.
Parameters: |
|
||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
An integer index that can be used to retrieve the item image inside a ImageList. |
Returns the item leftmost image, i.e. the image associated to the item on the leftmost part of the CustomTreeCtrl client area.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An integer index that can be used to retrieve the item leftmost image inside a ImageList. |
Returns the item parent (can be None for root items).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None for root items. |
Returns the horizontal space available in CustomTreeCtrl, in pixels, to draw this item.
Parameters: | item – an instance of GenericTreeItem. |
---|
New in version 0.9.3.
Returns the item text.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns the item text colour or separator horizontal line colour.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Colour. |
Returns the item type.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An integer representing the item type. |
See also
SetItemType for a description of valid item types.
Returns whether an hypertext item was visited.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the hypertext item has been visited, False otherwise. |
Note
This method is meaningful only for hypertext-like items.
Returns the window associated to the item (if any).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of Window if the item has an associated window, None otherwise. |
Returns whether the window associated to the item is enabled.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has an associated window and this window is enabled, False in all other cases. |
Returns the item last child.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further children. |
Returns the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Returns: | An instance of ImageList. |
---|
Returns the line height for the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | the item height, in pixels. |
Returns the maximum width of the CustomTreeCtrl.
Parameters: | respect_expansion_state (bool) – if True, only the expanded items (and their children) will be measured. Otherwise all the items are expanded and their width measured. |
---|---|
Returns: | the maximum width of CustomTreeCtrl, in pixels. |
Returns the next item. Only for internal use right now.
Returns: | An instance of GenericTreeItem or None if there are no further items. |
---|---|
Parameters: | item – an instance of GenericTreeItem. |
Returns the next active item. Used Internally at present.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem if an active item has been found or None if none has been found. |
Returns the item’s next child.
Parameters: |
|
---|---|
Returns: |
A tuple with the first value being an instance of GenericTreeItem or None if there are no further children, and as second value an integer parameter ‘cookie’. |
Note
This method returns None if there are no further children.
Returns the next expanded item after the input one.
Parameters: | item – an instance of TreeListItem. |
---|
Returns the next sibling of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further siblings. |
Note
This method returns None if there are no further siblings.
Returns the next visible item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no next visible items. |
Returns the previous item. Only for internal use right now.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem |
Returns the previous expanded item before the input one.
Parameters: | item – an instance of TreeListItem. |
---|
Returns the previous sibling of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no further siblings. |
Note
This method returns None if there are no further siblings.
Returns the previous visible item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | An instance of GenericTreeItem or None if there are no previous visible items. |
Returns the data associated to an item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | A Python object representing the item data, or None if no data has been assigned to this item. |
Returns the root item, an instance of GenericTreeItem.
Returns the second gradient colour for gradient-style selections.
Returns: | An instance of Colour. |
---|
Returns the current selection.
Returns: | An instance of GenericTreeItem. |
---|
Note
This method is valid only with the style TR_SINGLE set. Use GetSelections for multiple-selections trees.
Returns a list of selected items.
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Returns: | A Python list containing the selected items, all instances of GenericTreeItem. |
---|
Returns the pen colour for separator-type items.
Returns: | An instance of Colour representing the separator pen colour. |
---|
Returns the spacing between the start and the text, in pixels.
Returns the state image list associated with CustomTreeCtrl (from which application-defined state images are taken).
Returns: | An instance of ImageList. |
---|
Handles the hyperlink items, sending the EVT_TREE_ITEM_HYPERLINK event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns True if CustomTreeCtrl has the flag bit set.
Parameters: | flag (integer) – any possible window style for CustomTreeCtrl. |
---|
See also
The __init__ method for the flag parameter description.
Returns whether CustomTreeCtrl has the TR_HAS_BUTTONS flag set.
Returns: | True if CustomTreeCtrl has the TR_HAS_BUTTONS flag set, False otherwise. |
---|
Returns whether an item has children or not.
Parameters: | item – an instance of GenericTreeItem. |
---|
Hides the windows associated to the items. Used internally.
Calculates which (if any) item is under the given point, returning the tree item at this point plus extra information flags.
Parameters: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
A tuple with the first value being an instance of GenericTreeItem or None if no item has been hit-tested, and as second value an integer parameter flag. |
Note
both the item (if any, None otherwise) and the flags are always returned as a tuple.
Inserts an item after the given previous.
Returns: | An instance of GenericTreeItem upon successful insertion. |
---|
See also
InsertItemByIndex and InsertItemByItem for an explanation of the input parameters.
See also
DoInsertItem for possible exceptions generated by this method.
Inserts an item after the given previous.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Inserts an item after the given previous.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
Raise : |
Exception if the previous item is not a sibling. |
See also
DoInsertItem for other possible exceptions generated by this method.
Inserts a separator item after the given previous.
Returns: | An instance of GenericTreeItem upon successful insertion. |
---|
See also
InsertItemByIndex and InsertItemByItem for an explanation of the input parameters.
See also
DoInsertItem for possible exceptions generated by this method.
Returns whether the item font is bold or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has bold text, False otherwise. |
Checks if the given item is under another one in the tree hierarchy.
Parameters: |
|
---|---|
Returns: |
True if item is a descendant of parent, False otherwise. |
Returns whether the item is expanded or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is expanded, False if it is collapsed. |
Returns whether the item font is italic or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has italic text, False otherwise. |
Returns whether or not the checkbox item is a 3-state checkbox.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if this checkbox is a 3-state checkbox, False if it’s a 2-state checkbox item. |
Note
This method is meaningful only for checkbox-like items.
Returns whether an item is checked or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is in a ‘checked’ state, False otherwise. |
Note
This method is meaningful only for checkbox-like and radiobutton-like items.
Returns whether an item is enabled or disabled.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether an item is hypertext or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is hypertext-like, False otherwise. |
Returns whether an item is of separator type or not.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether the item is selected or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is selected, False otherwise. |
Returns whether the item is visible or not (i.e., its hierarchy is expanded enough to show the item).
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item is visible, False if it is hidden. |
Returns whether the item has children or not.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Returns: | True if the item has children, False otherwise. |
Called by TreeTextCtrl, to accept the changes and to send the EVT_TREE_END_LABEL_EDIT event.
Parameters: |
|
---|---|
Returns: |
True if the editing has not been vetoed, False otherwise. |
Called by TreeTextCtrl, to cancel the changes and to send the EVT_TREE_END_LABEL_EDIT event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Returns whether 2 items have the same text.
Override this function in the derived class to change the sort order of the items in the CustomTreeCtrl. The function should return a negative, zero or positive value if the first item is less than, equal to or greater than the second one.
Parameters: |
|
---|---|
Returns: |
The return value is negative if item1 < item2, zero if item1 == item2 and strictly positive if item1 < item2. |
Note
The base class version compares items alphabetically.
Handles the EVT_WINDOW_DESTROY event for CustomTreeCtrl.
Parameters: | event – a WindowDestroyEvent event to be processed. |
---|
The timer for editing has expired. Start editing.
Handles the EVT_ERASE_BACKGROUND event for CustomTreeCtrl.
Parameters: | event – a EraseEvent event to be processed. |
---|
Process the tooltip event, to speed up event processing. Does not actually get a tooltip.
Parameters: | event – a CommandTreeEvent event to be processed. |
---|
This method is normally only used internally, but sometimes an application may need it to implement functionality that should not be disabled by an application defining an OnIdle handler in a derived class.
This method may be used to do delayed painting, for example, and most implementations call Window.UpdateWindowUI in order to send update events to the window in idle time.
Handles the EVT_KEY_DOWN event for CustomTreeCtrl, sending a EVT_TREE_KEY_DOWN event.
Parameters: | event – a KeyEvent event to be processed. |
---|
Handles the EVT_KILL_FOCUS event for CustomTreeCtrl.
Parameters: | event – a FocusEvent event to be processed. |
---|
Handles a bunch of EVT_MOUSE_EVENTS events for CustomTreeCtrl.
Parameters: | event – a MouseEvent event to be processed. |
---|
Handles the EVT_PAINT event for CustomTreeCtrl.
Parameters: | event – a PaintEvent event to be processed. |
---|
Handles the EVT_SET_FOCUS event for CustomTreeCtrl.
Parameters: | event – a FocusEvent event to be processed. |
---|
Handles the EVT_SIZE event for CustomTreeCtrl.
Parameters: | event – a SizeEvent event to be processed. |
---|
Actually draws an item.
Parameters: |
|
---|
Paint a level in the hierarchy of CustomTreeCtrl.
Parameters: |
|
---|
Prepends an item as a first child of parent.
Parameters: |
|
---|---|
Returns: |
An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Prepends a separator item as a first child of parent.
Parameters: | parent – an instance of GenericTreeItem representing the item’s parent. |
---|---|
Returns: | An instance of GenericTreeItem upon successful insertion. |
See also
DoInsertItem for possible exceptions generated by this method.
Recurses over all the children of the spcified items, calculating their maximum width.
Parameters: |
|
---|---|
Returns: |
A tuple containing the maximum width and item height, in pixels. |
Refreshes the items with which a window is associated.
Parameters: | item – an instance of GenericTreeItem. If item is None, then the recursive refresh starts from the root node. |
---|
Note
This method is called only if the style TR_ALIGN_WINDOWS_RIGHT is used.
Refreshes a damaged item line.
Parameters: | item – an instance of GenericTreeItem. |
---|
Refreshes a damaged selected item line.
Refreshes the selected items under the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Refreshes a damaged subtree of an item.
Parameters: | item – an instance of GenericTreeItem. |
---|
Called by TreeTextCtrl when it marks itself for deletion.
Scrolls the specified item into view.
Parameters: | item – an instance of GenericTreeItem. |
---|
Selects all the item in the tree.
Raise : | Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
---|
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Selects all the children of the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|---|
Raise : | Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Selects/deselects an item.
Parameters: |
|
---|
Selects all the items between item1 and item2.
Parameters: |
|
---|---|
Raise : |
Exception if used without the TR_EXTENDED or TR_MULTIPLE style set. |
Note
This method can be used only if CustomTreeCtrl has the TR_MULTIPLE or TR_EXTENDED style set.
Actually sends the EVT_TREE_DELETE_ITEM event.
Parameters: | item – an instance of GenericTreeItem. |
---|
Sets the CustomTreeCtrl window style.
Parameters: | agwStyle (integer) – the new CustomTreeCtrl window style. |
---|
See also
The __init__ method for the agwStyle parameter description.
Changes the background colour of CustomTreeCtrl.
Parameters: | colour – the colour to be used as the background colour, pass NullColour to reset to the default colour. |
---|---|
Returns: | False if the underlying PyScrolledWindow does not accept the new colour, True otherwise. |
Note
The background colour is usually painted by the default EraseEvent event handler function under Windows and automatically under GTK.
Note
Setting the background colour does not cause an immediate refresh, so you may wish to call Window.ClearBackground or Window.Refresh after calling this function.
Note
Overridden from PyScrolledWindow.
Sets the CustomTreeCtrl background image.
Parameters: | image – if not None, an instance of Bitmap. |
---|
Note
At present, the background image can only be used in “tile” mode.
Todo
Support background images also in stretch and centered modes.
Sets the pen used to draw the selected item border.
Parameters: | pen – an instance of Pen. |
---|
Note
The border pen is not used if the Windows Vista selection style is applied.
Sets the buttons image list for CustomTreeCtrl (from which application-defined button images are taken).
Parameters: | imageList – an instance of ImageList. |
---|
Sets the pen used to draw the connecting lines between items.
Parameters: | pen – an instance of Pen. |
---|
Sets the colour for items in a disabled state.
Parameters: | colour – a valid Colour instance. |
---|
Sets the first gradient colour for gradient-style selections.
Parameters: | colour – if not None, a valid Colour instance. Otherwise, the colour is taken from the system value SYS_COLOUR_HIGHLIGHT . |
---|
Sets the CustomTreeCtrl font.
Parameters: | font – a valid Font instance. |
---|
Note
Overridden from PyScrolledWindow.
Changes the foreground colour of CustomTreeCtrl.
Parameters: | colour – the colour to be used as the foreground colour, pass NullColour to reset to the default colour. |
---|---|
Returns: | False if the underlying PyScrolledWindow does not accept the new colour, True otherwise. |
Note
Overridden from PyScrolledWindow.
Sets the gradient style for gradient-style selections.
Parameters: | vertical (integer) – 0 for horizontal gradient-style selections, 1 for vertical gradient-style selections. |
---|
Sets the colour used to highlight focused selected items.
Parameters: | colour – a valid Colour instance. |
---|
Note
This is applied only if gradient and Windows Vista selection styles are disabled.
Sets the colour used to highlight unfocused selected items.
Parameters: | colour – a valid Colour instance. |
---|
Note
This is applied only if gradient and Windows Vista selection styles are disabled.
Sets the font used to render hypertext items.
Parameters: | font – a valid Font instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the colour used to render a non-visited hypertext item.
Parameters: | colour – a valid Colour instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the colour used to render a visited hypertext item.
Parameters: | colour – a valid Colour instance. |
---|
Note
This method is meaningful only for hypertext-like items.
Sets the normal image list for CustomTreeCtrl.
Parameters: | imageList – an instance of ImageList. |
---|
Sets the checkbox/radiobutton image list.
Parameters: |
|
---|
Sets the indentation for CustomTreeCtrl.
Parameters: | indent (integer) – an integer representing the indentation for the items in the tree. |
---|
Sets whether the item has a 3-state value checkbox assigned to it or not.
Parameters: |
|
---|---|
Returns: |
True if the change was successful, False otherwise. |
Note
This method is meaningful only for checkbox-like items.
Sets the checkbox item to the given state.
Parameters: |
|
---|
Note
This method raises an exception when the checkbox item is a 2-state checkbox and setting the state to CHK_UNDETERMINED .
Note
This method is meaningful only for checkbox-like items.
Sets the item background colour.
Parameters: |
|
---|
Sets the item font as bold/unbold.
Parameters: |
|
---|
Gives the item the visual feedback for drag and drop operations. This is useful when something is dragged from outside the CustomTreeCtrl.
Parameters: |
|
---|
Sets the item font.
Parameters: |
|
---|
Forces the appearance/disappearance of the button next to the item.
Parameters: |
|
---|
Sets whether the item is hypertext or not.
Parameters: |
|
---|
Sets the item image, depending on the item state.
Parameters: |
|
---|
See also
GetItemImage for an explanation of the which parameter.
Sets the item font as italic/non-italic.
Parameters: |
|
---|
Sets the item leftmost image, i.e. the image associated to the item on the leftmost part of the CustomTreeCtrl client area.
Parameters: |
|
---|
Sets the item text.
Parameters: |
|
---|---|
Raise : |
Exception if the input item is a separator. |
Sets the item text colour or separator horizontal line colour.
Parameters: |
|
---|
Sets the item type.
Parameters: |
|
---|
Note
Regarding radiobutton-type items (with ct_type = 2), the following approach is used:
Sets whether an hypertext item was visited.
Parameters: |
|
---|
Note
This method is meaningful only for hypertext-like items.
Sets the window for the given item.
Parameters: |
|
---|---|
Raise : |
Exception if the input item is a separator and wnd is not None. |
Enables/disables the window associated to the item.
Parameters: |
|
---|
Sets the image list for CustomTreeCtrl filled with images to be used on the leftmost part of the client area. Any item can have a leftmost image associated with it.
Parameters: | imageList – an instance of ImageList. |
---|
Sets the data associated to an item.
Parameters: |
|
---|
Sets the second gradient colour for gradient-style selections.
Parameters: | colour – if not None, a valid Colour instance. Otherwise, the colour generated is a slightly darker version of the CustomTreeCtrl background colour. |
---|
Sets the pen colour for separator-type items.
Parameters: | colour – a valid instance of Colour. |
---|
Sets the spacing between items in CustomTreeCtrl.
Parameters: | spacing (integer) – an integer representing the spacing between items in the tree. |
---|
Sets the state image list for CustomTreeCtrl (from which application-defined state images are taken).
Parameters: | imageList – an instance of ImageList. |
---|
Return True from here to allow the colours of this window to be changed by InheritAttributes, returning False forbids inheriting them from the parent window.
The base class version returns False, but this method is overridden in Control where it returns True.
CustomTreeCtrl does not inherit colours from anyone.
Sorts the children of the given item using the OnCompareItems method of CustomTreeCtrl.
Parameters: | item – an instance of GenericTreeItem. |
---|
Note
You should override the OnCompareItems method in your derived class to change the sort order (the default is ascending case-sensitive alphabetical order).
Used internally.
Used internally.
Thaw CustomTreeCtrl.
Reenables window updating after a previous call to Freeze. To really thaw the control, it must be called exactly the same number of times as Freeze.
Raise : | Exception if Thaw has been called without an un-matching Freeze. |
---|
Tiles the background image to fill all the available area.
Parameters: | dc – an instance of DC. |
---|
Todo
Support background images also in stretch and centered modes.
Toggles the item state (collapsed/expanded).
Parameters: | item – an instance of GenericTreeItem. |
---|
Toggles the item selection.
Parameters: | item – an instance of GenericTreeItem. |
---|
Used internally to handle radio node parent correctly.
Parameters: |
|
---|
Unselects the current selection.
Unselect all the items.
Unselects all the children of the given item.
Parameters: | item – an instance of GenericTreeItem. |
---|
标签:exclusive iat pass already dba effect nim sig pop
原文地址:http://www.cnblogs.com/wangjian8888/p/6059246.html