]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/sashwin.h
Document wxWindow::DoCentre() and wxCENTRE_ON_SCREEN flag.
[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$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
4876436a
FM
9
10/**
11 See wxSashWindow.
12*/
13enum wxSashEdgePosition
14{
15 wxSASH_TOP = 0,
16 wxSASH_RIGHT,
17 wxSASH_BOTTOM,
18 wxSASH_LEFT,
19 wxSASH_NONE = 100
20};
21
22/**
23 See wxSashEvent.
24*/
25enum wxSashDragStatus
26{
27 wxSASH_STATUS_OK,
28 wxSASH_STATUS_OUT_OF_RANGE
29};
30
31
23324ae1
FM
32/**
33 @class wxSashWindow
7c913512 34
23324ae1
FM
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
4876436a
FM
37 application as a child of wxSashWindow.
38
39 The window (or an ancestor) will be notified of a drag via a
40 wxSashEvent notification.
7c913512 41
23324ae1 42 @beginStyleTable
8c6791e4 43 @style{wxSW_3D}
23324ae1 44 Draws a 3D effect sash and border.
8c6791e4 45 @style{wxSW_3DSASH}
23324ae1 46 Draws a 3D effect sash.
8c6791e4 47 @style{wxSW_3DBORDER}
23324ae1 48 Draws a 3D effect border.
8c6791e4 49 @style{wxSW_BORDER}
23324ae1
FM
50 Draws a thin black border.
51 @endStyleTable
7c913512 52
3051a44a 53 @beginEventEmissionTable{wxSashEvent}
8c6791e4 54 @event{EVT_SASH_DRAGGED(id, func)}
23324ae1
FM
55 Process a wxEVT_SASH_DRAGGED event, when the user has finished
56 dragging a sash.
8c6791e4 57 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
23324ae1
FM
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.
61 @endEventTable
7c913512 62
23324ae1
FM
63 @library{wxadv}
64 @category{miscwnd}
7c913512 65
830b7aa7 66 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
23324ae1
FM
67*/
68class wxSashWindow : public wxWindow
69{
70public:
4876436a
FM
71 /**
72 Default ctor.
73 */
74 wxSashWindow();
75
23324ae1
FM
76 /**
77 Constructs a sash window, which can be a child of a frame, dialog or any other
78 non-control window.
3c4f71cc 79
7c913512 80 @param parent
4cc4bfaf 81 Pointer to a parent window.
7c913512 82 @param id
4cc4bfaf 83 Window identifier. If -1, will automatically create an identifier.
7c913512 84 @param pos
4cc4bfaf 85 Window position. wxDefaultPosition is (-1, -1) which indicates that
4876436a
FM
86 wxSashWindows should generate a default position for the window.
87 If using the wxSashWindow class directly, supply an actual position.
7c913512 88 @param size
4cc4bfaf
FM
89 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
90 should generate a default size for the window.
7c913512 91 @param style
4cc4bfaf 92 Window style. For window styles, please see wxSashWindow.
7c913512 93 @param name
4cc4bfaf 94 Window name.
23324ae1 95 */
7c913512
FM
96 wxSashWindow(wxWindow* parent, wxWindowID id,
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize,
4cc4bfaf 99 long style = wxCLIP_CHILDREN | wxSW_3D,
7c913512 100 const wxString& name = "sashWindow");
23324ae1
FM
101
102 /**
103 Destructor.
104 */
adaaa686 105 virtual ~wxSashWindow();
23324ae1
FM
106
107 /**
108 Gets the maximum window size in the x direction.
109 */
adaaa686 110 virtual int GetMaximumSizeX() const;
23324ae1
FM
111
112 /**
113 Gets the maximum window size in the y direction.
114 */
adaaa686 115 virtual int GetMaximumSizeY() const;
23324ae1
FM
116
117 /**
118 Gets the minimum window size in the x direction.
119 */
adaaa686 120 virtual int GetMinimumSizeX() const;
23324ae1
FM
121
122 /**
123 Gets the minimum window size in the y direction.
124 */
adaaa686 125 virtual int GetMinimumSizeY() const;
23324ae1
FM
126
127 /**
128 Returns @true if a sash is visible on the given edge, @false otherwise.
3c4f71cc 129
7c913512 130 @param edge
4cc4bfaf 131 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
3c4f71cc 132
4cc4bfaf 133 @see SetSashVisible()
23324ae1 134 */
328f5751 135 bool GetSashVisible(wxSashEdgePosition edge) const;
23324ae1
FM
136
137 /**
138 Returns @true if the sash has a border, @false otherwise.
139 This function is obsolete since the sash border property is unused.
3c4f71cc 140
7c913512 141 @param edge
4cc4bfaf 142 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
3c4f71cc 143
4cc4bfaf 144 @see SetSashBorder()
23324ae1 145 */
328f5751 146 bool HasBorder(wxSashEdgePosition edge) const;
23324ae1
FM
147
148 /**
149 Sets the maximum window size in the x direction.
150 */
adaaa686 151 virtual void SetMaximumSizeX(int min);
23324ae1
FM
152
153 /**
154 Sets the maximum window size in the y direction.
155 */
adaaa686 156 virtual void SetMaximumSizeY(int min);
23324ae1
FM
157
158 /**
159 Sets the minimum window size in the x direction.
160 */
adaaa686 161 virtual void SetMinimumSizeX(int min);
23324ae1
FM
162
163 /**
164 Sets the minimum window size in the y direction.
165 */
adaaa686 166 virtual void SetMinimumSizeY(int min);
23324ae1
FM
167
168 /**
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.
3c4f71cc 171
7c913512 172 @param edge
4cc4bfaf 173 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
7c913512 174 @param hasBorder
4cc4bfaf 175 @true to give the sash a border visible, @false to remove it.
23324ae1
FM
176 */
177 void SetSashBorder(wxSashEdgePosition edge, bool hasBorder);
178
179 /**
180 Call this function to make a sash visible or invisible on a particular edge.
3c4f71cc 181
7c913512 182 @param edge
4cc4bfaf 183 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
7c913512 184 @param visible
4cc4bfaf 185 @true to make the sash visible, @false to make it invisible.
3c4f71cc 186
4cc4bfaf 187 @see GetSashVisible()
23324ae1
FM
188 */
189 void SetSashVisible(wxSashEdgePosition edge, bool visible);
190};
191
192
e54c96f1 193
23324ae1
FM
194/**
195 @class wxSashEvent
7c913512 196
23324ae1
FM
197 A sash event is sent when the sash of a wxSashWindow has been
198 dragged by the user.
7c913512 199
4876436a
FM
200 @remarks
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.
212
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.
220 @endEventTable
221
23324ae1 222 @library{wxadv}
4876436a 223 @category{events}
7c913512 224
830b7aa7 225 @see wxSashWindow, @ref overview_events
23324ae1
FM
226*/
227class wxSashEvent : public wxCommandEvent
228{
229public:
230 /**
231 Constructor.
232 */
233 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
234
235 /**
236 Returns the rectangle representing the new size the window would be if the
4876436a 237 resize was applied. It is up to the application to set the window size if required.
23324ae1 238 */
328f5751 239 wxRect GetDragRect() const;
23324ae1
FM
240
241 /**
4876436a
FM
242 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
243
23324ae1
FM
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.
246 */
328f5751 247 wxSashDragStatus GetDragStatus() const;
23324ae1
FM
248
249 /**
4876436a
FM
250 Returns the dragged edge.
251
252 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
23324ae1 253 */
328f5751 254 wxSashEdgePosition GetEdge() const;
23324ae1 255};
e54c96f1 256