]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
Get/SetTitle only for wxTopLevelWindow (wxMGL part).
[wxWidgets.git] / wxPython / src / _toplvl.i
CommitLineData
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
18MAKE_CONST_WXSTRING(FrameNameStr);
19MAKE_CONST_WXSTRING(DialogNameStr);
20MAKE_CONST_WXSTRING(StatusLineNameStr);
21MAKE_CONST_WXSTRING(ToolBarNameStr);
137b5242 22
d14a1e28
RD
23//---------------------------------------------------------------------------
24%newgroup
137b5242 25
447f48ba
RD
26enum
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,
c430d0dc 52 wxFRAME_DRAWER,
4a065572
RD
53
54 wxFRAME_EX_METAL,
55 wxDIALOG_EX_METAL,
c430d0dc 56
447f48ba 57 // Obsolete
6cffbf02
RD
58 wxDIALOG_MODAL,
59 wxDIALOG_MODELESS,
60 wxUSER_COLOURS,
61 wxNO_3D,
447f48ba
RD
62};
63
d14a1e28
RD
64enum
65{
f6bcfd97
BP
66 wxFULLSCREEN_NOMENUBAR,
67 wxFULLSCREEN_NOTOOLBAR,
68 wxFULLSCREEN_NOSTATUSBAR,
69 wxFULLSCREEN_NOBORDER,
70 wxFULLSCREEN_NOCAPTION,
ecc08ead
RD
71 wxFULLSCREEN_ALL,
72
73 wxTOPLEVEL_EX_DIALOG,
f6bcfd97
BP
74};
75
e51483b1
RD
76// Styles for RequestUserAttention
77enum
78{
79 wxUSER_ATTENTION_INFO = 1,
80 wxUSER_ATTENTION_ERROR = 2
81};
f6bcfd97 82
d14a1e28 83//---------------------------------------------------------------------------
ecc08ead
RD
84
85class wxTopLevelWindow : public wxWindow
86{
87public:
ecc08ead 88
d14a1e28 89 // No constructor as it can not be used directly from Python
ecc08ead 90
dd9f7fea 91 // maximize = True => maximize, otherwise - restore
a72f4631 92 virtual void Maximize(bool maximize = true);
ecc08ead
RD
93
94 // undo Maximize() or Iconize()
95 virtual void Restore();
96
dd9f7fea 97 // iconize = True => iconize, otherwise - restore
a72f4631 98 virtual void Iconize(bool iconize = true);
ecc08ead 99
dd9f7fea 100 // return True if the frame is maximized
ecc08ead
RD
101 virtual bool IsMaximized() const;
102
dd9f7fea 103 // return True if the frame is iconized
ecc08ead
RD
104 virtual bool IsIconized() const;
105
106 // get the frame icon
c5943253 107 wxIcon GetIcon() const;
ecc08ead
RD
108
109 // set the frame icon
110 virtual void SetIcon(const wxIcon& icon);
111
0e9b78ce
RD
112 // set the frame icons
113 virtual void SetIcons(const wxIconBundle& icons );
ecc08ead
RD
114
115 // maximize the window to cover entire screen
116 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
117
dd9f7fea 118 // return True if the frame is in fullscreen mode
ecc08ead
RD
119 virtual bool IsFullScreen() const;
120
121 virtual void SetTitle(const wxString& title);
122 virtual wxString GetTitle() const;
1542ea39
RD
123
124 // Set the shape of the window to the given region.
dd9f7fea 125 // Returns True if the platform supports this feature (and the operation
1542ea39
RD
126 // is successful.)
127 virtual bool SetShape(const wxRegion& region);
128
e51483b1
RD
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
2e5cc335
RD
134 // Is this the active frame (highlighted in the taskbar)?
135 virtual bool IsActive();
136
a212b779
RD
137#ifdef __WXMAC__
138 void MacSetMetalAppearance( bool on ) ;
139 bool MacGetMetalAppearance() const ;
3e98bb2a
RD
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 }
a212b779 146#endif
ecc08ead
RD
147};
148
ecc08ead 149
d14a1e28
RD
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.
ecc08ead 159
ab1f7d2a
RD
160MustHaveApp(wxFrame);
161
ecc08ead 162class wxFrame : public wxTopLevelWindow {
9c039d08 163public:
2b9048c5
RD
164 %pythonAppend wxFrame "self._setOORInfo(self)"
165 %pythonAppend wxFrame() ""
b39c3fa0 166 %typemap(out) wxFrame*; // turn off this typemap
d14a1e28 167
d5573410
RD
168 wxFrame(wxWindow* parent, const wxWindowID id=-1,
169 const wxString& title = wxPyEmptyString,
b68dc582
RD
170 const wxPoint& pos = wxDefaultPosition,
171 const wxSize& size = wxDefaultSize,
9c039d08 172 long style = wxDEFAULT_FRAME_STYLE,
137b5242 173 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 174 %RenameCtor(PreFrame, wxFrame());
9c039d08 175
b39c3fa0
RD
176 // Turn it back on again
177 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
178
179
d5573410
RD
180 bool Create(wxWindow* parent, const wxWindowID id=-1,
181 const wxString& title = wxPyEmptyString,
09f3d4e6
RD
182 const wxPoint& pos = wxDefaultPosition,
183 const wxSize& size = wxDefaultSize,
184 long style = wxDEFAULT_FRAME_STYLE,
137b5242 185 const wxString& name = wxPyFrameNameStr);
9c039d08 186
0122b7e3 187
d14a1e28
RD
188 // frame state
189 // -----------
ecc08ead 190
d14a1e28
RD
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
705b61cc 197 virtual void SendSizeEvent();
d14a1e28
RD
198
199
200 // menu bar functions
201 // ------------------
202
203 virtual void SetMenuBar(wxMenuBar *menubar);
204 virtual wxMenuBar *GetMenuBar() const;
ecc08ead
RD
205
206
dd9f7fea 207 // process menu command: returns True if processed
d14a1e28
RD
208 bool ProcessCommand(int winid);
209 %pythoncode { Command = ProcessCommand }
210
ecc08ead 211
d14a1e28
RD
212 // status bar functions
213 // --------------------
214
215 // create the main status bar by calling OnCreateStatusBar()
216 virtual wxStatusBar* CreateStatusBar(int number = 1,
69d81895 217 long style = wxDEFAULT_STATUSBAR_STYLE,
d14a1e28
RD
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);
ecc08ead
RD
226
227 // get the main status bar
d14a1e28 228 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
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);
d14a1e28 235 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
94e36a51
RD
236 void PushStatusText(const wxString &text, int number = 0);
237 void PopStatusText(int number = 0);
238
94e36a51
RD
239 // set the status bar pane the help will be shown in
240 void SetStatusBarPane(int n);
241 int GetStatusBarPane() const;
ecc08ead
RD
242
243
d14a1e28
RD
244 // toolbar functions
245 // -----------------
246
247 // create main toolbar bycalling OnCreateToolBar()
248 virtual wxToolBar* CreateToolBar(long style = -1,
249 wxWindowID winid = -1,
137b5242 250 const wxString& name = wxPyToolBarNameStr);
d14a1e28
RD
251// TODO: with directors?
252// // return a new toolbar
253// virtual wxToolBar *OnCreateToolBar(long style,
254// wxWindowID winid,
255// const wxString& name );
ecc08ead
RD
256
257 // get/set the main toolbar
d14a1e28
RD
258 virtual wxToolBar *GetToolBar() const;
259 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 260
d14a1e28 261
dd9f7fea
RD
262 // show help text (typically in the statusbar); show is False
263 // if you are hiding the help, True otherwise
d14a1e28 264 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32
RD
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);
880715c9
RD
270
271 static wxVisualAttributes
272 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
9c039d08
RD
273};
274
ecc08ead 275//---------------------------------------------------------------------------
d14a1e28 276%newgroup
ecc08ead 277
ab1f7d2a
RD
278MustHaveApp(wxDialog);
279
ecc08ead
RD
280class wxDialog : public wxTopLevelWindow {
281public:
2b9048c5
RD
282 %pythonAppend wxDialog "self._setOORInfo(self)"
283 %pythonAppend wxDialog() ""
b39c3fa0 284 %typemap(out) wxDialog*; // turn off this typemap
d14a1e28 285
ecc08ead 286 wxDialog(wxWindow* parent,
d5573410
RD
287 const wxWindowID id=-1,
288 const wxString& title = wxPyEmptyString,
ecc08ead
RD
289 const wxPoint& pos = wxDefaultPosition,
290 const wxSize& size = wxDefaultSize,
291 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 292 const wxString& name = wxPyDialogNameStr);
1b8c7ba6 293 %RenameCtor(PreDialog, wxDialog());
ecc08ead 294
b39c3fa0
RD
295 // Turn it back on again
296 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
297
ecc08ead 298 bool Create(wxWindow* parent,
d5573410
RD
299 const wxWindowID id=-1,
300 const wxString& title = wxPyEmptyString,
ecc08ead
RD
301 const wxPoint& pos = wxDefaultPosition,
302 const wxSize& size = wxDefaultSize,
303 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 304 const wxString& name = wxPyDialogNameStr);
ecc08ead 305
0122b7e3 306
d14a1e28
RD
307 // the modal dialogs have a return code - usually the id of the last
308 // pressed button
705b61cc
RD
309 void SetReturnCode(int returnCode);
310 int GetReturnCode() const;
ecc08ead 311
d14a1e28
RD
312 // splits text up at newlines and places the
313 // lines into a vertical wxBoxSizer
9283228f 314 wxSizer* CreateTextSizer( const wxString &message );
ecc08ead 315
d14a1e28 316 // places buttons into a horizontal wxBoxSizer
9283228f
RD
317 wxSizer* CreateButtonSizer( long flags );
318 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
ecc08ead 319
f87da722
RD
320 //void SetModal(bool flag);
321
322 // is the dialog in modal state right now?
d14a1e28
RD
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);
880715c9
RD
331
332 static wxVisualAttributes
333 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
705b61cc
RD
334
335 %pythoncode {
336 def SendSizeEvent(self):
337 self.ProcessEvent(wx.SizeEvent((-1,-1)))
338 }
d14a1e28 339};
ecc08ead 340
9c039d08 341//---------------------------------------------------------------------------
d14a1e28
RD
342%newgroup
343
9c039d08 344
ab1f7d2a
RD
345MustHaveApp(wxMiniFrame);
346
9c039d08
RD
347class wxMiniFrame : public wxFrame {
348public:
2b9048c5
RD
349 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
350 %pythonAppend wxMiniFrame() ""
d14a1e28 351
d5573410
RD
352 wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
353 const wxString& title = wxPyEmptyString,
b68dc582
RD
354 const wxPoint& pos = wxDefaultPosition,
355 const wxSize& size = wxDefaultSize,
9c039d08 356 long style = wxDEFAULT_FRAME_STYLE,
137b5242 357 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 358 %RenameCtor(PreMiniFrame, wxMiniFrame());
9c039d08 359
d5573410
RD
360 bool Create(wxWindow* parent, const wxWindowID id=-1,
361 const wxString& title = wxPyEmptyString,
09f3d4e6
RD
362 const wxPoint& pos = wxDefaultPosition,
363 const wxSize& size = wxDefaultSize,
364 long style = wxDEFAULT_FRAME_STYLE,
137b5242 365 const wxString& name = wxPyFrameNameStr);
0122b7e3 366
9c039d08 367};
b8b8dda7
RD
368
369
370//---------------------------------------------------------------------------
d14a1e28
RD
371%newgroup
372
b8b8dda7 373
b5a5d647
RD
374enum {
375 wxSPLASH_CENTRE_ON_PARENT,
376 wxSPLASH_CENTRE_ON_SCREEN,
377 wxSPLASH_NO_CENTRE,
378 wxSPLASH_TIMEOUT,
379 wxSPLASH_NO_TIMEOUT,
380};
381
382
ab1f7d2a
RD
383MustHaveApp(wxSplashScreenWindow);
384
b5a5d647
RD
385class wxSplashScreenWindow: public wxWindow
386{
387public:
2b9048c5 388 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
d14a1e28 389
b5a5d647
RD
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
ab1f7d2a
RD
401MustHaveApp(wxSplashScreen);
402
b5a5d647
RD
403class wxSplashScreen : public wxFrame {
404public:
2b9048c5 405 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
d14a1e28 406
b5a5d647 407 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
d5573410 408 wxWindow* parent, wxWindowID id=-1,
b5a5d647
RD
409 const wxPoint& pos = wxDefaultPosition,
410 const wxSize& size = wxDefaultSize,
479101ca 411 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
b5a5d647
RD
412
413 long GetSplashStyle() const;
414 wxSplashScreenWindow* GetSplashWindow() const;
415 int GetTimeout() const;
416};
417
418
419//---------------------------------------------------------------------------