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