Package wx :: Package lib :: Module foldpanelbar :: Class FoldPanelBar
[frames | no frames]

Type FoldPanelBar

object --+                
         |                
    Object --+            
             |            
    EvtHandler --+        
                 |        
            Window --+    
                     |    
                 Panel --+
                         |
                        FoldPanelBar


Method Summary
  __init__(self, parent, id, pos, size, style, extraStyle)
Default Class Constructor.
  AddFoldPanel(self, caption, collapsed, foldIcons, cbstyle)
Adds a fold panel to the list of panels.
  AddFoldPanelSeparator(self, panel, colour, Spacing, leftSpacing, rightSpacing)
Adds a separator line to the current FoldPanel.
  AddFoldPanelWindow(self, panel, window, flags, Spacing, leftSpacing, rightSpacing)
Adds a wxWindow derived class to the referenced FoldPanel.
  ApplyCaptionStyle(self, foldpanel, cbstyle)
Sets the style of the caption bar (called CaptionBar) of the FoldPanel.
  ApplyCaptionStyleAll(self, cbstyle)
Sets the style of all the caption bars of the FoldPanel.
  Collapse(self, foldpanel)
Collapses the given FoldPanel reference, and updates the foldpanel bar.
  Expand(self, foldpanel)
Expands the given FoldPanel reference, and updates the foldpanel bar.
  GetCaptionStyle(self, foldpanel)
Returns the currently used caption style for the FoldPanel.
  GetCount(self)
Returns the number of panels in the FoldPanelBar.
  GetFoldPanel(self, item)
Returns the panel associated with the index "item".
  GetPanelsLength(self, collapsed, expanded)
Returns the length of the panels that are expanded and collapsed.
  IsVertical(self)
Returns wether the CaptionBar Has Default Orientation Or Not.
  OnPressCaption(self, event)
Handles the EVT_CAPTIONBAR event in the FoldPanelBar.
  OnSizePanel(self, event)
Handles the EVT_SIZE method for the FoldPanelBar.
  RedisplayFoldPanelItems(self)
Resizes the fold panels so they match the width.
  RefreshPanelsFrom(self, item)
Refreshes all the panels from given index down to last one.
  RepositionCollapsedToBottom(self)
Repositions all the collapsed panels to the bottom.

Class Variable Summary
CaptionBarStyle EmptyCaptionBarStyle = <wx.lib.foldpanelbar.CaptionBarSt...

Instance Method Details

__init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=2621440, extraStyle=0)
(Constructor)

Default Class Constructor.
Overrides:
wx.Panel.__init__

AddFoldPanel(self, caption='', collapsed=False, foldIcons=None, cbstyle=<wx.lib.foldpanelbar.CaptionBarStyle instance at 0x40694dcc>)

Adds a fold panel to the list of panels.

If the flag collapsed is set to True, the panel is collapsed initially. 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. Please consult FoldPanelBar.AddFoldPanelWindow() and FoldPanelBar.AddFoldPanelSeparator() to know how to add wxWindow items to the panels.

AddFoldPanelSeparator(self, panel, colour=wxPython wrapper for UNBORN object! (The C++ object is no..., Spacing=8, leftSpacing=2, rightSpacing=2)

Adds a separator line to the current FoldPanel.

The seperator 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. The colour is adjustable, and it takes the same Spacing, leftSpacing and rightSpacing as AddFoldPanelWindow().

AddFoldPanelWindow(self, panel, window, flags=1, Spacing=8, leftSpacing=2, rightSpacing=2)

Adds a wxWindow derived class to the referenced FoldPanel.

IMPORTANT: Make the to be created window, child of the FoldPanel. See
example that follows. The flags to be used are:
    - FPB_ALIGN_WIDTH: Which means the wxWindow 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: Alligns left instead of fitting the width of
      the child window to be added. Use either this one or
      FPB_ALIGN_WIDTH.

The wxWindow to be added can be slightly indented from left and right
so it is more visibly placed in the FoldPanel. Use Spacing > 0 to give
the control an y offset from the previous wxWindow added, use leftSpacing
to give it a slight indent from the left, and rightSpacing also reserves
a little space on the right so the wxWindow can be properly placed in
the FoldPanel.

The following example adds a FoldPanel to the FoldPanelBar and adds two
wxWindow derived controls to the FoldPanel:

# CODE

    # create the FoldPanelBar
    >>> m_pnl = FoldPanelBar(self, wx.ID_ANY, wx.DefaultPosition,
                             wx.DefaultSize, FPB_DEFAULT_STYLE,
                             FPB_COLLAPSE_TO_BOTTOM)

    # 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 color 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)

# ENDCODE

ApplyCaptionStyle(self, foldpanel, cbstyle)

Sets the style of the caption bar (called CaptionBar) of the FoldPanel.

The changes are applied immediately. All styles not set in the CaptionBarStyle class are not applied. Use the CaptionBar reference to indicate what captionbar you want to apply the style to. To apply one style to all CaptionBar items, use ApplyCaptionStyleAll()

ApplyCaptionStyleAll(self, cbstyle)

Sets the style of all the caption bars of the FoldPanel.

The changes are applied immediately.

Collapse(self, foldpanel)

Collapses the given FoldPanel reference, and updates the foldpanel bar.

In the FPB_COLLAPSE_TO_BOTTOM style, all collapsed captions are put at the bottom of the control. In the normal mode, they stay where they are.

Expand(self, foldpanel)

Expands the given FoldPanel reference, and updates the foldpanel bar.

In the FPB_COLLAPSE_TO_BOTTOM style, they will be removed from the bottom and the order where the panel originally was placed is restored.

GetCaptionStyle(self, foldpanel)

Returns the currently used caption style for the FoldPanel.

It is returned as a CaptionBarStyle class. After modifying it, it can be set again.

GetCount(self)

Returns the number of panels in the FoldPanelBar.

GetFoldPanel(self, item)

Returns the panel associated with the index "item".

See the example at the bottom of the module, especially the events for the "Collapse Me" and "Expand Me" buttons.

GetPanelsLength(self, collapsed, expanded)

Returns the length of the panels that are expanded and collapsed.

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.

IsVertical(self)

Returns wether the CaptionBar Has Default Orientation Or Not.

Default is vertical.

OnPressCaption(self, event)

Handles the EVT_CAPTIONBAR event in the FoldPanelBar.

OnSizePanel(self, event)

Handles the EVT_SIZE method for the FoldPanelBar.

RedisplayFoldPanelItems(self)

Resizes the fold panels so they match the width.

RefreshPanelsFrom(self, item)

Refreshes all the panels from given index down to last one.

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. The Rect holds the slack area left between last repositioned panel and the bottom panels. This needs to get a refresh.


Class Variable Details

EmptyCaptionBarStyle

Type:
CaptionBarStyle
Value:
<wx.lib.foldpanelbar.CaptionBarStyle instance at 0x40694dcc>           

Generated by Epydoc 2.1.20040428.rpd on Tue Apr 26 14:25:17 2005 http://epydoc.sf.net