File: wx.lib.agw.foldpanelbar.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (194 lines) | stat: -rw-r--r-- 7,342 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.agw.foldpanelbar

.. currentmodule:: wx.lib.agw.foldpanelbar

.. highlight:: python



.. _wx.lib.agw.foldpanelbar:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.foldpanelbar**
==========================================================================================================================================

:class:`~wx.lib.agw.foldpanelbar.FoldPanelBar` is a control that contains multiple panels, which can be expanded
or collapsed.


Description
===========

The :class:`FoldPanelBar` is a control that contains multiple panels (of type
:class:`FoldPanelItem`) that can be expanded or collapsed. The captionbar of
the :class:`FoldPanelBar` can be customized by setting it to a horizontal gradient
style, vertical gradient style, a single colour, a rectangle or filled
rectangle. The `FoldPanel` items can be collapsed in place or to the
bottom of the control. :class:`wx.Window` derived controls can be added
dynamically, and separated by separator lines.


How does it work
----------------

The internals of the :class:`FoldPanelBar` is a list of :class:`FoldPanelItem` objects. Through
the reference of `FoldPanel` these panels can be controlled by adding new controls
to a FoldPanel or adding new FoldPanels to the :class:`FoldPanelBar`.

The :class:`CaptionBar` fires events to the parent (container of all panel items) when a
sub-panel needs resizing (either folding or expanding). The fold or expand process
is simply a resize of the panel so it looks like all controls on it are gone. All
controls are still child of the `FoldPanel` they are located on. If they don't
handle the event (and they won't) then the owner of the :class:`FoldPanelBar` gets the
events.

This is what you need to handle the controls. There isn't much to it just
a lot of calculations to see what panel belongs where. There are no sizers
involved in the panels, everything is purely x-y positioning.


What can it do and what not?
----------------------------

a) What it can do:

   * Run-time addition of panels (no deletion just yet);
   * Run time addition of controls to the panel (it will be resized accordingly);
   * Creating panels in collapsed mode or expanded mode;
   * Various modes of caption behaviour and filling to make it more appealing;
   * Panels can be folded and collapsed (or all of them) to allow more space.

b) What it cannot do:

   * Selection of a panel like in a listctrl;
   * Dragging and dropping the panels;
   * Re-ordering the panels (not yet).


Usage
=====

Usage example::

    import wx
    import wx.lib.agw.foldpanelbar as fpb

    class MyFrame(wx.Frame):

        def __init__(self, parent):

            wx.Frame.__init__(self, parent, -1, "FoldPanelBar Demo")

            text_ctrl = wx.TextCtrl(self, -1, size=(400, 100), style=wx.TE_MULTILINE)

            panel_bar = fpb.FoldPanelBar(self, -1, agwStyle=fpb.FPB_VERTICAL)

            fold_panel = panel_bar.AddFoldPanel("Thing")
            thing = wx.TextCtrl(fold_panel, -1, size=(400, -1), style=wx.TE_MULTILINE)

            panel_bar.AddFoldPanelWindow(fold_panel, thing)

            main_sizer = wx.BoxSizer(wx.VERTICAL)
            main_sizer.Add(text_ctrl, 1, wx.EXPAND)
            main_sizer.Add(panel_bar, 1, wx.EXPAND)
            self.SetSizer(main_sizer)


    # our normal wxApp-derived class, as usual

    app = wx.App(0)

    frame = MyFrame(None)
    app.SetTopWindow(frame)
    frame.Show()

    app.MainLoop()



Supported Platforms
===================

:class:`FoldPanelBar` is supported on the following platforms:
  * Windows (Verified on Windows XP, 2000)
  * Linux/Unix (GTK2) (Thanks to Toni Brkic and Robin Dunn)
  * Mac OSX (Thanks to Robin Dunn for the :class:`CaptionBar` size patch)


Window Styles
=============

This class supports the following window styles:

========================== =========== ==================================================
Window Styles              Hex Value   Description
========================== =========== ==================================================
``FPB_SINGLE_FOLD``                0x1 Single fold forces other panels to close when they are open, and only opens the current panel. This will allow the open panel to gain the full size left in the client area.
``FPB_COLLAPSE_TO_BOTTOM``         0x2 All panels are stacked to the bottom. When they are expanded again they show up at the top.
``FPB_EXCLUSIVE_FOLD``             0x4 ``FPB_SINGLE_FOLD`` style plus the panels will be stacked at the bottom.
``FPB_HORIZONTAL``                 0x8 :class:`FoldPanelBar` will be horizontal.
``FPB_VERTICAL``                  0x10 :class:`FoldPanelBar` will be vertical.
========================== =========== ==================================================


Events Processing
=================

This class processes the following events:

================== ==================================================
Event Name         Description
================== ==================================================
``EVT_CAPTIONBAR`` The user has pressed the caption bar: :class:`FoldPanelBar` will either expand or collapse the underlying panel.
================== ==================================================


License And Version
===================

:class:`FoldPanelBar` is distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 16 Jul 2012, 15.00 GMT

Version 0.6


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.agw.foldpanelbar.CaptionBar`                                       This class is a graphical caption component that consists of a
:ref:`~wx.lib.agw.foldpanelbar.CaptionBarEvent`                                  This event will be sent when a ``EVT_CAPTIONBAR`` is mapped in the parent.
:ref:`~wx.lib.agw.foldpanelbar.CaptionBarStyle`                                  This class encapsulates the styles you wish to set for the
:ref:`~wx.lib.agw.foldpanelbar.FoldPanelBar`                                     The :class:`FoldPanelBar` is a class which can maintain a list of
:ref:`~wx.lib.agw.foldpanelbar.FoldPanelItem`                                    This class is a child sibling of the :class:`FoldPanelBar` class. It will
:ref:`~wx.lib.agw.foldpanelbar.FoldWindowItem`                                   This class is a child sibling of the :class:`FoldPanelItem` class. It
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.agw.foldpanelbar.CaptionBar
   wx.lib.agw.foldpanelbar.CaptionBarEvent
   wx.lib.agw.foldpanelbar.CaptionBarStyle
   wx.lib.agw.foldpanelbar.FoldPanelBar
   wx.lib.agw.foldpanelbar.FoldPanelItem
   wx.lib.agw.foldpanelbar.FoldWindowItem