# wx.lib.agw.foldpanelbar.FoldPanelItem¶

This class is a child sibling of the FoldPanelBar class. It will contain a CaptionBar class for receiving of events, and a the rest of the area can be populated by a Panel derived class.

## Class Hierarchy¶

Inheritance diagram for class FoldPanelItem:

## Known Superclasses¶

wx.Panel

## Methods Summary¶

 __init__ Default class constructor. AddSeparator Adds a separator item to the list of items on this panel. AddWindow Adds a window item to the list of items on this panel. ApplyCaptionStyle Applies the style defined in cbstyle to the CaptionBar. Collapse Internal method. Expand Internal method. GetCaptionLength Returns height of caption only. This is for folding calculation purposes. GetCaptionStyle Returns the current style of the captionbar in a CaptionBarStyle class. GetItemPos Returns item’s position. GetPanelLength Returns size of panel. IsExpanded Returns expanded or collapsed status. If the panel is IsVertical Returns whether the CaptionBar has default orientation or not. OnPaint Handles the wx.EVT_PAINT event for FoldPanelItem. OnPressCaption Handles the wx.EVT_CAPTIONBAR event for FoldPanelItem. Reposition Repositions this FoldPanelItem and reports the length occupied ResizePanel Resizes the panel.

## Class API¶

class FoldPanelItem(wx.Panel)

This class is a child sibling of the FoldPanelBar class. It will contain a CaptionBar class for receiving of events, and a the rest of the area can be populated by a Panel derived class.

### Methods¶

__init__(self, parent, id=wx.ID_ANY, caption="", foldIcons=None, collapsed=False, cbstyle=None)

Default class constructor.

Parameters

AddSeparator(self, colour=wx.BLACK, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTSPACING, rightSpacing=FPB_DEFAULT_RIGHTSPACING)

Adds a separator item to the list of items on this panel.

Parameters
• colour – the separator colour, an instance of wx.Colour;

• 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 wx.Window added;

• leftSpacing – give the added separator a slight indent from the left;

• rightSpacing – give the added separator a slight indent from the right.

AddWindow(self, window, flags=FPB_ALIGN_WIDTH, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTLINESPACING, rightSpacing=FPB_DEFAULT_RIGHTLINESPACING)

Adds a window item to the list of items on this panel.

Parameters
• window – an instance of wx.Window;

• flags – can be one of the following bits:

Align Flag

Value

Description

FPB_ALIGN_WIDTH

1

The 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.

• spacing – reserves a number of pixels before the window element;

• leftSpacing – an indent, in pixels;

• rightSpacing – a right spacing, only relevant when the style FPB_ALIGN_WIDTH is chosen.

ApplyCaptionStyle(self, cbstyle)

Applies the style defined in cbstyle to the CaptionBar.

Collapse(self)

Internal method.

This should not be called by the user, because it doesn’t trigger the parent to tell it that we are collapsed or expanded, it only changes visual state.

Expand(self)

Internal method.

This should not be called by the user, because it doesn’t trigger the parent to tell it that we are collapsed or expanded, it only changes visual state.

GetCaptionLength(self)

Returns height of caption only. This is for folding calculation purposes.

GetCaptionStyle(self)

Returns the current style of the captionbar in a CaptionBarStyle class.

This can be used to change and set back the changes.

GetItemPos(self)

Returns item’s position.

GetPanelLength(self)

Returns size of panel.

IsExpanded(self)

Returns expanded or collapsed status. If the panel is expanded, True is returned.

IsVertical(self)

Returns whether the CaptionBar has default orientation or not. Default is vertical.

OnPaint(self, event)

Handles the wx.EVT_PAINT event for FoldPanelItem.

Parameters

event – a PaintEvent event to be processed.

OnPressCaption(self, event)

Handles the wx.EVT_CAPTIONBAR event for FoldPanelItem.

Parameters

event – a CaptionBarEvent event to be processed.

Reposition(self, pos)

Repositions this FoldPanelItem and reports the length occupied for the next FoldPanelItem in the list.

Parameters

pos – the new item position.

ResizePanel(self)

Resizes the panel.