2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: collpane.h
|
2008-04-09 22:57:09 -04:00
|
|
|
// Purpose: interface of wxCollapsiblePane
|
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-04-09 22:57:09 -04:00
|
|
|
This event class is used for the events generated by wxCollapsiblePane.
|
|
|
|
|
|
|
|
@beginEventTable{wxCollapsiblePaneEvent}
|
|
|
|
@event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
|
|
|
|
The user expanded or collapsed the collapsible pane.
|
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-04-09 22:57:09 -04:00
|
|
|
@category{events}
|
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-04-09 22:57:09 -04:00
|
|
|
wxCollapsiblePaneEvent(wxObject* generator, int id, bool collapsed);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
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-04-09 22:57:09 -04:00
|
|
|
expanded 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-04-09 22:57:09 -04: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-04-09 22:57:09 -04:00
|
|
|
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, @b 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
|
2008-04-09 22:57:09 -04:00
|
|
|
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.
|
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
|
2008-04-09 22:57:09 -04:00
|
|
|
wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("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, wxT("test!")), 1, wxGROW|wxALL, 2);
|
|
|
|
win->SetSizer(paneSz);
|
|
|
|
paneSz->SetSizeHints(win);
|
2008-03-08 08:52:38 -05:00
|
|
|
@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-04-09 22:57:09 -04:00
|
|
|
@beginEventTable{wxCollapsiblePaneEvent}
|
|
|
|
@event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
|
|
|
|
The user expanded or collapsed the collapsible pane.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2008-04-09 22:57:09 -04:00
|
|
|
<!-- @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:
|
2008-04-15 04:49:08 -04:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxCollapsiblePane();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-04-09 22:57:09 -04:00
|
|
|
Initializes the object and calls Create() with all the parameters.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
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");
|
|
|
|
|
|
|
|
/**
|
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-04-09 22:57:09 -04:00
|
|
|
The initial label shown in the button which allows the user to
|
|
|
|
expand or 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");
|
|
|
|
|
|
|
|
/**
|
2008-04-09 22:57:09 -04:00
|
|
|
Collapses or expands the pane window.
|
|
|
|
*/
|
|
|
|
void Collapse(bool collapse = true);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Same as calling Collapse(@false).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void Expand();
|
|
|
|
|
|
|
|
/**
|
2008-04-09 22:57:09 -04:00
|
|
|
Returns a pointer to the pane window. Add controls to the returned
|
|
|
|
wxWindow to make them collapsible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
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
|
|
|
|