]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_toplvl.i
Build fix for motif.
[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
4a983d2c
RD
103 // return true if the frame is always maximized
104 // due to native guidelines or current policy
105 virtual bool IsAlwaysMaximized() const;
106
dd9f7fea 107 // return True if the frame is iconized
ecc08ead
RD
108 virtual bool IsIconized() const;
109
110 // get the frame icon
c5943253 111 wxIcon GetIcon() const;
ecc08ead
RD
112
113 // set the frame icon
114 virtual void SetIcon(const wxIcon& icon);
115
0e9b78ce 116 // set the frame icons
5cf1cb10 117 virtual void SetIcons(const wxIconBundle& icons);
ecc08ead
RD
118
119 // maximize the window to cover entire screen
120 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
121
dd9f7fea 122 // return True if the frame is in fullscreen mode
ecc08ead
RD
123 virtual bool IsFullScreen() const;
124
125 virtual void SetTitle(const wxString& title);
126 virtual wxString GetTitle() const;
1542ea39
RD
127
128 // Set the shape of the window to the given region.
5cf1cb10
DS
129 // Returns True if the platform supports this feature
130 // (and the operation is successful.)
1542ea39
RD
131 virtual bool SetShape(const wxRegion& region);
132
5cf1cb10
DS
133 // Attracts the users attention to this window if the application is inactive
134 // (should be called when a background event occurs)
e51483b1
RD
135 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
136
2e5cc335
RD
137 // Is this the active frame (highlighted in the taskbar)?
138 virtual bool IsActive();
5cf1cb10 139
a212b779 140#ifdef __WXMAC__
f355f03e
RD
141 %extend {
142 void MacSetMetalAppearance( bool on ) {
143 int style = self->GetExtraStyle();
144 if ( on )
145 style |= wxFRAME_EX_METAL;
146 else
147 style &= ~wxFRAME_EX_METAL;
148 self->SetExtraStyle(style);
149 }
150 }
5cf1cb10 151 bool MacGetMetalAppearance() const;
3e98bb2a 152#else
5cf1cb10
DS
153 %extend
154 {
3e98bb2a
RD
155 // TODO: Should they raise not implemented or just NOP???
156 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
157 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
158 }
a212b779 159#endif
51941b48
RD
160
161 DocDeclStr(
162 void , CenterOnScreen(int dir = wxBOTH),
163 "Center the window on screen", "");
164 %pythoncode { CentreOnScreen = CenterOnScreen }
ecc08ead
RD
165};
166
ecc08ead 167
d14a1e28
RD
168//---------------------------------------------------------------------------
169%newgroup
170
171// wxFrame is a top-level window with optional menubar, statusbar and toolbar
172//
173// For each of *bars, a frame may have several of them, but only one is
174// managed by the frame, i.e. resized/moved when the frame is and whose size
175// is accounted for in client size calculations - all others should be taken
176// care of manually.
ecc08ead 177
ab1f7d2a
RD
178MustHaveApp(wxFrame);
179
5cf1cb10
DS
180class wxFrame : public wxTopLevelWindow
181{
9c039d08 182public:
2b9048c5
RD
183 %pythonAppend wxFrame "self._setOORInfo(self)"
184 %pythonAppend wxFrame() ""
b39c3fa0 185 %typemap(out) wxFrame*; // turn off this typemap
d14a1e28 186
5cf1cb10
DS
187 wxFrame(wxWindow* parent,
188 const wxWindowID id = -1,
d5573410 189 const wxString& title = wxPyEmptyString,
b68dc582
RD
190 const wxPoint& pos = wxDefaultPosition,
191 const wxSize& size = wxDefaultSize,
9c039d08 192 long style = wxDEFAULT_FRAME_STYLE,
137b5242 193 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 194 %RenameCtor(PreFrame, wxFrame());
9c039d08 195
b39c3fa0
RD
196 // Turn it back on again
197 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
198
5cf1cb10
DS
199 bool Create(wxWindow* parent,
200 const wxWindowID id = -1,
201 const wxString& title = wxPyEmptyString,
202 const wxPoint& pos = wxDefaultPosition,
203 const wxSize& size = wxDefaultSize,
204 long style = wxDEFAULT_FRAME_STYLE,
205 const wxString& name = wxPyFrameNameStr);
0122b7e3 206
d14a1e28
RD
207 // frame state
208 // -----------
ecc08ead 209
d14a1e28
RD
210 // get the origin of the client area (which may be different from (0, 0)
211 // if the frame has a toolbar) in client coordinates
212 virtual wxPoint GetClientAreaOrigin() const;
213
5cf1cb10
DS
214 // sends a size event to the window using its current size:
215 // this has a side effect of refreshing the window layout
705b61cc 216 virtual void SendSizeEvent();
d14a1e28 217
d14a1e28
RD
218 // menu bar functions
219 // ------------------
220
221 virtual void SetMenuBar(wxMenuBar *menubar);
222 virtual wxMenuBar *GetMenuBar() const;
ecc08ead 223
dd9f7fea 224 // process menu command: returns True if processed
d14a1e28
RD
225 bool ProcessCommand(int winid);
226 %pythoncode { Command = ProcessCommand }
227
d14a1e28
RD
228 // status bar functions
229 // --------------------
230
231 // create the main status bar by calling OnCreateStatusBar()
232 virtual wxStatusBar* CreateStatusBar(int number = 1,
69d81895 233 long style = wxDEFAULT_STATUSBAR_STYLE,
d14a1e28
RD
234 wxWindowID winid = 0,
235 const wxString& name = wxPyStatusLineNameStr);
5cf1cb10 236
d14a1e28
RD
237// TODO: with directors?
238// // return a new status bar
239// virtual wxStatusBar *OnCreateStatusBar(int number,
240// long style,
241// wxWindowID winid,
242// const wxString& name);
ecc08ead
RD
243
244 // get the main status bar
d14a1e28 245 virtual wxStatusBar *GetStatusBar() const;
ecc08ead
RD
246
247 // sets the main status bar
248 void SetStatusBar(wxStatusBar *statBar);
249
250 // forward these to status bar
251 virtual void SetStatusText(const wxString &text, int number = 0);
5cf1cb10 252 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
94e36a51
RD
253 void PushStatusText(const wxString &text, int number = 0);
254 void PopStatusText(int number = 0);
255
94e36a51
RD
256 // set the status bar pane the help will be shown in
257 void SetStatusBarPane(int n);
258 int GetStatusBarPane() const;
ecc08ead 259
d14a1e28
RD
260 // toolbar functions
261 // -----------------
262
263 // create main toolbar bycalling OnCreateToolBar()
264 virtual wxToolBar* CreateToolBar(long style = -1,
265 wxWindowID winid = -1,
137b5242 266 const wxString& name = wxPyToolBarNameStr);
5cf1cb10 267
d14a1e28
RD
268// TODO: with directors?
269// // return a new toolbar
270// virtual wxToolBar *OnCreateToolBar(long style,
271// wxWindowID winid,
272// const wxString& name );
ecc08ead
RD
273
274 // get/set the main toolbar
d14a1e28
RD
275 virtual wxToolBar *GetToolBar() const;
276 virtual void SetToolBar(wxToolBar *toolbar);
ecc08ead 277
dd9f7fea
RD
278 // show help text (typically in the statusbar); show is False
279 // if you are hiding the help, True otherwise
d14a1e28 280 virtual void DoGiveHelp(const wxString& text, bool show);
3ef86e32 281
3ef86e32
RD
282 // send wxUpdateUIEvents for all menu items in the menubar,
283 // or just for menu if non-NULL
284 void DoMenuUpdates(wxMenu* menu = NULL);
880715c9
RD
285
286 static wxVisualAttributes
287 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
9c039d08
RD
288};
289
ecc08ead 290//---------------------------------------------------------------------------
d14a1e28 291%newgroup
ecc08ead 292
ab1f7d2a
RD
293MustHaveApp(wxDialog);
294
5cf1cb10
DS
295class wxDialog : public wxTopLevelWindow
296{
ecc08ead 297public:
1631143c
RD
298 enum
299 {
300 // all flags allowed in wxDialogBase::CreateButtonSizer()
5cf1cb10 301 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
1631143c
RD
302 };
303
2b9048c5
RD
304 %pythonAppend wxDialog "self._setOORInfo(self)"
305 %pythonAppend wxDialog() ""
b39c3fa0 306 %typemap(out) wxDialog*; // turn off this typemap
d14a1e28 307
ecc08ead 308 wxDialog(wxWindow* parent,
5cf1cb10 309 const wxWindowID id = -1,
d5573410 310 const wxString& title = wxPyEmptyString,
ecc08ead
RD
311 const wxPoint& pos = wxDefaultPosition,
312 const wxSize& size = wxDefaultSize,
313 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 314 const wxString& name = wxPyDialogNameStr);
1b8c7ba6 315 %RenameCtor(PreDialog, wxDialog());
ecc08ead 316
b39c3fa0
RD
317 // Turn it back on again
318 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
319
ecc08ead 320 bool Create(wxWindow* parent,
5cf1cb10 321 const wxWindowID id = -1,
d5573410 322 const wxString& title = wxPyEmptyString,
ecc08ead
RD
323 const wxPoint& pos = wxDefaultPosition,
324 const wxSize& size = wxDefaultSize,
325 long style = wxDEFAULT_DIALOG_STYLE,
137b5242 326 const wxString& name = wxPyDialogNameStr);
ecc08ead 327
5cf1cb10 328 // the modal dialogs have a return code - usually the ID of the last
d14a1e28 329 // pressed button
705b61cc
RD
330 void SetReturnCode(int returnCode);
331 int GetReturnCode() const;
ecc08ead 332
99fbb25b
RD
333 // The identifier for the affirmative button
334 void SetAffirmativeId(int affirmativeId);
335 int GetAffirmativeId() const;
336
337 // Identifier for Esc key translation
338 void SetEscapeId(int escapeId);
339 int GetEscapeId() const;
340
d14a1e28
RD
341 // splits text up at newlines and places the
342 // lines into a vertical wxBoxSizer
9283228f 343 wxSizer* CreateTextSizer( const wxString &message );
ecc08ead 344
d14a1e28 345 // places buttons into a horizontal wxBoxSizer
1631143c
RD
346 wxSizer* CreateButtonSizer( long flags,
347 bool separated = false,
5cf1cb10 348 wxCoord distance = 0 );
9283228f 349 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
ecc08ead 350
5cf1cb10 351 //void SetModal( bool flag );
f87da722
RD
352
353 // is the dialog in modal state right now?
d14a1e28
RD
354 virtual bool IsModal() const;
355
356 // Shows the dialog and starts a nested event loop that returns when
357 // EndModal is called.
358 virtual int ShowModal();
359
360 // may be called to terminate the dialog with the given return code
361 virtual void EndModal(int retCode);
880715c9
RD
362
363 static wxVisualAttributes
364 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
d14a1e28 365};
ecc08ead 366
9c039d08 367//---------------------------------------------------------------------------
d14a1e28
RD
368%newgroup
369
9c039d08 370
ab1f7d2a
RD
371MustHaveApp(wxMiniFrame);
372
5cf1cb10
DS
373class wxMiniFrame : public wxFrame
374{
9c039d08 375public:
2b9048c5
RD
376 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
377 %pythonAppend wxMiniFrame() ""
d14a1e28 378
5cf1cb10
DS
379 wxMiniFrame(wxWindow* parent,
380 const wxWindowID id = -1,
381 const wxString& title = wxPyEmptyString,
382 const wxPoint& pos = wxDefaultPosition,
383 const wxSize& size = wxDefaultSize,
384 long style = wxDEFAULT_FRAME_STYLE,
385 const wxString& name = wxPyFrameNameStr);
1b8c7ba6 386 %RenameCtor(PreMiniFrame, wxMiniFrame());
9c039d08 387
5cf1cb10
DS
388 bool Create(wxWindow* parent,
389 const wxWindowID id = -1,
390 const wxString& title = wxPyEmptyString,
391 const wxPoint& pos = wxDefaultPosition,
392 const wxSize& size = wxDefaultSize,
393 long style = wxDEFAULT_FRAME_STYLE,
394 const wxString& name = wxPyFrameNameStr);
9c039d08 395};
b8b8dda7
RD
396
397
398//---------------------------------------------------------------------------
d14a1e28
RD
399%newgroup
400
b8b8dda7 401
5cf1cb10
DS
402enum
403{
b5a5d647
RD
404 wxSPLASH_CENTRE_ON_PARENT,
405 wxSPLASH_CENTRE_ON_SCREEN,
406 wxSPLASH_NO_CENTRE,
407 wxSPLASH_TIMEOUT,
408 wxSPLASH_NO_TIMEOUT,
409};
410
411
ab1f7d2a
RD
412MustHaveApp(wxSplashScreenWindow);
413
b5a5d647
RD
414class wxSplashScreenWindow: public wxWindow
415{
416public:
2b9048c5 417 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
d14a1e28 418
b5a5d647 419 wxSplashScreenWindow(const wxBitmap& bitmap,
5cf1cb10
DS
420 wxWindow* parent,
421 wxWindowID id,
422 const wxPoint& pos = wxDefaultPosition,
423 const wxSize& size = wxDefaultSize,
424 long style = wxNO_BORDER);
b5a5d647
RD
425
426 void SetBitmap(const wxBitmap& bitmap);
427 wxBitmap& GetBitmap();
428};
429
430
ab1f7d2a
RD
431MustHaveApp(wxSplashScreen);
432
5cf1cb10
DS
433class wxSplashScreen : public wxFrame
434{
b5a5d647 435public:
2b9048c5 436 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
d14a1e28 437
5cf1cb10
DS
438 wxSplashScreen(const wxBitmap& bitmap,
439 long splashStyle, int milliseconds,
440 wxWindow* parent,
441 wxWindowID id = -1,
442 const wxPoint& pos = wxDefaultPosition,
443 const wxSize& size = wxDefaultSize,
444 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
b5a5d647
RD
445
446 long GetSplashStyle() const;
447 wxSplashScreenWindow* GetSplashWindow() const;
448 int GetTimeout() const;
449};
450
451
452//---------------------------------------------------------------------------