]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/sashwin.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / interface / wx / sashwin.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: sashwin.h
e54c96f1 3// Purpose: interface of wxSashWindow
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
7d40f0a5
RD
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
4876436a
FM
17
18/**
19 See wxSashWindow.
20*/
21enum 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*/
33enum wxSashDragStatus
34{
35 wxSASH_STATUS_OK,
36 wxSASH_STATUS_OUT_OF_RANGE
37};
38
39
23324ae1
FM
40/**
41 @class wxSashWindow
7c913512 42
23324ae1
FM
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
4876436a
FM
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.
7c913512 49
23324ae1 50 @beginStyleTable
8c6791e4 51 @style{wxSW_3D}
23324ae1 52 Draws a 3D effect sash and border.
8c6791e4 53 @style{wxSW_3DSASH}
23324ae1 54 Draws a 3D effect sash.
8c6791e4 55 @style{wxSW_3DBORDER}
23324ae1 56 Draws a 3D effect border.
8c6791e4 57 @style{wxSW_BORDER}
23324ae1
FM
58 Draws a thin black border.
59 @endStyleTable
7c913512 60
3051a44a 61 @beginEventEmissionTable{wxSashEvent}
8c6791e4 62 @event{EVT_SASH_DRAGGED(id, func)}
3a194bda 63 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished
23324ae1 64 dragging a sash.
8c6791e4 65 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
3a194bda 66 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has
23324ae1
FM
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
7c913512 70
23324ae1
FM
71 @library{wxadv}
72 @category{miscwnd}
7c913512 73
830b7aa7 74 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
23324ae1
FM
75*/
76class wxSashWindow : public wxWindow
77{
78public:
4876436a
FM
79 /**
80 Default ctor.
81 */
82 wxSashWindow();
83
23324ae1
FM
84 /**
85 Constructs a sash window, which can be a child of a frame, dialog or any other
86 non-control window.
3c4f71cc 87
7c913512 88 @param parent
4cc4bfaf 89 Pointer to a parent window.
7c913512 90 @param id
4cc4bfaf 91 Window identifier. If -1, will automatically create an identifier.
7c913512 92 @param pos
4cc4bfaf 93 Window position. wxDefaultPosition is (-1, -1) which indicates that
4876436a
FM
94 wxSashWindows should generate a default position for the window.
95 If using the wxSashWindow class directly, supply an actual position.
7c913512 96 @param size
4cc4bfaf
FM
97 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
98 should generate a default size for the window.
7c913512 99 @param style
4cc4bfaf 100 Window style. For window styles, please see wxSashWindow.
7c913512 101 @param name
4cc4bfaf 102 Window name.
23324ae1 103 */
7c913512
FM
104 wxSashWindow(wxWindow* parent, wxWindowID id,
105 const wxPoint& pos = wxDefaultPosition,
106 const wxSize& size = wxDefaultSize,
4cc4bfaf 107 long style = wxCLIP_CHILDREN | wxSW_3D,
7c913512 108 const wxString& name = "sashWindow");
23324ae1
FM
109
110 /**
111 Destructor.
112 */
adaaa686 113 virtual ~wxSashWindow();
23324ae1
FM
114
115 /**
116 Gets the maximum window size in the x direction.
117 */
adaaa686 118 virtual int GetMaximumSizeX() const;
23324ae1
FM
119
120 /**
121 Gets the maximum window size in the y direction.
122 */
adaaa686 123 virtual int GetMaximumSizeY() const;
23324ae1
FM
124
125 /**
126 Gets the minimum window size in the x direction.
127 */
adaaa686 128 virtual int GetMinimumSizeX() const;
23324ae1
FM
129
130 /**
131 Gets the minimum window size in the y direction.
132 */
adaaa686 133 virtual int GetMinimumSizeY() const;
23324ae1
FM
134
135 /**
136 Returns @true if a sash is visible on the given edge, @false otherwise.
3c4f71cc 137
7c913512 138 @param edge
4cc4bfaf 139 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
3c4f71cc 140
4cc4bfaf 141 @see SetSashVisible()
23324ae1 142 */
328f5751 143 bool GetSashVisible(wxSashEdgePosition edge) const;
23324ae1 144
23324ae1
FM
145 /**
146 Sets the maximum window size in the x direction.
147 */
adaaa686 148 virtual void SetMaximumSizeX(int min);
23324ae1
FM
149
150 /**
151 Sets the maximum window size in the y direction.
152 */
adaaa686 153 virtual void SetMaximumSizeY(int min);
23324ae1
FM
154
155 /**
156 Sets the minimum window size in the x direction.
157 */
adaaa686 158 virtual void SetMinimumSizeX(int min);
23324ae1
FM
159
160 /**
161 Sets the minimum window size in the y direction.
162 */
adaaa686 163 virtual void SetMinimumSizeY(int min);
23324ae1 164
23324ae1
FM
165 /**
166 Call this function to make a sash visible or invisible on a particular edge.
3c4f71cc 167
7c913512 168 @param edge
4cc4bfaf 169 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
7c913512 170 @param visible
4cc4bfaf 171 @true to make the sash visible, @false to make it invisible.
3c4f71cc 172
4cc4bfaf 173 @see GetSashVisible()
23324ae1
FM
174 */
175 void SetSashVisible(wxSashEdgePosition edge, bool visible);
deb21d7f
RD
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();
23324ae1
FM
212};
213
214
e54c96f1 215
23324ae1
FM
216/**
217 @class wxSashEvent
7c913512 218
23324ae1
FM
219 A sash event is sent when the sash of a wxSashWindow has been
220 dragged by the user.
7c913512 221
4876436a
FM
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)}
3a194bda 237 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished dragging a sash.
4876436a 238 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
3a194bda 239 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has finished
4876436a
FM
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
23324ae1 244 @library{wxadv}
4876436a 245 @category{events}
7c913512 246
830b7aa7 247 @see wxSashWindow, @ref overview_events
23324ae1
FM
248*/
249class wxSashEvent : public wxCommandEvent
250{
251public:
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
4876436a 259 resize was applied. It is up to the application to set the window size if required.
23324ae1 260 */
328f5751 261 wxRect GetDragRect() const;
23324ae1
FM
262
263 /**
4876436a
FM
264 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
265
23324ae1
FM
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 */
328f5751 269 wxSashDragStatus GetDragStatus() const;
23324ae1
FM
270
271 /**
4876436a
FM
272 Returns the dragged edge.
273
274 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
23324ae1 275 */
328f5751 276 wxSashEdgePosition GetEdge() const;
7d40f0a5
RD
277
278
279 void SetEdge(wxSashEdgePosition edge);
280 void SetDragRect(const wxRect& rect);
281 void SetDragStatus(wxSashDragStatus status);
23324ae1 282};
e54c96f1 283
7d40f0a5 284wxEventType wxEVT_SASH_DRAGGED;