]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/sashwin.h
Fix html documentation warnings.
[wxWidgets.git] / interface / wx / sashwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sashwin.h
3 // Purpose: interface of wxSashWindow
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 wxSashWindow flags
10 */
11 #define wxSW_NOBORDER 0x0000
12 #define wxSW_BORDER 0x0020
13 #define wxSW_3DSASH 0x0040
14 #define wxSW_3DBORDER 0x0080
15 #define wxSW_3D (wxSW_3DSASH | wxSW_3DBORDER)
16
17
18 /**
19 See wxSashWindow.
20 */
21 enum wxSashEdgePosition
22 {
23 wxSASH_TOP = 0,
24 wxSASH_RIGHT,
25 wxSASH_BOTTOM,
26 wxSASH_LEFT,
27 wxSASH_NONE = 100
28 };
29
30 /**
31 See wxSashEvent.
32 */
33 enum wxSashDragStatus
34 {
35 wxSASH_STATUS_OK,
36 wxSASH_STATUS_OUT_OF_RANGE
37 };
38
39
40 /**
41 @class wxSashWindow
42
43 wxSashWindow allows any of its edges to have a sash which can be dragged
44 to resize the window. The actual content window will be created by the
45 application as a child of wxSashWindow.
46
47 The window (or an ancestor) will be notified of a drag via a
48 wxSashEvent notification.
49
50 @beginStyleTable
51 @style{wxSW_3D}
52 Draws a 3D effect sash and border.
53 @style{wxSW_3DSASH}
54 Draws a 3D effect sash.
55 @style{wxSW_3DBORDER}
56 Draws a 3D effect border.
57 @style{wxSW_BORDER}
58 Draws a thin black border.
59 @endStyleTable
60
61 @beginEventEmissionTable{wxSashEvent}
62 @event{EVT_SASH_DRAGGED(id, func)}
63 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished
64 dragging a sash.
65 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
66 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has
67 finished dragging a sash. The event handler is called when windows
68 with ids in the given range have their sashes dragged.
69 @endEventTable
70
71 @library{wxadv}
72 @category{miscwnd}
73
74 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
75 */
76 class wxSashWindow : public wxWindow
77 {
78 public:
79 /**
80 Default ctor.
81 */
82 wxSashWindow();
83
84 /**
85 Constructs a sash window, which can be a child of a frame, dialog or any other
86 non-control window.
87
88 @param parent
89 Pointer to a parent window.
90 @param id
91 Window identifier. If -1, will automatically create an identifier.
92 @param pos
93 Window position. wxDefaultPosition is (-1, -1) which indicates that
94 wxSashWindows should generate a default position for the window.
95 If using the wxSashWindow class directly, supply an actual position.
96 @param size
97 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
98 should generate a default size for the window.
99 @param style
100 Window style. For window styles, please see wxSashWindow.
101 @param name
102 Window name.
103 */
104 wxSashWindow(wxWindow* parent, wxWindowID id,
105 const wxPoint& pos = wxDefaultPosition,
106 const wxSize& size = wxDefaultSize,
107 long style = wxCLIP_CHILDREN | wxSW_3D,
108 const wxString& name = "sashWindow");
109
110 /**
111 Destructor.
112 */
113 virtual ~wxSashWindow();
114
115 /**
116 Gets the maximum window size in the x direction.
117 */
118 virtual int GetMaximumSizeX() const;
119
120 /**
121 Gets the maximum window size in the y direction.
122 */
123 virtual int GetMaximumSizeY() const;
124
125 /**
126 Gets the minimum window size in the x direction.
127 */
128 virtual int GetMinimumSizeX() const;
129
130 /**
131 Gets the minimum window size in the y direction.
132 */
133 virtual int GetMinimumSizeY() const;
134
135 /**
136 Returns @true if a sash is visible on the given edge, @false otherwise.
137
138 @param edge
139 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
140
141 @see SetSashVisible()
142 */
143 bool GetSashVisible(wxSashEdgePosition edge) const;
144
145 /**
146 Sets the maximum window size in the x direction.
147 */
148 virtual void SetMaximumSizeX(int min);
149
150 /**
151 Sets the maximum window size in the y direction.
152 */
153 virtual void SetMaximumSizeY(int min);
154
155 /**
156 Sets the minimum window size in the x direction.
157 */
158 virtual void SetMinimumSizeX(int min);
159
160 /**
161 Sets the minimum window size in the y direction.
162 */
163 virtual void SetMinimumSizeY(int min);
164
165 /**
166 Call this function to make a sash visible or invisible on a particular edge.
167
168 @param edge
169 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
170 @param visible
171 @true to make the sash visible, @false to make it invisible.
172
173 @see GetSashVisible()
174 */
175 void SetSashVisible(wxSashEdgePosition edge, bool visible);
176
177
178 /**
179 Get border size
180 */
181 int GetEdgeMargin(wxSashEdgePosition edge) const;
182
183 /**
184 Sets the default sash border size
185 */
186 void SetDefaultBorderSize(int width);
187
188 /**
189 Gets the default sash border size
190 */
191 int GetDefaultBorderSize() const;
192
193 /**
194 Sets the additional border size between child and sash window
195 */
196 void SetExtraBorderSize(int width);
197
198 /**
199 Gets the addition border size between child and sash window
200 */
201 int GetExtraBorderSize() const;
202
203 /**
204 Tests for x, y over sash
205 */
206 wxSashEdgePosition SashHitTest(int x, int y, int tolerance = 2);
207
208 /**
209 Resizes subwindows
210 */
211 void SizeWindows();
212 };
213
214
215
216 /**
217 @class wxSashEvent
218
219 A sash event is sent when the sash of a wxSashWindow has been
220 dragged by the user.
221
222 @remarks
223 When a sash belonging to a sash window is dragged by the user, and then released,
224 this event is sent to the window, where it may be processed by an event table
225 entry in a derived class, a plug-in event handler or an ancestor class.
226 Note that the wxSashWindow doesn't change the window's size itself.
227 It relies on the application's event handler to do that.
228 This is because the application may have to handle other consequences of the resize,
229 or it may wish to veto it altogether. The event handler should look at the drag
230 rectangle: see wxSashEvent::GetDragRect to see what the new size of the window
231 would be if the resize were to be applied.
232 It should also call wxSashEvent::GetDragStatus to see whether the drag was
233 OK or out of the current allowed range.
234
235 @beginEventTable{wxSashEvent}
236 @event{EVT_SASH_DRAGGED(id, func)}
237 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished dragging a sash.
238 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
239 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has finished
240 dragging a sash. The event handler is called when windows with ids in
241 the given range have their sashes dragged.
242 @endEventTable
243
244 @library{wxadv}
245 @category{events}
246
247 @see wxSashWindow, @ref overview_events
248 */
249 class wxSashEvent : public wxCommandEvent
250 {
251 public:
252 /**
253 Constructor.
254 */
255 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
256
257 /**
258 Returns the rectangle representing the new size the window would be if the
259 resize was applied. It is up to the application to set the window size if required.
260 */
261 wxRect GetDragRect() const;
262
263 /**
264 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
265
266 If the drag caused the notional bounding box of the window to flip over, for
267 example, the drag will be out of rage.
268 */
269 wxSashDragStatus GetDragStatus() const;
270
271 /**
272 Returns the dragged edge.
273
274 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
275 */
276 wxSashEdgePosition GetEdge() const;
277
278
279 void SetEdge(wxSashEdgePosition edge);
280 void SetDragRect(const wxRect& rect);
281 void SetDragStatus(wxSashDragStatus status);
282 };
283
284 wxEventType wxEVT_SASH_DRAGGED;