1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc.
7 // Created: 27-Aug-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
18 MAKE_CONST_WXSTRING(FrameNameStr);
19 MAKE_CONST_WXSTRING(DialogNameStr);
20 MAKE_CONST_WXSTRING(StatusLineNameStr);
21 MAKE_CONST_WXSTRING(ToolBarNameStr);
23 //---------------------------------------------------------------------------
44 wxDEFAULT_FRAME_STYLE,
45 wxDEFAULT_DIALOG_STYLE,
48 wxFRAME_FLOAT_ON_PARENT,
49 wxFRAME_NO_WINDOW_MENU,
66 wxFULLSCREEN_NOMENUBAR,
67 wxFULLSCREEN_NOTOOLBAR,
68 wxFULLSCREEN_NOSTATUSBAR,
69 wxFULLSCREEN_NOBORDER,
70 wxFULLSCREEN_NOCAPTION,
76 // Styles for RequestUserAttention
79 wxUSER_ATTENTION_INFO = 1,
80 wxUSER_ATTENTION_ERROR = 2
83 //---------------------------------------------------------------------------
85 class wxTopLevelWindow : public wxWindow
89 // No constructor as it can not be used directly from Python
91 // maximize = True => maximize, otherwise - restore
92 virtual void Maximize(bool maximize = true);
94 // undo Maximize() or Iconize()
95 virtual void Restore();
97 // iconize = True => iconize, otherwise - restore
98 virtual void Iconize(bool iconize = true);
100 // return True if the frame is maximized
101 virtual bool IsMaximized() const;
103 // return true if the frame is always maximized
104 // due to native guidelines or current policy
105 virtual bool IsAlwaysMaximized() const;
107 // return True if the frame is iconized
108 virtual bool IsIconized() const;
110 // get the frame icon
111 wxIcon GetIcon() const;
113 // set the frame icon
114 virtual void SetIcon(const wxIcon& icon);
116 // set the frame icons
117 virtual void SetIcons(const wxIconBundle& icons);
119 // maximize the window to cover entire screen
120 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
122 // return True if the frame is in fullscreen mode
123 virtual bool IsFullScreen() const;
125 virtual void SetTitle(const wxString& title);
126 virtual wxString GetTitle() const;
128 // Set the shape of the window to the given region.
129 // Returns True if the platform supports this feature
130 // (and the operation is successful.)
131 virtual bool SetShape(const wxRegion& region);
133 // Attracts the users attention to this window if the application is inactive
134 // (should be called when a background event occurs)
135 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
137 // Is this the active frame (highlighted in the taskbar)?
138 virtual bool IsActive();
142 void MacSetMetalAppearance( bool on ) {
143 int style = self->GetExtraStyle();
145 style |= wxFRAME_EX_METAL;
147 style &= ~wxFRAME_EX_METAL;
148 self->SetExtraStyle(style);
151 bool MacGetMetalAppearance() const;
155 // TODO: Should they raise not implemented or just NOP???
156 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
157 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
162 void , CenterOnScreen(int dir = wxBOTH),
163 "Center the window on screen", "");
164 %pythoncode { CentreOnScreen = CenterOnScreen }
168 //---------------------------------------------------------------------------
171 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
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
178 MustHaveApp(wxFrame);
180 class wxFrame : public wxTopLevelWindow
183 %pythonAppend wxFrame "self._setOORInfo(self)"
184 %pythonAppend wxFrame() ""
185 %typemap(out) wxFrame*; // turn off this typemap
187 wxFrame(wxWindow* parent,
188 const wxWindowID id = -1,
189 const wxString& title = wxPyEmptyString,
190 const wxPoint& pos = wxDefaultPosition,
191 const wxSize& size = wxDefaultSize,
192 long style = wxDEFAULT_FRAME_STYLE,
193 const wxString& name = wxPyFrameNameStr);
194 %RenameCtor(PreFrame, wxFrame());
196 // Turn it back on again
197 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
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);
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;
214 // sends a size event to the window using its current size:
215 // this has a side effect of refreshing the window layout
216 virtual void SendSizeEvent();
218 // menu bar functions
219 // ------------------
221 virtual void SetMenuBar(wxMenuBar *menubar);
222 virtual wxMenuBar *GetMenuBar() const;
224 // process menu command: returns True if processed
225 bool ProcessCommand(int winid);
226 %pythoncode { Command = ProcessCommand }
228 // status bar functions
229 // --------------------
231 // create the main status bar by calling OnCreateStatusBar()
232 virtual wxStatusBar* CreateStatusBar(int number = 1,
233 long style = wxDEFAULT_STATUSBAR_STYLE,
234 wxWindowID winid = 0,
235 const wxString& name = wxPyStatusLineNameStr);
237 // TODO: with directors?
238 // // return a new status bar
239 // virtual wxStatusBar *OnCreateStatusBar(int number,
242 // const wxString& name);
244 // get the main status bar
245 virtual wxStatusBar *GetStatusBar() const;
247 // sets the main status bar
248 void SetStatusBar(wxStatusBar *statBar);
250 // forward these to status bar
251 virtual void SetStatusText(const wxString &text, int number = 0);
252 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
253 void PushStatusText(const wxString &text, int number = 0);
254 void PopStatusText(int number = 0);
256 // set the status bar pane the help will be shown in
257 void SetStatusBarPane(int n);
258 int GetStatusBarPane() const;
263 // create main toolbar bycalling OnCreateToolBar()
264 virtual wxToolBar* CreateToolBar(long style = -1,
265 wxWindowID winid = -1,
266 const wxString& name = wxPyToolBarNameStr);
268 // TODO: with directors?
269 // // return a new toolbar
270 // virtual wxToolBar *OnCreateToolBar(long style,
272 // const wxString& name );
274 // get/set the main toolbar
275 virtual wxToolBar *GetToolBar() const;
276 virtual void SetToolBar(wxToolBar *toolbar);
278 // show help text (typically in the statusbar); show is False
279 // if you are hiding the help, True otherwise
280 virtual void DoGiveHelp(const wxString& text, bool show);
282 // send wxUpdateUIEvents for all menu items in the menubar,
283 // or just for menu if non-NULL
284 void DoMenuUpdates(wxMenu* menu = NULL);
286 static wxVisualAttributes
287 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
290 //---------------------------------------------------------------------------
293 MustHaveApp(wxDialog);
295 class wxDialog : public wxTopLevelWindow
300 // all flags allowed in wxDialogBase::CreateButtonSizer()
301 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
304 %pythonAppend wxDialog "self._setOORInfo(self)"
305 %pythonAppend wxDialog() ""
306 %typemap(out) wxDialog*; // turn off this typemap
308 wxDialog(wxWindow* parent,
309 const wxWindowID id = -1,
310 const wxString& title = wxPyEmptyString,
311 const wxPoint& pos = wxDefaultPosition,
312 const wxSize& size = wxDefaultSize,
313 long style = wxDEFAULT_DIALOG_STYLE,
314 const wxString& name = wxPyDialogNameStr);
315 %RenameCtor(PreDialog, wxDialog());
317 // Turn it back on again
318 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
320 bool Create(wxWindow* parent,
321 const wxWindowID id = -1,
322 const wxString& title = wxPyEmptyString,
323 const wxPoint& pos = wxDefaultPosition,
324 const wxSize& size = wxDefaultSize,
325 long style = wxDEFAULT_DIALOG_STYLE,
326 const wxString& name = wxPyDialogNameStr);
328 // the modal dialogs have a return code - usually the ID of the last
330 void SetReturnCode(int returnCode);
331 int GetReturnCode() const;
333 // The identifier for the affirmative button
334 void SetAffirmativeId(int affirmativeId);
335 int GetAffirmativeId() const;
337 // Identifier for Esc key translation
338 void SetEscapeId(int escapeId);
339 int GetEscapeId() const;
341 // splits text up at newlines and places the
342 // lines into a vertical wxBoxSizer
343 wxSizer* CreateTextSizer( const wxString &message );
345 // places buttons into a horizontal wxBoxSizer
346 wxSizer* CreateButtonSizer( long flags,
347 bool separated = false,
348 wxCoord distance = 0 );
349 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
351 //void SetModal( bool flag );
353 // is the dialog in modal state right now?
354 virtual bool IsModal() const;
356 // Shows the dialog and starts a nested event loop that returns when
357 // EndModal is called.
358 virtual int ShowModal();
360 // may be called to terminate the dialog with the given return code
361 virtual void EndModal(int retCode);
363 static wxVisualAttributes
364 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
367 //---------------------------------------------------------------------------
371 MustHaveApp(wxMiniFrame);
373 class wxMiniFrame : public wxFrame
376 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
377 %pythonAppend wxMiniFrame() ""
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);
386 %RenameCtor(PreMiniFrame, wxMiniFrame());
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);
398 //---------------------------------------------------------------------------
404 wxSPLASH_CENTRE_ON_PARENT,
405 wxSPLASH_CENTRE_ON_SCREEN,
412 MustHaveApp(wxSplashScreenWindow);
414 class wxSplashScreenWindow: public wxWindow
417 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
419 wxSplashScreenWindow(const wxBitmap& bitmap,
422 const wxPoint& pos = wxDefaultPosition,
423 const wxSize& size = wxDefaultSize,
424 long style = wxNO_BORDER);
426 void SetBitmap(const wxBitmap& bitmap);
427 wxBitmap& GetBitmap();
431 MustHaveApp(wxSplashScreen);
433 class wxSplashScreen : public wxFrame
436 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
438 wxSplashScreen(const wxBitmap& bitmap,
439 long splashStyle, int milliseconds,
442 const wxPoint& pos = wxDefaultPosition,
443 const wxSize& size = wxDefaultSize,
444 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
446 long GetSplashStyle() const;
447 wxSplashScreenWindow* GetSplashWindow() const;
448 int GetTimeout() const;
452 //---------------------------------------------------------------------------