1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSashWindow
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
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)
21 enum wxSashEdgePosition
36 wxSASH_STATUS_OUT_OF_RANGE
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.
47 The window (or an ancestor) will be notified of a drag via a
48 wxSashEvent notification.
52 Draws a 3D effect sash and border.
54 Draws a 3D effect sash.
56 Draws a 3D effect border.
58 Draws a thin black border.
61 @beginEventEmissionTable{wxSashEvent}
62 @event{EVT_SASH_DRAGGED(id, func)}
63 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished
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.
74 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
76 class wxSashWindow
: public wxWindow
85 Constructs a sash window, which can be a child of a frame, dialog or any other
89 Pointer to a parent window.
91 Window identifier. If -1, will automatically create an identifier.
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.
97 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
98 should generate a default size for the window.
100 Window style. For window styles, please see wxSashWindow.
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");
113 virtual ~wxSashWindow();
116 Gets the maximum window size in the x direction.
118 virtual int GetMaximumSizeX() const;
121 Gets the maximum window size in the y direction.
123 virtual int GetMaximumSizeY() const;
126 Gets the minimum window size in the x direction.
128 virtual int GetMinimumSizeX() const;
131 Gets the minimum window size in the y direction.
133 virtual int GetMinimumSizeY() const;
136 Returns @true if a sash is visible on the given edge, @false otherwise.
139 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
141 @see SetSashVisible()
143 bool GetSashVisible(wxSashEdgePosition edge
) const;
146 Sets the maximum window size in the x direction.
148 virtual void SetMaximumSizeX(int min
);
151 Sets the maximum window size in the y direction.
153 virtual void SetMaximumSizeY(int min
);
156 Sets the minimum window size in the x direction.
158 virtual void SetMinimumSizeX(int min
);
161 Sets the minimum window size in the y direction.
163 virtual void SetMinimumSizeY(int min
);
166 Call this function to make a sash visible or invisible on a particular edge.
169 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
171 @true to make the sash visible, @false to make it invisible.
173 @see GetSashVisible()
175 void SetSashVisible(wxSashEdgePosition edge
, bool visible
);
181 int GetEdgeMargin(wxSashEdgePosition edge
) const;
184 Sets the default sash border size
186 void SetDefaultBorderSize(int width
);
189 Gets the default sash border size
191 int GetDefaultBorderSize() const;
194 Sets the additional border size between child and sash window
196 void SetExtraBorderSize(int width
);
199 Gets the addition border size between child and sash window
201 int GetExtraBorderSize() const;
204 Tests for x, y over sash
206 wxSashEdgePosition
SashHitTest(int x
, int y
, int tolerance
= 2);
219 A sash event is sent when the sash of a wxSashWindow has been
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.
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.
247 @see wxSashWindow, @ref overview_events
249 class wxSashEvent
: public wxCommandEvent
255 wxSashEvent(int id
= 0, wxSashEdgePosition edge
= wxSASH_NONE
);
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.
261 wxRect
GetDragRect() const;
264 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
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.
269 wxSashDragStatus
GetDragStatus() const;
272 Returns the dragged edge.
274 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
276 wxSashEdgePosition
GetEdge() const;
279 void SetEdge(wxSashEdgePosition edge
);
280 void SetDragRect(const wxRect
& rect
);
281 void SetDragStatus(wxSashDragStatus status
);
284 wxEventType wxEVT_SASH_DRAGGED
;