AGW Logo

agw_title 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 wx.Panel derived class.

hierarchy Inheritance Diagram

Inheritance diagram for: FoldPanelItem

Inheritance diagram of FoldPanelItem


method_summary Methods Summary

__init__Default class constructor.
AddSeparatorAdds a separator item to the list of items on this panel.
AddWindowAdds a window item to the list of items on this panel.
ApplyCaptionStyleApplies the style defined in cbstyle to the CaptionBar.
CollapseInternal method.
ExpandInternal method.
GetCaptionLengthReturns height of caption only.
GetCaptionStyleReturns the current style of the captionbar in a CaptionBarStyle class.
GetItemPosReturns item’s position.
GetPanelLengthReturns size of panel.
IsExpandedReturns expanded or collapsed status.
IsVerticalReturns whether the CaptionBar has default orientation or not.
OnPaintHandles the wx.EVT_PAINT event for FoldPanelItem.
OnPressCaptionHandles the wx.EVT_CAPTIONBAR event for FoldPanelItem.
RepositionRepositions this FoldPanelItem and reports the length occupied
ResizePanelResizes the panel.

API Class API

class FoldPanelItem(wx.Panel)[source]

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 wx.Panel derived class.



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

Default class constructor.

Parameters:
  • parent – the FoldPanelItem parent window;
  • id – an identifier for the control: a value of -1 is taken to mean a default;
  • caption – the string to be displayed in CaptionBar;
  • foldIcons – an instance of wx.ImageList containing the icons to display next to the caption text;
  • collapsedTrue if the CaptionBar should start in the collapsed state, False otherwise;
  • cbstyle – the CaptionBar window style. Must be an instance of CaptionBarStyle.


AddSeparator(colour=wx.BLACK, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTSPACING, rightSpacing=FPB_DEFAULT_RIGHTSPACING)[source]

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(window, flags=FPB_ALIGN_WIDTH, spacing=FPB_DEFAULT_SPACING, leftSpacing=FPB_DEFAULT_LEFTLINESPACING, rightSpacing=FPB_DEFAULT_RIGHTLINESPACING)[source]

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(cbstyle)[source]

Applies the style defined in cbstyle to the CaptionBar.



Collapse()[source]

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()[source]

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()[source]

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



GetCaptionStyle()[source]

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

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



GetItemPos()[source]

Returns item’s position.



GetPanelLength()[source]

Returns size of panel.



IsExpanded()[source]

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



IsVertical()[source]

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



OnPaint(event)[source]

Handles the wx.EVT_PAINT event for FoldPanelItem.

Parameters:event – a wx.PaintEvent event to be processed.


OnPressCaption(event)[source]

Handles the wx.EVT_CAPTIONBAR event for FoldPanelItem.

Parameters:event – a CaptionBarEvent event to be processed.


Reposition(pos)[source]

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

Parameters:pos – the new item position.


ResizePanel()[source]

Resizes the panel.

Tree

Table Of Contents

Previous topic

FoldPanelBar

Next topic

FoldWindowItem