]>
Commit | Line | Data |
---|---|---|
9c039d08 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d14a1e28 RD |
2 | // Name: _toplvl.i |
3 | // Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc. | |
9c039d08 RD |
4 | // |
5 | // Author: Robin Dunn | |
6 | // | |
d14a1e28 | 7 | // Created: 27-Aug-1998 |
9c039d08 | 8 | // RCS-ID: $Id$ |
d14a1e28 | 9 | // Copyright: (c) 2003 by Total Control Software |
9c039d08 RD |
10 | // Licence: wxWindows license |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
d14a1e28 | 13 | // Not a %module |
9c039d08 | 14 | |
9c039d08 | 15 | |
d14a1e28 | 16 | //--------------------------------------------------------------------------- |
9c039d08 | 17 | |
b2dc1044 RD |
18 | MAKE_CONST_WXSTRING(FrameNameStr); |
19 | MAKE_CONST_WXSTRING(DialogNameStr); | |
20 | MAKE_CONST_WXSTRING(StatusLineNameStr); | |
21 | MAKE_CONST_WXSTRING(ToolBarNameStr); | |
137b5242 | 22 | |
d14a1e28 RD |
23 | //--------------------------------------------------------------------------- |
24 | %newgroup | |
137b5242 | 25 | |
447f48ba RD |
26 | enum |
27 | { | |
28 | wxSTAY_ON_TOP, | |
29 | wxICONIZE, | |
30 | wxMINIMIZE, | |
31 | wxMAXIMIZE, | |
32 | wxCLOSE_BOX, | |
33 | wxTHICK_FRAME, | |
34 | wxSYSTEM_MENU, | |
35 | wxMINIMIZE_BOX, | |
36 | wxMAXIMIZE_BOX, | |
37 | wxTINY_CAPTION_HORIZ, | |
38 | wxTINY_CAPTION_VERT, | |
39 | wxRESIZE_BOX, | |
40 | wxRESIZE_BORDER, | |
41 | ||
42 | wxDIALOG_NO_PARENT, | |
43 | ||
44 | wxDEFAULT_FRAME_STYLE, | |
45 | wxDEFAULT_DIALOG_STYLE, | |
46 | ||
47 | wxFRAME_TOOL_WINDOW, | |
48 | wxFRAME_FLOAT_ON_PARENT, | |
49 | wxFRAME_NO_WINDOW_MENU, | |
50 | wxFRAME_NO_TASKBAR, | |
51 | wxFRAME_SHAPED, | |
52 | ||
53 | // Obsolete | |
6cffbf02 RD |
54 | wxDIALOG_MODAL, |
55 | wxDIALOG_MODELESS, | |
56 | wxUSER_COLOURS, | |
57 | wxNO_3D, | |
447f48ba RD |
58 | }; |
59 | ||
d14a1e28 RD |
60 | enum |
61 | { | |
f6bcfd97 BP |
62 | wxFULLSCREEN_NOMENUBAR, |
63 | wxFULLSCREEN_NOTOOLBAR, | |
64 | wxFULLSCREEN_NOSTATUSBAR, | |
65 | wxFULLSCREEN_NOBORDER, | |
66 | wxFULLSCREEN_NOCAPTION, | |
ecc08ead RD |
67 | wxFULLSCREEN_ALL, |
68 | ||
69 | wxTOPLEVEL_EX_DIALOG, | |
f6bcfd97 BP |
70 | }; |
71 | ||
72 | ||
ecc08ead | 73 | |
d14a1e28 RD |
74 | %typemap(in) (int widths, int* widths_field) { |
75 | $1 = PyList_Size($input); | |
76 | $2 = int_LIST_helper($input); | |
77 | if ($2 == NULL) SWIG_fail; | |
78 | } | |
79 | ||
80 | %typemap(freearg) (int widths, int* widths_field) { | |
81 | if ($2) delete [] $2; | |
82 | } | |
83 | ||
84 | ||
85 | //--------------------------------------------------------------------------- | |
ecc08ead RD |
86 | |
87 | class wxTopLevelWindow : public wxWindow | |
88 | { | |
89 | public: | |
ecc08ead | 90 | |
d14a1e28 | 91 | // No constructor as it can not be used directly from Python |
ecc08ead | 92 | |
dd9f7fea RD |
93 | // maximize = True => maximize, otherwise - restore |
94 | virtual void Maximize(bool maximize = True); | |
ecc08ead RD |
95 | |
96 | // undo Maximize() or Iconize() | |
97 | virtual void Restore(); | |
98 | ||
dd9f7fea RD |
99 | // iconize = True => iconize, otherwise - restore |
100 | virtual void Iconize(bool iconize = True); | |
ecc08ead | 101 | |
dd9f7fea | 102 | // return True if the frame is maximized |
ecc08ead RD |
103 | virtual bool IsMaximized() const; |
104 | ||
dd9f7fea | 105 | // return True if the frame is iconized |
ecc08ead RD |
106 | virtual bool IsIconized() const; |
107 | ||
108 | // get the frame icon | |
c5943253 | 109 | wxIcon GetIcon() const; |
ecc08ead RD |
110 | |
111 | // set the frame icon | |
112 | virtual void SetIcon(const wxIcon& icon); | |
113 | ||
0e9b78ce RD |
114 | // set the frame icons |
115 | virtual void SetIcons(const wxIconBundle& icons ); | |
ecc08ead RD |
116 | |
117 | // maximize the window to cover entire screen | |
118 | virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
119 | ||
dd9f7fea | 120 | // return True if the frame is in fullscreen mode |
ecc08ead RD |
121 | virtual bool IsFullScreen() const; |
122 | ||
123 | virtual void SetTitle(const wxString& title); | |
124 | virtual wxString GetTitle() const; | |
1542ea39 RD |
125 | |
126 | // Set the shape of the window to the given region. | |
dd9f7fea | 127 | // Returns True if the platform supports this feature (and the operation |
1542ea39 RD |
128 | // is successful.) |
129 | virtual bool SetShape(const wxRegion& region); | |
130 | ||
a212b779 RD |
131 | #ifdef __WXMAC__ |
132 | void MacSetMetalAppearance( bool on ) ; | |
133 | bool MacGetMetalAppearance() const ; | |
134 | #endif | |
ecc08ead RD |
135 | }; |
136 | ||
ecc08ead | 137 | |
d14a1e28 RD |
138 | //--------------------------------------------------------------------------- |
139 | %newgroup | |
140 | ||
141 | // wxFrame is a top-level window with optional menubar, statusbar and toolbar | |
142 | // | |
143 | // For each of *bars, a frame may have several of them, but only one is | |
144 | // managed by the frame, i.e. resized/moved when the frame is and whose size | |
145 | // is accounted for in client size calculations - all others should be taken | |
146 | // care of manually. | |
ecc08ead RD |
147 | |
148 | class wxFrame : public wxTopLevelWindow { | |
9c039d08 | 149 | public: |
2b9048c5 RD |
150 | %pythonAppend wxFrame "self._setOORInfo(self)" |
151 | %pythonAppend wxFrame() "" | |
d14a1e28 | 152 | |
9c039d08 | 153 | wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title, |
b68dc582 RD |
154 | const wxPoint& pos = wxDefaultPosition, |
155 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 156 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 157 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 158 | %name(PreFrame)wxFrame(); |
9c039d08 | 159 | |
09f3d4e6 RD |
160 | bool Create(wxWindow* parent, const wxWindowID id, const wxString& title, |
161 | const wxPoint& pos = wxDefaultPosition, | |
162 | const wxSize& size = wxDefaultSize, | |
163 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 164 | const wxString& name = wxPyFrameNameStr); |
9c039d08 | 165 | |
0122b7e3 | 166 | |
d14a1e28 RD |
167 | // frame state |
168 | // ----------- | |
ecc08ead | 169 | |
d14a1e28 RD |
170 | // get the origin of the client area (which may be different from (0, 0) |
171 | // if the frame has a toolbar) in client coordinates | |
172 | virtual wxPoint GetClientAreaOrigin() const; | |
173 | ||
174 | // sends a size event to the window using its current size -- this has an | |
175 | // effect of refreshing the window layout | |
176 | // | |
177 | virtual void SendSizeEvent() { } | |
178 | ||
179 | ||
180 | // menu bar functions | |
181 | // ------------------ | |
182 | ||
183 | virtual void SetMenuBar(wxMenuBar *menubar); | |
184 | virtual wxMenuBar *GetMenuBar() const; | |
ecc08ead RD |
185 | |
186 | ||
dd9f7fea | 187 | // process menu command: returns True if processed |
d14a1e28 RD |
188 | bool ProcessCommand(int winid); |
189 | %pythoncode { Command = ProcessCommand } | |
190 | ||
ecc08ead | 191 | |
d14a1e28 RD |
192 | // status bar functions |
193 | // -------------------- | |
194 | ||
195 | // create the main status bar by calling OnCreateStatusBar() | |
196 | virtual wxStatusBar* CreateStatusBar(int number = 1, | |
69d81895 | 197 | long style = wxDEFAULT_STATUSBAR_STYLE, |
d14a1e28 RD |
198 | wxWindowID winid = 0, |
199 | const wxString& name = wxPyStatusLineNameStr); | |
200 | // TODO: with directors? | |
201 | // // return a new status bar | |
202 | // virtual wxStatusBar *OnCreateStatusBar(int number, | |
203 | // long style, | |
204 | // wxWindowID winid, | |
205 | // const wxString& name); | |
ecc08ead RD |
206 | |
207 | // get the main status bar | |
d14a1e28 | 208 | virtual wxStatusBar *GetStatusBar() const; |
ecc08ead RD |
209 | |
210 | // sets the main status bar | |
211 | void SetStatusBar(wxStatusBar *statBar); | |
212 | ||
213 | // forward these to status bar | |
214 | virtual void SetStatusText(const wxString &text, int number = 0); | |
d14a1e28 | 215 | virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above |
94e36a51 RD |
216 | void PushStatusText(const wxString &text, int number = 0); |
217 | void PopStatusText(int number = 0); | |
218 | ||
94e36a51 RD |
219 | // set the status bar pane the help will be shown in |
220 | void SetStatusBarPane(int n); | |
221 | int GetStatusBarPane() const; | |
ecc08ead RD |
222 | |
223 | ||
d14a1e28 RD |
224 | // toolbar functions |
225 | // ----------------- | |
226 | ||
227 | // create main toolbar bycalling OnCreateToolBar() | |
228 | virtual wxToolBar* CreateToolBar(long style = -1, | |
229 | wxWindowID winid = -1, | |
137b5242 | 230 | const wxString& name = wxPyToolBarNameStr); |
d14a1e28 RD |
231 | // TODO: with directors? |
232 | // // return a new toolbar | |
233 | // virtual wxToolBar *OnCreateToolBar(long style, | |
234 | // wxWindowID winid, | |
235 | // const wxString& name ); | |
ecc08ead RD |
236 | |
237 | // get/set the main toolbar | |
d14a1e28 RD |
238 | virtual wxToolBar *GetToolBar() const; |
239 | virtual void SetToolBar(wxToolBar *toolbar); | |
ecc08ead | 240 | |
d14a1e28 | 241 | |
dd9f7fea RD |
242 | // show help text (typically in the statusbar); show is False |
243 | // if you are hiding the help, True otherwise | |
d14a1e28 | 244 | virtual void DoGiveHelp(const wxString& text, bool show); |
3ef86e32 RD |
245 | |
246 | ||
247 | // send wxUpdateUIEvents for all menu items in the menubar, | |
248 | // or just for menu if non-NULL | |
249 | void DoMenuUpdates(wxMenu* menu = NULL); | |
9c039d08 RD |
250 | }; |
251 | ||
ecc08ead | 252 | //--------------------------------------------------------------------------- |
d14a1e28 | 253 | %newgroup |
ecc08ead RD |
254 | |
255 | class wxDialog : public wxTopLevelWindow { | |
256 | public: | |
2b9048c5 RD |
257 | %pythonAppend wxDialog "self._setOORInfo(self)" |
258 | %pythonAppend wxDialog() "" | |
d14a1e28 | 259 | |
ecc08ead RD |
260 | wxDialog(wxWindow* parent, |
261 | const wxWindowID id, | |
262 | const wxString& title, | |
263 | const wxPoint& pos = wxDefaultPosition, | |
264 | const wxSize& size = wxDefaultSize, | |
265 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 266 | const wxString& name = wxPyDialogNameStr); |
d14a1e28 | 267 | %name(PreDialog)wxDialog(); |
ecc08ead RD |
268 | |
269 | bool Create(wxWindow* parent, | |
270 | const wxWindowID id, | |
271 | const wxString& title, | |
272 | const wxPoint& pos = wxDefaultPosition, | |
273 | const wxSize& size = wxDefaultSize, | |
274 | long style = wxDEFAULT_DIALOG_STYLE, | |
137b5242 | 275 | const wxString& name = wxPyDialogNameStr); |
ecc08ead | 276 | |
0122b7e3 | 277 | |
d14a1e28 RD |
278 | // the modal dialogs have a return code - usually the id of the last |
279 | // pressed button | |
280 | void SetReturnCode(int returnCode) { m_returnCode = returnCode; } | |
281 | int GetReturnCode() const { return m_returnCode; } | |
ecc08ead | 282 | |
d14a1e28 RD |
283 | // splits text up at newlines and places the |
284 | // lines into a vertical wxBoxSizer | |
285 | wxSizer *CreateTextSizer( const wxString &message ); | |
ecc08ead | 286 | |
d14a1e28 RD |
287 | // places buttons into a horizontal wxBoxSizer |
288 | wxSizer *CreateButtonSizer( long flags ); | |
ecc08ead | 289 | |
ecc08ead | 290 | |
f87da722 RD |
291 | //void SetModal(bool flag); |
292 | ||
293 | // is the dialog in modal state right now? | |
d14a1e28 RD |
294 | virtual bool IsModal() const; |
295 | ||
296 | // Shows the dialog and starts a nested event loop that returns when | |
297 | // EndModal is called. | |
298 | virtual int ShowModal(); | |
299 | ||
300 | // may be called to terminate the dialog with the given return code | |
301 | virtual void EndModal(int retCode); | |
d14a1e28 | 302 | }; |
ecc08ead | 303 | |
9c039d08 | 304 | //--------------------------------------------------------------------------- |
d14a1e28 RD |
305 | %newgroup |
306 | ||
9c039d08 | 307 | |
9c039d08 RD |
308 | class wxMiniFrame : public wxFrame { |
309 | public: | |
2b9048c5 RD |
310 | %pythonAppend wxMiniFrame "self._setOORInfo(self)" |
311 | %pythonAppend wxMiniFrame() "" | |
d14a1e28 | 312 | |
9c039d08 | 313 | wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title, |
b68dc582 RD |
314 | const wxPoint& pos = wxDefaultPosition, |
315 | const wxSize& size = wxDefaultSize, | |
9c039d08 | 316 | long style = wxDEFAULT_FRAME_STYLE, |
137b5242 | 317 | const wxString& name = wxPyFrameNameStr); |
d14a1e28 | 318 | %name(PreMiniFrame)wxMiniFrame(); |
9c039d08 | 319 | |
09f3d4e6 RD |
320 | bool Create(wxWindow* parent, const wxWindowID id, const wxString& title, |
321 | const wxPoint& pos = wxDefaultPosition, | |
322 | const wxSize& size = wxDefaultSize, | |
323 | long style = wxDEFAULT_FRAME_STYLE, | |
137b5242 | 324 | const wxString& name = wxPyFrameNameStr); |
0122b7e3 | 325 | |
9c039d08 | 326 | }; |
b8b8dda7 RD |
327 | |
328 | ||
329 | //--------------------------------------------------------------------------- | |
d14a1e28 RD |
330 | %newgroup |
331 | ||
b8b8dda7 | 332 | |
b5a5d647 RD |
333 | enum { |
334 | wxSPLASH_CENTRE_ON_PARENT, | |
335 | wxSPLASH_CENTRE_ON_SCREEN, | |
336 | wxSPLASH_NO_CENTRE, | |
337 | wxSPLASH_TIMEOUT, | |
338 | wxSPLASH_NO_TIMEOUT, | |
339 | }; | |
340 | ||
341 | ||
342 | class wxSplashScreenWindow: public wxWindow | |
343 | { | |
344 | public: | |
2b9048c5 | 345 | %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)" |
d14a1e28 | 346 | |
b5a5d647 RD |
347 | wxSplashScreenWindow(const wxBitmap& bitmap, |
348 | wxWindow* parent, wxWindowID id, | |
349 | const wxPoint& pos = wxDefaultPosition, | |
350 | const wxSize& size = wxDefaultSize, | |
351 | long style = wxNO_BORDER); | |
352 | ||
353 | void SetBitmap(const wxBitmap& bitmap); | |
354 | wxBitmap& GetBitmap(); | |
355 | }; | |
356 | ||
357 | ||
358 | class wxSplashScreen : public wxFrame { | |
359 | public: | |
2b9048c5 | 360 | %pythonAppend wxSplashScreen "self._setOORInfo(self)" |
d14a1e28 | 361 | |
b5a5d647 RD |
362 | wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds, |
363 | wxWindow* parent, wxWindowID id, | |
364 | const wxPoint& pos = wxDefaultPosition, | |
365 | const wxSize& size = wxDefaultSize, | |
479101ca | 366 | long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP); |
b5a5d647 RD |
367 | |
368 | long GetSplashStyle() const; | |
369 | wxSplashScreenWindow* GetSplashWindow() const; | |
370 | int GetTimeout() const; | |
371 | }; | |
372 | ||
373 | ||
374 | //--------------------------------------------------------------------------- |