The 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 AddFoldPanel. Then use the AddFoldPanelWindow to add wx.Window derived controls to the current fold panel. Use 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.
__init__ | Default class constructor. |
AddFoldPanel | Adds a fold panel to the list of panels. |
AddFoldPanelSeparator | Adds a separator line to the current fold panel. |
AddFoldPanelWindow | Adds a wx.Window derived instance to the referenced fold panel. |
ApplyCaptionStyle | Sets the style of the caption bar (CaptionBar) of the fold panel. |
ApplyCaptionStyleAll | Sets the style of all the caption bars of the fold panel. |
Collapse | Collapses the given fold panel reference, and updates the foldpanel bar. |
Expand | Expands the given fold panel reference, and updates the foldpanel bar. |
GetCaptionStyle | Returns the currently used caption style for the fold panel. |
GetCount | Returns the number of panels in the FoldPanelBar. |
GetFoldPanel | Returns the panel associated with the index item. |
GetPanelsLength | Returns the length of the panels that are expanded and collapsed. |
IsVertical | Returns whether the CaptionBar has default orientation or not. |
OnPressCaption | Handles the wx.EVT_CAPTIONBAR event for CaptionBar. |
OnSizePanel | Handles the wx.EVT_SIZE event for FoldPanelBar. |
RedisplayFoldPanelItems | Resizes the fold panels so they match the width. |
RefreshPanelsFrom | Refreshes all the panels from given one down to last one. |
RepositionCollapsedToBottom | Repositions all the collapsed panels to the bottom. |
The 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 FoldPanelBar.AddFoldPanel(). Then use the FoldPanelBar.AddFoldPanelWindow() to add wx.Window derived controls to the current fold panel. Use 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.
Default class constructor.
Parameters: |
|
---|
Adds a fold panel to the list of panels.
Parameters: |
|
---|
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 also
AddFoldPanelWindow and AddFoldPanelSeparator to see how to add items derived from wx.Window to the panels.
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.
Parameters: |
|
---|
Adds a wx.Window derived instance to the referenced fold panel.
Parameters: |
|
---|
Note
Make the window be a child of the fold panel!
The following example adds a FoldPanel to the FoldPanelBar and adds two 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)
Sets the style of the caption bar (CaptionBar) of the fold panel.
Parameters: |
|
---|
Note
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.
Sets the style of all the caption bars of the fold panel. The changes are applied immediately.
Parameters: | cbstyle – an instance of CaptionBarStyle. |
---|
Collapses the given fold panel reference, and updates the foldpanel bar.
Parameters: | foldpanel – an instance of 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.
Expands the given fold panel reference, and updates the foldpanel bar.
Parameters: | foldpanel – an instance of 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.
Returns the currently used caption style for the fold panel.
It is returned as a CaptionBarStyle class. After modifying it, it can be set again.
Parameters: | foldpanel – an instance of FoldPanelItem. |
---|
Returns the number of panels in the FoldPanelBar.
Returns the panel associated with the index item.
Parameters: | item – an integer representing the FoldPanelItem in the list of panels in this FoldPanelBar. |
---|
Returns the length of the panels that are expanded and collapsed.
Parameters: |
|
---|
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.
Returns whether the CaptionBar has default orientation or not. Default is vertical.
Handles the wx.EVT_CAPTIONBAR event for CaptionBar.
Parameters: | event – a CaptionBarEvent event to be processed. |
---|
Handles the wx.EVT_SIZE event for FoldPanelBar.
Parameters: | event – a wx.SizeEvent event to be processed. |
---|
Refreshes all the panels from given one down to last one.
Parameters: | item – the first FoldPanelItem to be refreshed. |
---|