]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_toplvl.i
New SWIG runtime files and api updates for the move to SWIG 1.3.22
[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
75 class wxTopLevelWindow : public wxWindow
76 {
77 public:
78
79 // No constructor as it can not be used directly from Python
80
81 // maximize = True => maximize, otherwise - restore
82 virtual void Maximize(bool maximize = True);
83
84 // undo Maximize() or Iconize()
85 virtual void Restore();
86
87 // iconize = True => iconize, otherwise - restore
88 virtual void Iconize(bool iconize = True);
89
90 // return True if the frame is maximized
91 virtual bool IsMaximized() const;
92
93 // return True if the frame is iconized
94 virtual bool IsIconized() const;
95
96 // get the frame icon
97 wxIcon GetIcon() const;
98
99 // set the frame icon
100 virtual void SetIcon(const wxIcon& icon);
101
102 // set the frame icons
103 virtual void SetIcons(const wxIconBundle& icons );
104
105 // maximize the window to cover entire screen
106 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
107
108 // return True if the frame is in fullscreen mode
109 virtual bool IsFullScreen() const;
110
111 virtual void SetTitle(const wxString& title);
112 virtual wxString GetTitle() const;
113
114 // Set the shape of the window to the given region.
115 // Returns True if the platform supports this feature (and the operation
116 // is successful.)
117 virtual bool SetShape(const wxRegion& region);
118
119 #ifdef __WXMAC__
120 void MacSetMetalAppearance( bool on ) ;
121 bool MacGetMetalAppearance() const ;
122 #endif
123 };
124
125
126 //---------------------------------------------------------------------------
127 %newgroup
128
129 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
130 //
131 // For each of *bars, a frame may have several of them, but only one is
132 // managed by the frame, i.e. resized/moved when the frame is and whose size
133 // is accounted for in client size calculations - all others should be taken
134 // care of manually.
135
136 MustHaveApp(wxFrame);
137
138 class wxFrame : public wxTopLevelWindow {
139 public:
140 %pythonAppend wxFrame "self._setOORInfo(self)"
141 %pythonAppend wxFrame() ""
142 %typemap(out) wxFrame*; // turn off this typemap
143
144 wxFrame(wxWindow* parent, const wxWindowID id=-1,
145 const wxString& title = wxPyEmptyString,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = wxPyFrameNameStr);
150 %name(PreFrame)wxFrame();
151
152 // Turn it back on again
153 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
154
155
156 bool Create(wxWindow* parent, const wxWindowID id=-1,
157 const wxString& title = wxPyEmptyString,
158 const wxPoint& pos = wxDefaultPosition,
159 const wxSize& size = wxDefaultSize,
160 long style = wxDEFAULT_FRAME_STYLE,
161 const wxString& name = wxPyFrameNameStr);
162
163
164 // frame state
165 // -----------
166
167 // get the origin of the client area (which may be different from (0, 0)
168 // if the frame has a toolbar) in client coordinates
169 virtual wxPoint GetClientAreaOrigin() const;
170
171 // sends a size event to the window using its current size -- this has an
172 // effect of refreshing the window layout
173 //
174 virtual void SendSizeEvent();
175
176
177 // menu bar functions
178 // ------------------
179
180 virtual void SetMenuBar(wxMenuBar *menubar);
181 virtual wxMenuBar *GetMenuBar() const;
182
183
184 // process menu command: returns True if processed
185 bool ProcessCommand(int winid);
186 %pythoncode { Command = ProcessCommand }
187
188
189 // status bar functions
190 // --------------------
191
192 // create the main status bar by calling OnCreateStatusBar()
193 virtual wxStatusBar* CreateStatusBar(int number = 1,
194 long style = wxDEFAULT_STATUSBAR_STYLE,
195 wxWindowID winid = 0,
196 const wxString& name = wxPyStatusLineNameStr);
197 // TODO: with directors?
198 // // return a new status bar
199 // virtual wxStatusBar *OnCreateStatusBar(int number,
200 // long style,
201 // wxWindowID winid,
202 // const wxString& name);
203
204 // get the main status bar
205 virtual wxStatusBar *GetStatusBar() const;
206
207 // sets the main status bar
208 void SetStatusBar(wxStatusBar *statBar);
209
210 // forward these to status bar
211 virtual void SetStatusText(const wxString &text, int number = 0);
212 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
213 void PushStatusText(const wxString &text, int number = 0);
214 void PopStatusText(int number = 0);
215
216 // set the status bar pane the help will be shown in
217 void SetStatusBarPane(int n);
218 int GetStatusBarPane() const;
219
220
221 // toolbar functions
222 // -----------------
223
224 // create main toolbar bycalling OnCreateToolBar()
225 virtual wxToolBar* CreateToolBar(long style = -1,
226 wxWindowID winid = -1,
227 const wxString& name = wxPyToolBarNameStr);
228 // TODO: with directors?
229 // // return a new toolbar
230 // virtual wxToolBar *OnCreateToolBar(long style,
231 // wxWindowID winid,
232 // const wxString& name );
233
234 // get/set the main toolbar
235 virtual wxToolBar *GetToolBar() const;
236 virtual void SetToolBar(wxToolBar *toolbar);
237
238
239 // show help text (typically in the statusbar); show is False
240 // if you are hiding the help, True otherwise
241 virtual void DoGiveHelp(const wxString& text, bool show);
242
243
244 // send wxUpdateUIEvents for all menu items in the menubar,
245 // or just for menu if non-NULL
246 void DoMenuUpdates(wxMenu* menu = NULL);
247
248 static wxVisualAttributes
249 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
250 };
251
252 //---------------------------------------------------------------------------
253 %newgroup
254
255 MustHaveApp(wxDialog);
256
257 class wxDialog : public wxTopLevelWindow {
258 public:
259 %pythonAppend wxDialog "self._setOORInfo(self)"
260 %pythonAppend wxDialog() ""
261 %typemap(out) wxDialog*; // turn off this typemap
262
263 wxDialog(wxWindow* parent,
264 const wxWindowID id=-1,
265 const wxString& title = wxPyEmptyString,
266 const wxPoint& pos = wxDefaultPosition,
267 const wxSize& size = wxDefaultSize,
268 long style = wxDEFAULT_DIALOG_STYLE,
269 const wxString& name = wxPyDialogNameStr);
270 %name(PreDialog)wxDialog();
271
272 // Turn it back on again
273 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
274
275 bool Create(wxWindow* parent,
276 const wxWindowID id=-1,
277 const wxString& title = wxPyEmptyString,
278 const wxPoint& pos = wxDefaultPosition,
279 const wxSize& size = wxDefaultSize,
280 long style = wxDEFAULT_DIALOG_STYLE,
281 const wxString& name = wxPyDialogNameStr);
282
283
284 // the modal dialogs have a return code - usually the id of the last
285 // pressed button
286 void SetReturnCode(int returnCode);
287 int GetReturnCode() const;
288
289 // splits text up at newlines and places the
290 // lines into a vertical wxBoxSizer
291 wxSizer *CreateTextSizer( const wxString &message );
292
293 // places buttons into a horizontal wxBoxSizer
294 wxSizer *CreateButtonSizer( long flags );
295
296
297 //void SetModal(bool flag);
298
299 // is the dialog in modal state right now?
300 virtual bool IsModal() const;
301
302 // Shows the dialog and starts a nested event loop that returns when
303 // EndModal is called.
304 virtual int ShowModal();
305
306 // may be called to terminate the dialog with the given return code
307 virtual void EndModal(int retCode);
308
309 static wxVisualAttributes
310 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
311
312 %pythoncode {
313 def SendSizeEvent(self):
314 self.ProcessEvent(wx.SizeEvent((-1,-1)))
315 }
316 };
317
318 //---------------------------------------------------------------------------
319 %newgroup
320
321
322 MustHaveApp(wxMiniFrame);
323
324 class wxMiniFrame : public wxFrame {
325 public:
326 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
327 %pythonAppend wxMiniFrame() ""
328
329 wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
330 const wxString& title = wxPyEmptyString,
331 const wxPoint& pos = wxDefaultPosition,
332 const wxSize& size = wxDefaultSize,
333 long style = wxDEFAULT_FRAME_STYLE,
334 const wxString& name = wxPyFrameNameStr);
335 %name(PreMiniFrame)wxMiniFrame();
336
337 bool Create(wxWindow* parent, const wxWindowID id=-1,
338 const wxString& title = wxPyEmptyString,
339 const wxPoint& pos = wxDefaultPosition,
340 const wxSize& size = wxDefaultSize,
341 long style = wxDEFAULT_FRAME_STYLE,
342 const wxString& name = wxPyFrameNameStr);
343
344 };
345
346
347 //---------------------------------------------------------------------------
348 %newgroup
349
350
351 enum {
352 wxSPLASH_CENTRE_ON_PARENT,
353 wxSPLASH_CENTRE_ON_SCREEN,
354 wxSPLASH_NO_CENTRE,
355 wxSPLASH_TIMEOUT,
356 wxSPLASH_NO_TIMEOUT,
357 };
358
359
360 MustHaveApp(wxSplashScreenWindow);
361
362 class wxSplashScreenWindow: public wxWindow
363 {
364 public:
365 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
366
367 wxSplashScreenWindow(const wxBitmap& bitmap,
368 wxWindow* parent, wxWindowID id,
369 const wxPoint& pos = wxDefaultPosition,
370 const wxSize& size = wxDefaultSize,
371 long style = wxNO_BORDER);
372
373 void SetBitmap(const wxBitmap& bitmap);
374 wxBitmap& GetBitmap();
375 };
376
377
378 MustHaveApp(wxSplashScreen);
379
380 class wxSplashScreen : public wxFrame {
381 public:
382 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
383
384 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
385 wxWindow* parent, wxWindowID id=-1,
386 const wxPoint& pos = wxDefaultPosition,
387 const wxSize& size = wxDefaultSize,
388 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
389
390 long GetSplashStyle() const;
391 wxSplashScreenWindow* GetSplashWindow() const;
392 int GetTimeout() const;
393 };
394
395
396 //---------------------------------------------------------------------------