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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.agw.foldpanelbar
.. highlight:: python
.. _wx.lib.agw.foldpanelbar.FoldPanelBar:
==========================================================================================================================================
|phoenix_title| **wx.lib.agw.foldpanelbar.FoldPanelBar**
==========================================================================================================================================
The :class:`FoldPanelBar` is a class which can maintain a list of
collapsible panels. Once a panel is collapsed, only it's caption
bar is visible to the user. This will provide more space for the
other panels, or allow the user to close panels which are not used
often to get the most out of the work area.
This control is easy to use. Simply create it as a child for a
panel or sash window, and populate panels with
:meth:`FoldPanelBar.AddFoldPanel() <FoldPanelBar.AddFoldPanel>`. Then use the
:meth:`FoldPanelBar.AddFoldPanelWindow() <FoldPanelBar.AddFoldPanelWindow>` to add
:class:`wx.Window` derived controls to the current fold panel. Use
:meth:`FoldPanelBar.AddFoldPanelSeparator() <FoldPanelBar.AddFoldPanelSeparator>` to put separators between the groups of
controls that need a visual separator to group them
together. After all is constructed, the user can fold the panels
by double clicking on the bar or single click on the arrow, which
will indicate the collapsed or expanded state.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>FoldPanelBar</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.agw.foldpanelbar.FoldPanelBar_inheritance.png" alt="Inheritance diagram of FoldPanelBar" usemap="#dummy" class="inheritance"/></center>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.foldpanelbar.FoldPanelBar.html" title="wx.lib.agw.foldpanelbar.FoldPanelBar" alt="" coords="5,392,269,421"/> <area shape="rect" id="node2" href="wx.Panel.html" title="wx.Panel" alt="" coords="97,315,177,344"/> <area shape="rect" id="node3" href="wx.Window.html" title="wx.Window" alt="" coords="89,237,186,267"/> <area shape="rect" id="node4" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="73,160,202,189"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="79,83,196,112"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="34,5,121,35"/> <area shape="rect" id="node7" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="145,5,252,35"/> </map>
</p>
</div>
|
|appearance| Control Appearance
===============================
|
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.agw.foldpanelbar.foldpanelbar.png
:alt: wxMSW
:figclass: floatleft
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: floatright
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/../no_appearance.png
:alt: wxGTK
:figclass: floatcenter
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Panel`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.__init__` Default class constructor.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.AddFoldPanel` Adds a fold panel to the list of panels.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.AddFoldPanelSeparator` Adds a separator line to the current fold panel.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.AddFoldPanelWindow` Adds a :class:`wx.Window` derived instance to the referenced fold panel.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.ApplyCaptionStyle` Sets the style of the caption bar (:class:`CaptionBar`) of the fold panel.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.ApplyCaptionStyleAll` Sets the style of all the caption bars of the fold panel.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.Collapse` Collapses the given fold panel reference, and updates the foldpanel bar.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.Expand` Expands the given fold panel reference, and updates the foldpanel bar.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.GetCaptionStyle` Returns the currently used caption style for the fold panel.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.GetCount` Returns the number of panels in the :class:`FoldPanelBar`.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.GetFoldPanel` Returns the panel associated with the index `item`.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.GetPanelsLength` Returns the length of the panels that are expanded and
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.IsVertical` Returns whether the :class:`CaptionBar` has default orientation or not.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.OnPressCaption` Handles the ``wx.EVT_CAPTIONBAR`` event for :class:`CaptionBar`.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.OnSizePanel` Handles the ``wx.EVT_SIZE`` event for :class:`FoldPanelBar`.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.RedisplayFoldPanelItems` Resizes the fold panels so they match the width.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.RefreshPanelsFrom` Refreshes all the panels from given one down to last one.
:meth:`~wx.lib.agw.foldpanelbar.FoldPanelBar.RepositionCollapsedToBottom` Repositions all the collapsed panels to the bottom.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: FoldPanelBar(wx.Panel)
The :class:`FoldPanelBar` is a class which can maintain a list of
collapsible panels. Once a panel is collapsed, only it's caption
bar is visible to the user. This will provide more space for the
other panels, or allow the user to close panels which are not used
often to get the most out of the work area.
This control is easy to use. Simply create it as a child for a
panel or sash window, and populate panels with
:meth:`FoldPanelBar.AddFoldPanel() <FoldPanelBar.AddFoldPanel>`. Then use the
:meth:`FoldPanelBar.AddFoldPanelWindow() <FoldPanelBar.AddFoldPanelWindow>` to add
:class:`wx.Window` derived controls to the current fold panel. Use
:meth:`FoldPanelBar.AddFoldPanelSeparator() <FoldPanelBar.AddFoldPanelSeparator>` to put separators between the groups of
controls that need a visual separator to group them
together. After all is constructed, the user can fold the panels
by double clicking on the bar or single click on the arrow, which
will indicate the collapsed or expanded state.
.. method:: __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL|wx.NO_BORDER, agwStyle=0)
Default class constructor.
:param `parent`: the :class:`FoldPanelBar` parent window;
:param `id`: an identifier for the control: a value of -1 is taken to mean a default;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param `style`: the underlying :class:`Panel` window style;
:param `agwStyle`: the AGW-specific :class:`FoldPanelBar` window style. It can be one of the
following bits:
========================== =========== ==================================================
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`` 0x4 :class:`FoldPanelBar` will be horizontal.
``FPB_VERTICAL`` 0x8 :class:`FoldPanelBar` will be vertical.
========================== =========== ==================================================
.. method:: AddFoldPanel(self, caption="", collapsed=False, foldIcons=None, cbstyle=None)
Adds a fold panel to the list of panels.
:param `caption`: the caption to be displayed in the associated :class:`CaptionBar`;
:param `collapsed`: if set to ``True``, the panel is collapsed initially;
:param `foldIcons`: an instance of :class:`wx.ImageList` containing the icons to display
next to the caption text;
:param `cbstyle`: an instance of :class:`CaptionBarStyle`.
:note: The FoldPanel item which is returned, can be used as a reference to perform
actions upon the fold panel like collapsing it, expanding it, or deleting it
from the list. Use this foldpanel to add windows to it.
:see: :meth:`~FoldPanelBar.AddFoldPanelWindow` and :meth:`~FoldPanelBar.AddFoldPanelSeparator` to see how to add
items derived from :class:`wx.Window` to the panels.
.. method:: AddFoldPanelSeparator(self, panel, colour=wx.BLACK, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTLINESPACING, rightSpacing=FPB_DEFAULT_RIGHTLINESPACING)
Adds a separator line to the current fold panel.
The separator is a simple line which is drawn and is no real
component. It can be used to separate groups of controls
which belong to each other.
:param `colour`: the separator colour, an instance of :class:`wx.Colour`;
:param `spacing`: the separator to be added can be slightly indented from
left and right so it is more visibly placed in the fold panel. Use `spacing` > 0
to give the control an y offset from the previous :class:`wx.Window` added;
:param `leftSpacing`: give the added separator a slight indent from the left;
:param `rightSpacing`: give the added separator a slight indent from the right.
.. method:: AddFoldPanelWindow(self, panel, window, flags=FPB_ALIGN_WIDTH, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTLINESPACING, rightSpacing=FPB_DEFAULT_RIGHTLINESPACING)
Adds a :class:`wx.Window` derived instance to the referenced fold panel.
:param `panel`: an instance of :class:`FoldPanelItem`;
:param `window`: the window we wish to add to the fold panel, an instance
of :class:`wx.Window`;
:param `flags`: can be one of the following bits:
====================== ======= ====================================
Align Flag Value Description
====================== ======= ====================================
``FPB_ALIGN_WIDTH`` 1 The :class:`wx.Window` to be added will be aligned to fit the width of the FoldPanel when it is resized. Very handy for sizer items, buttons and text boxes.
``FPB_ALIGN_LEFT`` 0 Aligns left instead of fitting the width of the child window to be added. Use either this one or ``FPB_ALIGN_WIDTH``.
====================== ======= ====================================
:param `spacing`: the :class:`wx.Window` to be added can be slightly indented from
left and right so it is more visibly placed in the fold panel. Use `spacing` > 0
to give the control an y offset from the previous :class:`wx.Window` added;
:param `leftSpacing`: give the :class:`wx.Window` added a slight indent from the left;
:param `rightSpacing`: give the :class:`wx.Window` added a slight indent from the right;
:note: Make the window be a child of the fold panel!
The following example adds a FoldPanel to the :class:`FoldPanelBar` and
adds two :class:`wx.Window` derived controls to the FoldPanel::
# Create the FoldPanelBar
m_pnl = FoldPanelBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, agwStyle=0x2)
# Add a foldpanel to the control. "Test me" is the caption and it is
# initially not collapsed.
item = m_pnl.AddFoldPanel("Test me", False)
# Now add a button to the fold panel. Mind that the button should be
# made child of the FoldPanel and not of the main form.
m_pnl.AddFoldPanelWindow(item, wx.Button(item, ID_COLLAPSEME, "Collapse Me"))
# Add a separator between the two controls. This is purely a visual
# line that can have a certain colour and also the indents and width
# aligning like a control.
m_pnl.AddFoldPanelSeparator(item)
# Now add a text ctrl. Also very easy. Align this on width so that
# when the control gets wider the text control also sizes along.
m_pnl.AddFoldPanelWindow(item, wx.TextCtrl(item, wx.ID_ANY, "Comment"), FPB_ALIGN_WIDTH, FPB_DEFAULT_SPACING, 20)
.. method:: ApplyCaptionStyle(self, foldpanel, cbstyle)
Sets the style of the caption bar (:class:`CaptionBar`) of the fold panel.
:param `foldpanel`: an instance of :class:`FoldPanelItem`;
:param `cbstyle`: an instance of :class:`CaptionBarStyle`.
:note:
The changes are applied immediately. All styles not set in the
:class:`CaptionBarStyle` class are not applied. Use the :class:`CaptionBar` reference
to indicate what captionbar you want to apply the style to. To apply one
style to all :class:`CaptionBar` items, use :meth:`~FoldPanelBar.ApplyCaptionStyleAll`.
.. method:: ApplyCaptionStyleAll(self, cbstyle)
Sets the style of all the caption bars of the fold panel.
The changes are applied immediately.
:param `cbstyle`: an instance of :class:`CaptionBarStyle`.
.. method:: Collapse(self, foldpanel)
Collapses the given fold panel reference, and updates the foldpanel bar.
:param `foldpanel`: an instance of :class:`FoldPanelItem`.
:note: With the ``FPB_COLLAPSE_TO_BOTTOM`` style set, all collapsed captions
are put at the bottom of the control. In the normal mode, they stay where
they are.
.. method:: Expand(self, foldpanel)
Expands the given fold panel reference, and updates the foldpanel bar.
:param `foldpanel`: an instance of :class:`FoldPanelItem`.
:note: With the ``FPB_COLLAPSE_TO_BOTTOM`` style set, they will be removed
from the bottom and the order where the panel originally was placed is
restored.
.. method:: GetCaptionStyle(self, foldpanel)
Returns the currently used caption style for the fold panel.
It is returned as a :class:`CaptionBarStyle` class. After modifying it, it can
be set again.
:param `foldpanel`: an instance of :class:`FoldPanelItem`.
.. method:: GetCount(self)
Returns the number of panels in the :class:`FoldPanelBar`.
.. method:: GetFoldPanel(self, item)
Returns the panel associated with the index `item`.
:param `item`: an integer representing the :class:`FoldPanelItem` in the list of
panels in this :class:`FoldPanelBar`.
.. method:: GetPanelsLength(self, collapsed, expanded)
Returns the length of the panels that are expanded and
collapsed.
:param `collapsed`: the current value of the collapsed panels;
:param `expanded`: the current value of the expanded panels.
:note: This is useful to determine quickly what size is used to display,
and what is left at the bottom (right) to align the collapsed panels.
.. method:: IsVertical(self)
Returns whether the :class:`CaptionBar` has default orientation or not.
Default is vertical.
.. method:: OnPressCaption(self, event)
Handles the ``wx.EVT_CAPTIONBAR`` event for :class:`CaptionBar`.
:param `event`: a :class:`CaptionBarEvent` event to be processed.
.. method:: OnSizePanel(self, event)
Handles the ``wx.EVT_SIZE`` event for :class:`FoldPanelBar`.
:param `event`: a :class:`wx.SizeEvent` event to be processed.
.. method:: RedisplayFoldPanelItems(self)
Resizes the fold panels so they match the width.
.. method:: RefreshPanelsFrom(self, item)
Refreshes all the panels from given one down to last one.
:param `item`: the first :class:`FoldPanelItem` to be refreshed.
.. method:: RepositionCollapsedToBottom(self)
Repositions all the collapsed panels to the bottom.
When it is not possible to align them to the bottom, stick them behind
the visible panels.
|