1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSashWindow
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 enum wxSashEdgePosition
28 wxSASH_STATUS_OUT_OF_RANGE
35 wxSashWindow allows any of its edges to have a sash which can be dragged
36 to resize the window. The actual content window will be created by the
37 application as a child of wxSashWindow.
39 The window (or an ancestor) will be notified of a drag via a
40 wxSashEvent notification.
44 Draws a 3D effect sash and border.
46 Draws a 3D effect sash.
48 Draws a 3D effect border.
50 Draws a thin black border.
53 @beginEventTable{wxSashEvent}
54 @event{EVT_SASH_DRAGGED(id, func)}
55 Process a wxEVT_SASH_DRAGGED event, when the user has finished
57 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
58 Process a wxEVT_SASH_DRAGGED_RANGE event, when the user has
59 finished dragging a sash. The event handler is called when windows
60 with ids in the given range have their sashes dragged.
66 @see wxSashEvent, wxSashLayoutWindow, @ref overview_eventhandling
68 class wxSashWindow
: public wxWindow
77 Constructs a sash window, which can be a child of a frame, dialog or any other
81 Pointer to a parent window.
83 Window identifier. If -1, will automatically create an identifier.
85 Window position. wxDefaultPosition is (-1, -1) which indicates that
86 wxSashWindows should generate a default position for the window.
87 If using the wxSashWindow class directly, supply an actual position.
89 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
90 should generate a default size for the window.
92 Window style. For window styles, please see wxSashWindow.
96 wxSashWindow(wxWindow
* parent
, wxWindowID id
,
97 const wxPoint
& pos
= wxDefaultPosition
,
98 const wxSize
& size
= wxDefaultSize
,
99 long style
= wxCLIP_CHILDREN
| wxSW_3D
,
100 const wxString
& name
= "sashWindow");
105 virtual ~wxSashWindow();
108 Gets the maximum window size in the x direction.
110 virtual int GetMaximumSizeX() const;
113 Gets the maximum window size in the y direction.
115 virtual int GetMaximumSizeY() const;
118 Gets the minimum window size in the x direction.
120 virtual int GetMinimumSizeX() const;
123 Gets the minimum window size in the y direction.
125 virtual int GetMinimumSizeY() const;
128 Returns @true if a sash is visible on the given edge, @false otherwise.
131 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
133 @see SetSashVisible()
135 bool GetSashVisible(wxSashEdgePosition edge
) const;
138 Returns @true if the sash has a border, @false otherwise.
139 This function is obsolete since the sash border property is unused.
142 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
146 bool HasBorder(wxSashEdgePosition edge
) const;
149 Sets the maximum window size in the x direction.
151 virtual void SetMaximumSizeX(int min
);
154 Sets the maximum window size in the y direction.
156 virtual void SetMaximumSizeY(int min
);
159 Sets the minimum window size in the x direction.
161 virtual void SetMinimumSizeX(int min
);
164 Sets the minimum window size in the y direction.
166 virtual void SetMinimumSizeY(int min
);
169 Call this function to give the sash a border, or remove the border.
170 This function is obsolete since the sash border property is unused.
173 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
175 @true to give the sash a border visible, @false to remove it.
177 void SetSashBorder(wxSashEdgePosition edge
, bool hasBorder
);
180 Call this function to make a sash visible or invisible on a particular edge.
183 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
185 @true to make the sash visible, @false to make it invisible.
187 @see GetSashVisible()
189 void SetSashVisible(wxSashEdgePosition edge
, bool visible
);
197 A sash event is sent when the sash of a wxSashWindow has been
201 When a sash belonging to a sash window is dragged by the user, and then released,
202 this event is sent to the window, where it may be processed by an event table
203 entry in a derived class, a plug-in event handler or an ancestor class.
204 Note that the wxSashWindow doesn't change the window's size itself.
205 It relies on the application's event handler to do that.
206 This is because the application may have to handle other consequences of the resize,
207 or it may wish to veto it altogether. The event handler should look at the drag
208 rectangle: see wxSashEvent::GetDragRect to see what the new size of the window
209 would be if the resize were to be applied.
210 It should also call wxSashEvent::GetDragStatus to see whether the drag was
211 OK or out of the current allowed range.
213 @beginEventTable{wxSashEvent}
214 @event{EVT_SASH_DRAGGED(id, func)}
215 Process a wxEVT_SASH_DRAGGED event, when the user has finished dragging a sash.
216 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
217 Process a wxEVT_SASH_DRAGGED_RANGE event, when the user has finished
218 dragging a sash. The event handler is called when windows with ids in
219 the given range have their sashes dragged.
225 @see wxSashWindow, @ref overview_eventhandling
227 class wxSashEvent
: public wxCommandEvent
233 wxSashEvent(int id
= 0, wxSashEdgePosition edge
= wxSASH_NONE
);
236 Returns the rectangle representing the new size the window would be if the
237 resize was applied. It is up to the application to set the window size if required.
239 wxRect
GetDragRect() const;
242 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
244 If the drag caused the notional bounding box of the window to flip over, for
245 example, the drag will be out of rage.
247 wxSashDragStatus
GetDragStatus() const;
250 Returns the dragged edge.
252 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
254 wxSashEdgePosition
GetEdge() const;