Version: 2.9.4
Public Member Functions
wxCollapsiblePane Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/collpane.h>

Inheritance diagram for wxCollapsiblePane:

Detailed Description

A collapsible pane is a container with an embedded button-like control which can be used by the user to collapse or expand the pane's contents.

Once constructed you should use the GetPane() function to access the pane and add your controls inside it (i.e. use the returned pointer from GetPane() as parent for the controls which must go in the pane, not the wxCollapsiblePane itself!).

Note that because of its nature of control which can dynamically (and drastically) change its size at run-time under user-input, when putting wxCollapsiblePane inside a wxSizer you should be careful to add it with a proportion value of zero; this is because otherwise all other windows with non-null proportion values will automatically resize each time the user expands or collapse the pane window usually resulting in a weird, flickering effect.

Usage sample:

    wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, "Details:");

    // add the pane with a zero proportion value to the 'sz' sizer which contains it
    sz->Add(collpane, 0, wxGROW|wxALL, 5);

    // now add a test label in the collapsible pane using a sizer to layout it:
    wxWindow *win = collpane->GetPane();
    wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
    paneSz->Add(new wxStaticText(win, wxID_ANY, "test!"), 1, wxGROW|wxALL, 2);
    win->SetSizer(paneSz);
    paneSz->SetSizeHints(win);

It is only available if wxUSE_COLLPANE is set to 1 (the default).

Styles

This class supports the following styles:

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCollapsiblePaneEvent& event) or void handlerFuncName(wxNavigationKeyEvent& event)

Event macros for events emitted by this class:

Library:  wxCore
Category:  Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance
参照:
wxPanel, wxCollapsiblePaneEvent

Public Member Functions

 wxCollapsiblePane ()
 Default constructor.
 wxCollapsiblePane (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCP_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxCollapsiblePaneNameStr)
 Initializes the object and calls Create() with all the parameters.
bool Create (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCP_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxCollapsiblePaneNameStr)
virtual void Collapse (bool collapse=true)
 Collapses or expands the pane window.
void Expand ()
 Same as calling Collapse(false).
virtual wxWindowGetPane () const
 Returns a pointer to the pane window.
virtual bool IsCollapsed () const
 Returns true if the pane window is currently hidden.
bool IsExpanded () const
 Returns true if the pane window is currently shown.

List of all members.


Constructor & Destructor Documentation

wxCollapsiblePane::wxCollapsiblePane ( )

Default constructor.

wxCollapsiblePane::wxCollapsiblePane ( wxWindow parent,
wxWindowID  id,
const wxString label,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxCP_DEFAULT_STYLE,
const wxValidator validator = wxDefaultValidator,
const wxString name = wxCollapsiblePaneNameStr 
)

Initializes the object and calls Create() with all the parameters.


Member Function Documentation

virtual void wxCollapsiblePane::Collapse ( bool  collapse = true) [virtual]

Collapses or expands the pane window.

bool wxCollapsiblePane::Create ( wxWindow parent,
wxWindowID  id,
const wxString label,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxCP_DEFAULT_STYLE,
const wxValidator validator = wxDefaultValidator,
const wxString name = wxCollapsiblePaneNameStr 
)
Parameters:
parentParent window, must not be non-NULL.
idThe identifier for the control.
labelThe initial label shown in the button which allows the user to expand or collapse the pane window.
posInitial position.
sizeInitial size.
styleThe window style, see wxCP_* flags.
validatorValidator which can be used for additional date checks.
nameControl name.
Returns:
true if the control was successfully created or false if creation failed.
void wxCollapsiblePane::Expand ( )

Same as calling Collapse(false).

virtual wxWindow* wxCollapsiblePane::GetPane ( ) const [virtual]

Returns a pointer to the pane window.

Add controls to the returned wxWindow to make them collapsible.

virtual bool wxCollapsiblePane::IsCollapsed ( ) const [virtual]

Returns true if the pane window is currently hidden.

bool wxCollapsiblePane::IsExpanded ( ) const

Returns true if the pane window is currently shown.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines