]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/sashwin.h
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[wxWidgets.git] / interface / wx / sashwin.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: sashwin.h
3// Purpose: interface of wxSashWindow
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows licence
7/////////////////////////////////////////////////////////////////////////////
8
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
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
41/**
42 @class wxSashWindow
43
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.
47
48 The window (or an ancestor) will be notified of a drag via a
49 wxSashEvent notification.
50
51 @beginStyleTable
52 @style{wxSW_3D}
53 Draws a 3D effect sash and border.
54 @style{wxSW_3DSASH}
55 Draws a 3D effect sash.
56 @style{wxSW_3DBORDER}
57 Draws a 3D effect border.
58 @style{wxSW_BORDER}
59 Draws a thin black border.
60 @endStyleTable
61
62 @beginEventEmissionTable{wxSashEvent}
63 @event{EVT_SASH_DRAGGED(id, func)}
64 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished
65 dragging a sash.
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.
70 @endEventTable
71
72 @library{wxadv}
73 @category{miscwnd}
74
75 @see wxSashEvent, wxSashLayoutWindow, @ref overview_events
76*/
77class wxSashWindow : public wxWindow
78{
79public:
80 /**
81 Default ctor.
82 */
83 wxSashWindow();
84
85 /**
86 Constructs a sash window, which can be a child of a frame, dialog or any other
87 non-control window.
88
89 @param parent
90 Pointer to a parent window.
91 @param id
92 Window identifier. If -1, will automatically create an identifier.
93 @param pos
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.
97 @param size
98 Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows
99 should generate a default size for the window.
100 @param style
101 Window style. For window styles, please see wxSashWindow.
102 @param name
103 Window name.
104 */
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");
110
111 /**
112 Destructor.
113 */
114 virtual ~wxSashWindow();
115
116 /**
117 Gets the maximum window size in the x direction.
118 */
119 virtual int GetMaximumSizeX() const;
120
121 /**
122 Gets the maximum window size in the y direction.
123 */
124 virtual int GetMaximumSizeY() const;
125
126 /**
127 Gets the minimum window size in the x direction.
128 */
129 virtual int GetMinimumSizeX() const;
130
131 /**
132 Gets the minimum window size in the y direction.
133 */
134 virtual int GetMinimumSizeY() const;
135
136 /**
137 Returns @true if a sash is visible on the given edge, @false otherwise.
138
139 @param edge
140 Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
141
142 @see SetSashVisible()
143 */
144 bool GetSashVisible(wxSashEdgePosition edge) const;
145
146 /**
147 Sets the maximum window size in the x direction.
148 */
149 virtual void SetMaximumSizeX(int min);
150
151 /**
152 Sets the maximum window size in the y direction.
153 */
154 virtual void SetMaximumSizeY(int min);
155
156 /**
157 Sets the minimum window size in the x direction.
158 */
159 virtual void SetMinimumSizeX(int min);
160
161 /**
162 Sets the minimum window size in the y direction.
163 */
164 virtual void SetMinimumSizeY(int min);
165
166 /**
167 Call this function to make a sash visible or invisible on a particular edge.
168
169 @param edge
170 Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
171 @param visible
172 @true to make the sash visible, @false to make it invisible.
173
174 @see GetSashVisible()
175 */
176 void SetSashVisible(wxSashEdgePosition edge, bool visible);
177};
178
179
180
181/**
182 @class wxSashEvent
183
184 A sash event is sent when the sash of a wxSashWindow has been
185 dragged by the user.
186
187 @remarks
188 When a sash belonging to a sash window is dragged by the user, and then released,
189 this event is sent to the window, where it may be processed by an event table
190 entry in a derived class, a plug-in event handler or an ancestor class.
191 Note that the wxSashWindow doesn't change the window's size itself.
192 It relies on the application's event handler to do that.
193 This is because the application may have to handle other consequences of the resize,
194 or it may wish to veto it altogether. The event handler should look at the drag
195 rectangle: see wxSashEvent::GetDragRect to see what the new size of the window
196 would be if the resize were to be applied.
197 It should also call wxSashEvent::GetDragStatus to see whether the drag was
198 OK or out of the current allowed range.
199
200 @beginEventTable{wxSashEvent}
201 @event{EVT_SASH_DRAGGED(id, func)}
202 Process a @c wxEVT_SASH_DRAGGED event, when the user has finished dragging a sash.
203 @event{EVT_SASH_DRAGGED_RANGE(id1, id2, func)}
204 Process a @c wxEVT_SASH_DRAGGED_RANGE event, when the user has finished
205 dragging a sash. The event handler is called when windows with ids in
206 the given range have their sashes dragged.
207 @endEventTable
208
209 @library{wxadv}
210 @category{events}
211
212 @see wxSashWindow, @ref overview_events
213*/
214class wxSashEvent : public wxCommandEvent
215{
216public:
217 /**
218 Constructor.
219 */
220 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
221
222 /**
223 Returns the rectangle representing the new size the window would be if the
224 resize was applied. It is up to the application to set the window size if required.
225 */
226 wxRect GetDragRect() const;
227
228 /**
229 Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE.
230
231 If the drag caused the notional bounding box of the window to flip over, for
232 example, the drag will be out of rage.
233 */
234 wxSashDragStatus GetDragStatus() const;
235
236 /**
237 Returns the dragged edge.
238
239 The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT.
240 */
241 wxSashEdgePosition GetEdge() const;
242
243
244 void SetEdge(wxSashEdgePosition edge);
245 void SetDragRect(const wxRect& rect);
246 void SetDragStatus(wxSashDragStatus status);
247};
248
249wxEventType wxEVT_SASH_DRAGGED;