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