2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: collpane.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxCollapsiblePaneEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCollapsiblePaneEvent
|
|
|
|
@wxheader{collpane.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This event class is used for the events generated by
|
|
|
|
wxCollapsiblePane.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{FIXME}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxCollapsiblePane
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxCollapsiblePaneEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxCollapsiblePaneEvent(wxObject* generator, int id,
|
2008-03-08 08:52:38 -05:00
|
|
|
bool collapsed);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane has been collapsed.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool GetCollapsed() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Sets this as a collapsed pane event (if @a collapsed is @true) or as an
|
2008-03-08 08:52:38 -05:00
|
|
|
expanded
|
2008-03-09 08:33:59 -04:00
|
|
|
pane event (if @a collapsed is @false).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetCollapsed(bool collapsed);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxCollapsiblePane
|
|
|
|
@wxheader{collpane.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Usage sample:
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@code
|
|
|
|
wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY,
|
|
|
|
wxT("Details:"));
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05: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 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxCP_DEFAULT_STYLE}
|
2008-03-08 08:52:38 -05:00
|
|
|
The default style: 0.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
|
|
|
@appearance{collapsiblepane.png}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxPanel, wxCollapsiblePaneEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxCollapsiblePane : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Initializes the object and calls Create() with
|
|
|
|
all the parameters.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxCollapsiblePane(wxWindow* parent, wxWindowID id,
|
2008-03-08 08:52:38 -05: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 08:33:59 -04:00
|
|
|
void Collapse(bool collapse = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window, must not be non-@NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The identifier for the control.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param label
|
2008-03-09 08:33:59 -04:00
|
|
|
The initial label shown in the button which allows the user to expand or
|
2008-03-08 08:52:38 -05:00
|
|
|
collapse the pane window.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Initial position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Initial size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style, see wxCP_* flags.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Validator which can be used for additional date checks.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Control name.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@returns @true if the control was successfully created or @false if
|
2008-03-09 08:33:59 -04:00
|
|
|
creation failed.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 08:52:38 -05: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:24:26 -04:00
|
|
|
wxWindow* GetPane() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane window is currently hidden.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsCollapsed() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the pane window is currently shown.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsExpanded() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|