c4d.gui.TreeViewFunctions
¶
Inherit this class to supply a data and view model for
c4d.gui.TreeViewCustomGui
. Create an instance of the implementated class and pass it to
TreeViewCustomGui.SetRoot()
.
c4d.gui.
TreeViewFunctions
¶
TreeViewFunctions.GetFirst()
TreeViewFunctions.GetDown()
TreeViewFunctions.GetNext()
TreeViewFunctions.GetPred()
TreeViewFunctions.GetColumnWidth()
TreeViewFunctions.GetHeaderColumnWidth()
TreeViewFunctions.GetMinHeaderHeight()
TreeViewFunctions.GetLineHeight()
TreeViewFunctions.GetDragType()
TreeViewFunctions.AcceptDragObject()
TreeViewFunctions.GenerateDragArray()
TreeViewFunctions.DragStart()
NEW
TreeViewFunctions.SetDragObject()
NEW
TreeViewFunctions.GetHeaderSortArrow()
TreeViewFunctions.IsResizeColAllowed()
TreeViewFunctions.IsMoveColAllowed()
TreeViewFunctions.InputEvent()
TreeViewFunctions.MouseDown()
TreeViewFunctions.DoubleClick()
TreeViewFunctions.DeletePressed()
TreeViewFunctions.HeaderClick()
TreeViewFunctions.
GetFirst
(
self
,
root
,
userdata
)
¶
Called to retrieve the first object of the tree.
Parameters: |
|
---|---|
Return type: |
any |
Returns: |
The first object. |
TreeViewFunctions.
GetDown
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the first child of obj .
Parameters: |
|
---|---|
Return type: |
any |
Returns: |
The first child of obj . |
TreeViewFunctions.
GetNext
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the object after obj .
Parameters: |
|
---|---|
Return type: |
any |
Returns: |
The object after obj . |
TreeViewFunctions.
GetPred
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the object before obj .
Note
This is only used for drag and drop checks.
Parameters: |
|
---|---|
Return type: |
any |
Returns: |
The object before obj . |
TreeViewFunctions.
GetColumnWidth
(
self
,
root
,
userdata
,
obj
,
col
,
area
)
¶
Called to retrieve the column width of object obj in column col .
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The column width. |
TreeViewFunctions.
GetHeaderColumnWidth
(
self
,
root
,
userdata
,
col
,
area
)
¶
Called to retrieve the width of the header for column col .
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The header column width, or a negative number for auto header width. |
TreeViewFunctions.
GetMinHeaderHeight
(
self
,
root
,
userdata
,
area
)
¶
Called to retrieve the minimum header height.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The minimum header height, or a negative value for auto header height. |
TreeViewFunctions.
GetLineHeight
(
self
,
root
,
userdata
,
obj
,
col
,
area
)
¶
Called to retrieve the line height of object obj in column col . Always return a positive value.
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The line height. |
TreeViewFunctions.
GetColors
(
self
,
root
,
userdata
,
obj
)
¶
Called to specify the text colors of object obj .
Parameters: |
|
---|---|
Return type: |
tuple(int or
|
Returns: |
The normal and selected text color as color ID or vector. |
TreeViewFunctions.
GetBackgroundColor
(
self
,
root
,
userdata
,
obj
,
line
)
¶
Called to specify the background color of line .
Parameters: |
|
---|---|
Return type: |
int or
|
Returns: |
The background color for line as color ID or vector. |
TreeViewFunctions.
DrawCell
(
self
,
root
,
userdata
,
obj
,
col
,
drawinfo
)
¶
Called to draw the cell for object obj in column col into the user area in drawinfo[‘frame’] .
Parameters: |
|
---|---|
Return type: |
int or
|
Returns: |
The background color as color ID or vector. |
TreeViewFunctions.
DrawHeaderCell
(
self
,
root
,
userdata
,
col
,
drawinfo
)
¶
Called to draw the header for column col into the user area in drawinfo[‘frame’] .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the header has been drawn or False if the header should be drawn by the tree view. |
TreeViewFunctions.
IsSelected
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the selection status of object obj .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the object is selected, otherwise False . |
TreeViewFunctions.
Select
(
self
,
root
,
userdata
,
obj
,
mode
)
¶
Called to select object obj .
Parameters: |
|
---|
TreeViewFunctions.
IsOpened
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the folding status of object obj .
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the object is opened, otherwise False . |
TreeViewFunctions.
Open
(
self
,
root
,
userdata
,
obj
,
onoff
)
¶
Called to open or close object obj .
Parameters: |
|
---|
TreeViewFunctions.
GetName
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the name of object obj .
Parameters: |
|
---|---|
Return type: |
str |
Returns: |
The object name. |
TreeViewFunctions.
SetName
(
self
,
root
,
userdata
,
obj
,
str
)
¶
Called to set the name of object obj .
Parameters: |
|
---|
TreeViewFunctions.
GetID
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the ID of object obj .
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The object ID. |
TreeViewFunctions.
IsChecked
(
self
,
root
,
userdata
,
obj
,
lColumn
)
¶
Called to retrieve the checkbox status of object obj for column lColumn .
Parameters: |
|
||||||||
---|---|---|---|---|---|---|---|---|---|
Return type: |
int |
||||||||
Returns: |
A combination of the following flags or c4d.NOTOK to show no checkbox:
|
TreeViewFunctions.
SetCheck
(
self
,
root
,
userdata
,
obj
,
lColumn
,
bCheck
,
bcMsg
)
¶
Called to set the checkbox status of object obj .
Parameters: |
|
---|
TreeViewFunctions.
IsTristate
(
self
,
root
,
userdata
)
¶
Called to retrieve the tristate flag of the tree.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the tristate flag is set, otherwise False . |
TreeViewFunctions.
GetDragType
(
self
,
root
,
userdata
,
obj
)
¶
Called to retrieve the drag type of object obj , i.e. the type that the user would get if he started a drag in that cell.
Parameters: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
int |
||||||||||||||||||||||||
Returns: |
The object drag type, or c4d.NOTOK to disable drag-and-drop:
|
TreeViewFunctions.
AcceptDragObject
(
self
,
root
,
userdata
,
obj
,
dragtype
,
dragobject
)
¶
Called to check if object obj can accept the specified drag-and-drop action, and in that case what the result would be.
Note
If obj is None then dragobject should be inserted as a child of the root.
Parameters: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
tuple(int, bool) |
||||||||||||||||||||||||
Returns: |
A tuple with the following information: int: The insert mode:
bool: True if copying is allowed to this position, otherwise False . |
TreeViewFunctions.
GenerateDragArray
(
self
,
root
,
userdata
,
obj
)
¶
Called to generate a drag array for object obj .
Parameters: |
|
---|---|
Return type: |
list of
|
Returns: |
The drag objects for obj . |
TreeViewFunctions.
DragStart
(
self
,
root
,
userdata
,
obj
)
¶
New in version R19.024.
Called to determine if object obj can be dragged or not and if dragged objects will be selected or not.
Parameters: |
|
||||
---|---|---|---|---|---|
Return type: |
int |
||||
Returns: |
A combination of the following flags:
|
TreeViewFunctions.
SetDragObject
(
self
,
root
,
userdata
,
obj
)
¶
New in version R19.024.
Called to set the drag object to obj .
Note
Helps to determine if dragging happens internally (rearranged items) or externally (dragged items from another treeview for instance).
Parameters: |
|
---|
TreeViewFunctions.
InsertObject
(
self
,
root
,
userdata
,
obj
,
dragtype
,
dragobject
,
insertmode
,
bCopy
)
¶
Called to insert dragobject as specified.
Parameters: |
|
---|
TreeViewFunctions.
CreateContextMenu
(
self
,
root
,
userdata
,
obj
,
lColumn
,
bc
)
¶
Called to build a context menu for object
obj
and column
lColumn
. See
c4d.gui.ShowPopupMenu()
for the format.
Note
bc container already contains 2 default items: c4d.ID_TREEVIEW_CONTEXT_REMOVE and c4d.ID_TREEVIEW_CONTEXT_RESET . These may be removed. The added menu entry IDs must be larger than c4d.ID_TREEVIEW_FIRST_NEW_ID .Parameters: |
|
---|
TreeViewFunctions.
ContextMenuCall
(
self
,
root
,
userdata
,
obj
,
lColumn
,
lCommand
)
¶
Called by a command in the context menu setup in
CreateContextMenu()
.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the command has been processed and the data needs to be updated, otherwise False . |
TreeViewFunctions.
GetHeaderSortArrow
(
self
,
root
,
userdata
,
lColID
)
¶
Called to retrieve the sort mode of column lColID .
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The sort direction. |
TreeViewFunctions.
IsResizeColAllowed
(
self
,
root
,
userdata
,
lColID
)
¶
Called to check if column lColID can be resized or not.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the column can be resized, otherwise False . |
TreeViewFunctions.
IsMoveColAllowed
(
self
,
root
,
userdata
,
lColID
)
¶
Called to check if column lColID can be moved or not.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the column can be moved, otherwise False . |
TreeViewFunctions.
InputEvent
(
self
,
root
,
userdata
,
pArea
,
msg
)
¶
Called when an input event is received. All information about the input event is stored in the msg container.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the event was handled, otherwise False . |
TreeViewFunctions.
MouseDown
(
self
,
root
,
userdata
,
obj
,
col
,
mouseinfo
,
rightButton
)
¶
Called when a mouse down event is received.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the event was handled, otherwise False . |
TreeViewFunctions.
DoubleClick
(
self
,
root
,
userdata
,
obj
,
col
,
mouseinfo
)
¶
Called when a mouse double click event is received.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the event was handled, otherwise False . |
TreeViewFunctions.
DeletePressed
(
self
,
root
,
userdata
)
¶
Called when a delete event is received.
Parameters: |
|
---|
TreeViewFunctions.
HeaderClick
(
self
,
root
,
userdata
,
lColID
,
lChannel
,
bDblClk
)
¶
Called when a header has been clicked.
Parameters: |
|
||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Return type: |
bool |
||||||||||||||
Returns: |
True if the tree view needs to be updated, otherwise False . |
TreeViewFunctions.
Scrolled
(
self
,
root
,
userdata
,
h
,
v
,
x
,
y
)
¶
Called when the tree view has been scrolled.
Parameters: |
|
---|
TreeViewFunctions.
PaintFinished
(
self
,
root
,
userdata
)
¶
Called when a paint selection has been performed in the tree view.
Parameters: |
|
---|
TreeViewFunctions.
SelectionChanged
(
self
,
root
,
userdata
)
¶
Called when selection has changed.
Parameters: |
|
---|
bgCol int or c4d.Vector
The background color ID or vector. frame c4d.gui.GeUserArea
The user area to draw in. xpos int The position X coordinate. ypos int The position Y coordinate. width int The width. height int The height. line int The line. col int The column.
mx float The mouse X coordinate. my float The mouse Y coordinate. button int The mouse button:
MOUSEINFO_BUTTON_LEFT Left button. MOUSEINFO_BUTTON_RIGHT Right button. MOUSEINFO_BUTTON_MIDDLE Middle button.
mxRelative float The mouse position relative to the end of the horizontal tree lines. Usually mouse coordinates are in list view space. This can become difficult when the user clicks into the LV_USERTREE column, hence this member.
startDrag bool Not used. startpaint bool This is needed in the Layer Manager. The user can change the state of the column by clicking somewhere and dragging the mouse. To start this drag, set startpaint to True inTreeViewFunctions.MouseDown()
.
inpaint bool This is needed in the Layer Manager. The user can change the state of the column by clicking somewhere and dragging the mouse.TreeViewFunctions.MouseDown()
will be called for each line with inpaint set to True .
inputmsg c4d.BaseContainer
The container originally sent to the GeUserArea.InputEvent()
of the tree view’s user area. Never None .frame c4d.gui.GeUserArea
The user area to draw in. xpos int The position X coordinate. ypos int The position Y coordinate. width int The width. height int The height. line int The line. col int The column.