2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: collpane.h
|
|
|
|
// Purpose: documentation for wxCollapsiblePaneEvent class
|
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCollapsiblePaneEvent
|
|
|
|
@wxheader{collpane.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This event class is used for the events generated by
|
|
|
|
wxCollapsiblePane.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{FIXME}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@seealso
|
|
|
|
wxCollapsiblePane
|
|
|
|
*/
|
|
|
|
class wxCollapsiblePaneEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxCollapsiblePaneEvent(wxObject* generator, int id,
|
2008-03-08 13:52:38 +00:00
|
|
|
bool collapsed);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane has been collapsed.
|
|
|
|
*/
|
|
|
|
bool GetCollapsed();
|
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Sets this as a collapsed pane event (if @a collapsed is @true) or as an
|
2008-03-08 13:52:38 +00:00
|
|
|
expanded
|
2008-03-09 12:33:59 +00:00
|
|
|
pane event (if @a collapsed is @false).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void SetCollapsed(bool collapsed);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCollapsiblePane
|
|
|
|
@wxheader{collpane.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Once constructed you should use the wxCollapsiblePane::GetPane
|
|
|
|
function to access the pane and add your controls inside it (i.e. use the
|
|
|
|
wxCollapsiblePane::GetPane's returned pointer as parent for the
|
|
|
|
controls which must go in the pane, NOT the wxCollapsiblePane itself!).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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
|
|
|
|
would automatically get resized each time the user expands or collapse the pane
|
|
|
|
window
|
|
|
|
resulting usually in a weird, flickering effect.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Usage sample:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
|
|
|
wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY,
|
|
|
|
wxT("Details:"));
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
// add the pane with a zero proportion value to the 'sz' sizer which
|
|
|
|
contains it
|
|
|
|
sz-Add(collpane, 0, wxGROW|wxALL, 5);
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
// 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, wxT("test!")), 1, wxGROW|wxALL,
|
|
|
|
2);
|
|
|
|
win-SetSizer(paneSz);
|
|
|
|
paneSz-SetSizeHints(win);
|
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxCP_DEFAULT_STYLE}:
|
|
|
|
The default style: 0.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
|
|
|
@appearance{collapsiblepane.png}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@seealso
|
|
|
|
wxPanel, wxCollapsiblePaneEvent
|
|
|
|
*/
|
|
|
|
class wxCollapsiblePane : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Initializes the object and calls Create() with
|
|
|
|
all the parameters.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxCollapsiblePane(wxWindow* parent, wxWindowID id,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "collapsiblePane");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Collapses or expands the pane window.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void Collapse(bool collapse = true);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window, must not be non-@NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
The identifier for the control.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param label
|
2008-03-09 12:33:59 +00:00
|
|
|
The initial label shown in the button which allows the user to expand or
|
2008-03-08 13:52:38 +00:00
|
|
|
collapse the pane window.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial size.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
The window style, see wxCP_* flags.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Validator which can be used for additional date checks.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Control name.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
@returns @true if the control was successfully created or @false if
|
2008-03-09 12:33:59 +00:00
|
|
|
creation failed.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 13:52:38 +00:00
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = "collapsiblePane");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Same as @c wxCollapsiblePane::Collapse(@false).
|
|
|
|
*/
|
|
|
|
void Expand();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the pane window. Add controls to the returned wxWindow
|
|
|
|
to make them collapsible.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
wxWindow* GetPane();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane window is currently hidden.
|
|
|
|
*/
|
|
|
|
bool IsCollapsed();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane window is currently shown.
|
|
|
|
*/
|
|
|
|
bool IsExpanded();
|
|
|
|
};
|