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