1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSashWindow
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
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)
22 enum wxSashEdgePosition
37 wxSASH_STATUS_OUT_OF_RANGE
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
46 application as a child of wxSashWindow.
48 The window (or an ancestor) will be notified of a drag via a
49 wxSashEvent notification.
53 Draws a 3D effect sash and border.
55 Draws a 3D effect sash.
57 Draws a 3D effect border.
59 Draws a thin black border.
62 @beginEventEmissionTable{wxSashEvent}
63 @event{EVT_SASH_DRAGGED(id, func)}
64 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished
66 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
67 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has
68 finished dragging a sash. The event handler is called when windows
69 with ids in the given range have their sashes dragged.
75 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
77 class wxSashWindow
: public wxWindow
86 Constructs a sash window, which can be a child of a frame, dialog or any other
90 Pointer to a parent window.
92 Window identifier. If -1, will automatically create an identifier.
94 Window position. wxDefaultPosition is (-1, -1) which indicates that
95 wxSashWindows should generate a default position for the window.
96 If using the wxSashWindow class directly, supply an actual position.
98 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
99 should generate a default size for the window.
101 Window style. For window styles, please see wxSashWindow.
105 wxSashWindow(wxWindow
* parent
, wxWindowID id
,
106 const wxPoint
& pos
= wxDefaultPosition
,
107 const wxSize
& size
= wxDefaultSize
,
108 long style
= wxCLIP_CHILDREN
| wxSW_3D
,
109 const wxString
& name
= "sashWindow");
114 virtual ~wxSashWindow();
117 Gets the maximum window size in the x direction.
119 virtual int GetMaximumSizeX() const;
122 Gets the maximum window size in the y direction.
124 virtual int GetMaximumSizeY() const;
127 Gets the minimum window size in the x direction.
129 virtual int GetMinimumSizeX() const;
132 Gets the minimum window size in the y direction.
134 virtual int GetMinimumSizeY() const;
137 Returns @true if a sash is visible on the given edge, @false otherwise.
140 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
142 @see SetSashVisible()
144 bool GetSashVisible(wxSashEdgePosition edge
) const;
147 Sets the maximum window size in the x direction.
149 virtual void SetMaximumSizeX(int min
);
152 Sets the maximum window size in the y direction.
154 virtual void SetMaximumSizeY(int min
);
157 Sets the minimum window size in the x direction.
159 virtual void SetMinimumSizeX(int min
);
162 Sets the minimum window size in the y direction.
164 virtual void SetMinimumSizeY(int min
);
167 Call this function to make a sash visible or invisible on a particular edge.
170 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
172 @true to make the sash visible, @false to make it invisible.
174 @see GetSashVisible()
176 void SetSashVisible(wxSashEdgePosition edge
, bool visible
);
182 int GetEdgeMargin(wxSashEdgePosition edge
) const;
185 Sets the default sash border size
187 void SetDefaultBorderSize(int width
);
190 Gets the default sash border size
192 int GetDefaultBorderSize() const;
195 Sets the additional border size between child and sash window
197 void SetExtraBorderSize(int width
);
200 Gets the addition border size between child and sash window
202 int GetExtraBorderSize() const;
205 Tests for x, y over sash
207 wxSashEdgePosition
SashHitTest(int x
, int y
, int tolerance
= 2);
220 A sash event is sent when the sash of a wxSashWindow has been
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.
236 @beginEventTable{wxSashEvent}
237 @event{EVT_SASH_DRAGGED(id, func)}
238 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished dragging a sash.
239 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
240 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has finished
241 dragging a sash. The event handler is called when windows with ids in
242 the given range have their sashes dragged.
248 @see wxSashWindow, @ref overview_events
250 class wxSashEvent
: public wxCommandEvent
256 wxSashEvent(int id
= 0, wxSashEdgePosition edge
= wxSASH_NONE
);
259 Returns the rectangle representing the new size the window would be if the
260 resize was applied. It is up to the application to set the window size if required.
262 wxRect
GetDragRect() const;
265 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
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.
270 wxSashDragStatus
GetDragStatus() const;
273 Returns the dragged edge.
275 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
277 wxSashEdgePosition
GetEdge() const;
280 void SetEdge(wxSashEdgePosition edge
);
281 void SetDragRect(const wxRect
& rect
);
282 void SetDragStatus(wxSashDragStatus status
);
285 wxEventType wxEVT_SASH_DRAGGED
;