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