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