]> git.saurik.com Git - wxWidgets.git/blame - interface/collpane.h
Try out - instead of @li, more backslash escaping
[wxWidgets.git] / interface / collpane.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: collpane.h
968f15e2 3// Purpose: interface of wxCollapsiblePane
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxCollapsiblePaneEvent
11 @wxheader{collpane.h}
7c913512 12
968f15e2
BP
13 This event class is used for the events generated by wxCollapsiblePane.
14
15 @beginEventTable{wxCollapsiblePaneEvent}
16 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
17 The user expanded or collapsed the collapsible pane.
18 @endEventTable
7c913512 19
23324ae1 20 @library{wxcore}
968f15e2 21 @category{events}
7c913512 22
e54c96f1 23 @see wxCollapsiblePane
23324ae1
FM
24*/
25class wxCollapsiblePaneEvent : public wxCommandEvent
26{
27public:
28 /**
29 The constructor is not normally used by the user code.
30 */
968f15e2 31 wxCollapsiblePaneEvent(wxObject* generator, int id, bool collapsed);
23324ae1
FM
32
33 /**
34 Returns @true if the pane has been collapsed.
35 */
328f5751 36 bool GetCollapsed() const;
23324ae1
FM
37
38 /**
4cc4bfaf 39 Sets this as a collapsed pane event (if @a collapsed is @true) or as an
968f15e2 40 expanded pane event (if @a collapsed is @false).
23324ae1
FM
41 */
42 void SetCollapsed(bool collapsed);
43};
44
45
e54c96f1 46
23324ae1
FM
47/**
48 @class wxCollapsiblePane
49 @wxheader{collpane.h}
7c913512 50
968f15e2
BP
51 A collapsible pane is a container with an embedded button-like control
52 which can be used by the user to collapse or expand the pane's contents.
7c913512 53
968f15e2
BP
54 Once constructed you should use the GetPane() function to access the pane
55 and add your controls inside it (i.e. use the returned pointer from
56 GetPane() as parent for the controls which must go in the pane, @b not the
57 wxCollapsiblePane itself!).
7c913512 58
23324ae1 59 Note that because of its nature of control which can dynamically (and
968f15e2
BP
60 drastically) change its size at run-time under user-input, when putting
61 wxCollapsiblePane inside a wxSizer you should be careful to add it with a
62 proportion value of zero; this is because otherwise all other windows with
63 non-null proportion values will automatically resize each time the user
64 expands or collapse the pane window usually resulting in a weird,
65 flickering effect.
7c913512 66
23324ae1 67 Usage sample:
7c913512 68
23324ae1 69 @code
968f15e2
BP
70 wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:"));
71
72 // add the pane with a zero proportion value to the 'sz' sizer which contains it
73 sz->Add(collpane, 0, wxGROW|wxALL, 5);
74
75 // now add a test label in the collapsible pane using a sizer to layout it:
76 wxWindow *win = collpane->GetPane();
77 wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
78 paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2);
79 win->SetSizer(paneSz);
80 paneSz->SetSizeHints(win);
23324ae1 81 @endcode
7c913512 82
23324ae1 83 It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
7c913512 84
23324ae1 85 @beginStyleTable
8c6791e4 86 @style{wxCP_DEFAULT_STYLE}
23324ae1
FM
87 The default style: 0.
88 @endStyleTable
7c913512 89
968f15e2
BP
90 @beginEventTable{wxCollapsiblePaneEvent}
91 @event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
92 The user expanded or collapsed the collapsible pane.
93 @endEventTable
94
23324ae1
FM
95 @library{wxcore}
96 @category{ctrl}
968f15e2 97 <!-- @appearance{collapsiblepane.png} -->
7c913512 98
e54c96f1 99 @see wxPanel, wxCollapsiblePaneEvent
23324ae1
FM
100*/
101class wxCollapsiblePane : public wxControl
102{
103public:
104 /**
968f15e2 105 Initializes the object and calls Create() with all the parameters.
23324ae1 106 */
4cc4bfaf 107 wxCollapsiblePane(wxWindow* parent, wxWindowID id,
23324ae1
FM
108 const wxString& label,
109 const wxPoint& pos = wxDefaultPosition,
110 const wxSize& size = wxDefaultSize,
111 long style = wxCP_DEFAULT_STYLE,
112 const wxValidator& validator = wxDefaultValidator,
113 const wxString& name = "collapsiblePane");
114
23324ae1 115 /**
7c913512 116 @param parent
4cc4bfaf 117 Parent window, must not be non-@NULL.
7c913512 118 @param id
4cc4bfaf 119 The identifier for the control.
7c913512 120 @param label
968f15e2
BP
121 The initial label shown in the button which allows the user to
122 expand or collapse the pane window.
7c913512 123 @param pos
4cc4bfaf 124 Initial position.
7c913512 125 @param size
4cc4bfaf 126 Initial size.
7c913512 127 @param style
4cc4bfaf 128 The window style, see wxCP_* flags.
7c913512 129 @param validator
4cc4bfaf 130 Validator which can be used for additional date checks.
7c913512 131 @param name
4cc4bfaf 132 Control name.
3c4f71cc 133
23324ae1 134 @returns @true if the control was successfully created or @false if
4cc4bfaf 135 creation failed.
23324ae1 136 */
4cc4bfaf 137 bool Create(wxWindow* parent, wxWindowID id,
23324ae1
FM
138 const wxString& label,
139 const wxPoint& pos = wxDefaultPosition,
140 const wxSize& size = wxDefaultSize,
141 long style = wxCP_DEFAULT_STYLE,
142 const wxValidator& validator = wxDefaultValidator,
143 const wxString& name = "collapsiblePane");
144
145 /**
968f15e2
BP
146 Collapses or expands the pane window.
147 */
148 void Collapse(bool collapse = true);
149
150 /**
151 Same as calling Collapse(@false).
23324ae1
FM
152 */
153 void Expand();
154
155 /**
968f15e2
BP
156 Returns a pointer to the pane window. Add controls to the returned
157 wxWindow to make them collapsible.
23324ae1 158 */
328f5751 159 wxWindow* GetPane() const;
23324ae1
FM
160
161 /**
162 Returns @true if the pane window is currently hidden.
163 */
328f5751 164 bool IsCollapsed() const;
23324ae1
FM
165
166 /**
167 Returns @true if the pane window is currently shown.
168 */
328f5751 169 bool IsExpanded() const;
23324ae1 170};
e54c96f1 171