File: treelistctrl.py

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (87 lines) | stat: -rw-r--r-- 3,195 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

#
#  **** THIS IS STILL A WIP ****
#

#----------------------------------------------------------------------
# Name:        wx.lib.gizmos.treelistctrl
# Purpose:     A simple derivation from wx.lib.agw.hypertreelist.HyperTreeListCtrl
#              to provide a class that is mostly compatible with the
#              TreeListCtrl class from the old gizmos module and the
#              wxCode library.
#
# Author:      Robin Dunn
#
# Created:     16-Nov-2017
# Copyright:   (c) 2017-2020 by Total Control Software
# Licence:     wxWindows license
# Tags:
#----------------------------------------------------------------------
"""
A generic widget that combines the multicolumn features of a :class:`wx.ListCtrl`
with the hierarchical features of a :class:`wx.TreeCtrl`.

This implementation is based on :class:`~wx.lib.agw.hypertreelist.HyperTreeList`
"""

import wx
import wx.lib.agw.hypertreelist as HTL


#--------------------------------------------------------------------------
# Styles and flags
#
# Most of these are the same as what's in the wx module, but a few are
# specific to HyperTreeList so replicate them all here so they are easier to
# find and use.

TREE_HITTEST_ONITEMCOLUMN = HTL.TREE_HITTEST_ONITEMCOLUMN
TREE_HITTEST_ONITEMCHECKICON = HTL.TREE_HITTEST_ONITEMCHECKICON

TR_DEFAULT_STYLE = HTL.TR_DEFAULT_STYLE
TR_NO_BUTTONS = HTL.TR_NO_BUTTONS
TR_HAS_BUTTONS = HTL.TR_HAS_BUTTONS
TR_NO_LINES = HTL.TR_NO_LINES
TR_LINES_AT_ROOT = HTL.TR_LINES_AT_ROOT
TR_TWIST_BUTTONS = HTL.TR_TWIST_BUTTONS
TR_SINGLE = HTL.TR_SINGLE
TR_MULTIPLE = HTL.TR_MULTIPLE
TR_EXTENDED = HTL.TR_EXTENDED
TR_HAS_VARIABLE_ROW_HEIGHT = HTL.TR_HAS_VARIABLE_ROW_HEIGHT
TR_EDIT_LABELS = HTL.TR_EDIT_LABELS
TR_COLUMN_LINES = HTL.TR_COLUMN_LINES
TR_ROW_LINES = HTL.TR_ROW_LINES
TR_HIDE_ROOT = HTL.TR_HIDE_ROOT
TR_FULL_ROW_HIGHLIGHT = HTL.TR_FULL_ROW_HIGHLIGHT
TR_AUTO_CHECK_CHILD = HTL.TR_AUTO_CHECK_CHILD
TR_AUTO_TOGGLE_CHILD = HTL.TR_AUTO_TOGGLE_CHILD
TR_AUTO_CHECK_PARENT = HTL.TR_AUTO_CHECK_PARENT
TR_ALIGN_WINDOWS = HTL.TR_ALIGN_WINDOWS
TR_ELLIPSIZE_LONG_ITEMS = HTL.TR_ELLIPSIZE_LONG_ITEMS
TR_VIRTUAL = HTL.TR_VIRTUAL
TR_NO_HEADER = HTL.TR_NO_HEADER
LIST_AUTOSIZE_CONTENT_OR_HEADER = HTL.LIST_AUTOSIZE_CONTENT_OR_HEADER



#--------------------------------------------------------------------------

class TreeListCtrl(HTL.HyperTreeList):
    """
    See documentation for :class:`~wx.lib.agw.hypertreelist.HyperTreeList` and
    :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl`. This class is just a
    simple derivation of the former in order to provide a mostly compatible
    class to replace the C++ TreeListCtrl class in Classic, and most
    CustomTreeCtrl methods are available here as well via monkey-patched
    delegates.
    """
    def __init__(self, parent, id=wx.ID_ANY,
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=0, agwStyle=wx.TR_DEFAULT_STYLE,
                 validator=wx.DefaultValidator, name="treelistctrl"):
        super(TreeListCtrl, self).__init__(parent, id, pos, size, style,
                                           agwStyle, validator, name)



#-------------------------------------------------------------------------