]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: sashwin.h | |
3 | // Purpose: interface of wxSashWindow | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | ||
10 | /** | |
11 | See wxSashWindow. | |
12 | */ | |
13 | enum 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 | */ | |
25 | enum wxSashDragStatus | |
26 | { | |
27 | wxSASH_STATUS_OK, | |
28 | wxSASH_STATUS_OUT_OF_RANGE | |
29 | }; | |
30 | ||
31 | ||
32 | /** | |
33 | @class wxSashWindow | |
34 | ||
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. | |
38 | ||
39 | The window (or an ancestor) will be notified of a drag via a | |
40 | wxSashEvent notification. | |
41 | ||
42 | @beginStyleTable | |
43 | @style{wxSW_3D} | |
44 | Draws a 3D effect sash and border. | |
45 | @style{wxSW_3DSASH} | |
46 | Draws a 3D effect sash. | |
47 | @style{wxSW_3DBORDER} | |
48 | Draws a 3D effect border. | |
49 | @style{wxSW_BORDER} | |
50 | Draws a thin black border. | |
51 | @endStyleTable | |
52 | ||
53 | @beginEventEmissionTable{wxSashEvent} | |
54 | @event{EVT_SASH_DRAGGED(id, func)} | |
55 | Process a wxEVT_SASH_DRAGGED event, when the user has finished | |
56 | dragging a sash. | |
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. | |
61 | @endEventTable | |
62 | ||
63 | @library{wxadv} | |
64 | @category{miscwnd} | |
65 | ||
66 | @see wxSashEvent, wxSashLayoutWindow, @ref overview_events | |
67 | */ | |
68 | class wxSashWindow : public wxWindow | |
69 | { | |
70 | public: | |
71 | /** | |
72 | Default ctor. | |
73 | */ | |
74 | wxSashWindow(); | |
75 | ||
76 | /** | |
77 | Constructs a sash window, which can be a child of a frame, dialog or any other | |
78 | non-control window. | |
79 | ||
80 | @param parent | |
81 | Pointer to a parent window. | |
82 | @param id | |
83 | Window identifier. If -1, will automatically create an identifier. | |
84 | @param pos | |
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. | |
88 | @param size | |
89 | Window size. wxDefaultSize is (-1, -1) which indicates that wxSashWindows | |
90 | should generate a default size for the window. | |
91 | @param style | |
92 | Window style. For window styles, please see wxSashWindow. | |
93 | @param name | |
94 | Window name. | |
95 | */ | |
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"); | |
101 | ||
102 | /** | |
103 | Destructor. | |
104 | */ | |
105 | virtual ~wxSashWindow(); | |
106 | ||
107 | /** | |
108 | Gets the maximum window size in the x direction. | |
109 | */ | |
110 | virtual int GetMaximumSizeX() const; | |
111 | ||
112 | /** | |
113 | Gets the maximum window size in the y direction. | |
114 | */ | |
115 | virtual int GetMaximumSizeY() const; | |
116 | ||
117 | /** | |
118 | Gets the minimum window size in the x direction. | |
119 | */ | |
120 | virtual int GetMinimumSizeX() const; | |
121 | ||
122 | /** | |
123 | Gets the minimum window size in the y direction. | |
124 | */ | |
125 | virtual int GetMinimumSizeY() const; | |
126 | ||
127 | /** | |
128 | Returns @true if a sash is visible on the given edge, @false otherwise. | |
129 | ||
130 | @param edge | |
131 | Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT. | |
132 | ||
133 | @see SetSashVisible() | |
134 | */ | |
135 | bool GetSashVisible(wxSashEdgePosition edge) const; | |
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. | |
140 | ||
141 | @param edge | |
142 | Edge. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT. | |
143 | ||
144 | @see SetSashBorder() | |
145 | */ | |
146 | bool HasBorder(wxSashEdgePosition edge) const; | |
147 | ||
148 | /** | |
149 | Sets the maximum window size in the x direction. | |
150 | */ | |
151 | virtual void SetMaximumSizeX(int min); | |
152 | ||
153 | /** | |
154 | Sets the maximum window size in the y direction. | |
155 | */ | |
156 | virtual void SetMaximumSizeY(int min); | |
157 | ||
158 | /** | |
159 | Sets the minimum window size in the x direction. | |
160 | */ | |
161 | virtual void SetMinimumSizeX(int min); | |
162 | ||
163 | /** | |
164 | Sets the minimum window size in the y direction. | |
165 | */ | |
166 | virtual void SetMinimumSizeY(int min); | |
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. | |
171 | ||
172 | @param edge | |
173 | Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT. | |
174 | @param hasBorder | |
175 | @true to give the sash a border visible, @false to remove it. | |
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. | |
181 | ||
182 | @param edge | |
183 | Edge to change. One of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT. | |
184 | @param visible | |
185 | @true to make the sash visible, @false to make it invisible. | |
186 | ||
187 | @see GetSashVisible() | |
188 | */ | |
189 | void SetSashVisible(wxSashEdgePosition edge, bool visible); | |
190 | }; | |
191 | ||
192 | ||
193 | ||
194 | /** | |
195 | @class wxSashEvent | |
196 | ||
197 | A sash event is sent when the sash of a wxSashWindow has been | |
198 | dragged by the user. | |
199 | ||
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 | ||
222 | @library{wxadv} | |
223 | @category{events} | |
224 | ||
225 | @see wxSashWindow, @ref overview_events | |
226 | */ | |
227 | class wxSashEvent : public wxCommandEvent | |
228 | { | |
229 | public: | |
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 | |
237 | resize was applied. It is up to the application to set the window size if required. | |
238 | */ | |
239 | wxRect GetDragRect() const; | |
240 | ||
241 | /** | |
242 | Returns the status of the sash: one of wxSASH_STATUS_OK, wxSASH_STATUS_OUT_OF_RANGE. | |
243 | ||
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 | */ | |
247 | wxSashDragStatus GetDragStatus() const; | |
248 | ||
249 | /** | |
250 | Returns the dragged edge. | |
251 | ||
252 | The return value is one of wxSASH_TOP, wxSASH_RIGHT, wxSASH_BOTTOM, wxSASH_LEFT. | |
253 | */ | |
254 | wxSashEdgePosition GetEdge() const; | |
255 | }; | |
256 |