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 iconized
104 virtual bool IsIconized() const;
106 // get the frame icon
107 wxIcon GetIcon() const;
109 // set the frame icon
110 virtual void SetIcon(const wxIcon& icon);
112 // set the frame icons
113 virtual void SetIcons(const wxIconBundle& icons );
115 // maximize the window to cover entire screen
116 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
118 // return True if the frame is in fullscreen mode
119 virtual bool IsFullScreen() const;
121 virtual void SetTitle(const wxString& title);
122 virtual wxString GetTitle() const;
124 // Set the shape of the window to the given region.
125 // Returns True if the platform supports this feature (and the operation
127 virtual bool SetShape(const wxRegion& region);
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);
134 // Is this the active frame (highlighted in the taskbar)?
135 virtual bool IsActive();
138 void MacSetMetalAppearance( bool on ) ;
139 bool MacGetMetalAppearance() const ;
142 // TODO: Should they raise not implemented or just NOP???
143 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
144 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
150 //---------------------------------------------------------------------------
153 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
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
160 MustHaveApp(wxFrame);
162 class wxFrame : public wxTopLevelWindow {
164 %pythonAppend wxFrame "self._setOORInfo(self)"
165 %pythonAppend wxFrame() ""
166 %typemap(out) wxFrame*; // turn off this typemap
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());
176 // Turn it back on again
177 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
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);
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;
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();
200 // menu bar functions
201 // ------------------
203 virtual void SetMenuBar(wxMenuBar *menubar);
204 virtual wxMenuBar *GetMenuBar() const;
207 // process menu command: returns True if processed
208 bool ProcessCommand(int winid);
209 %pythoncode { Command = ProcessCommand }
212 // status bar functions
213 // --------------------
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,
225 // const wxString& name);
227 // get the main status bar
228 virtual wxStatusBar *GetStatusBar() const;
230 // sets the main status bar
231 void SetStatusBar(wxStatusBar *statBar);
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);
239 // set the status bar pane the help will be shown in
240 void SetStatusBarPane(int n);
241 int GetStatusBarPane() const;
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,
255 // const wxString& name );
257 // get/set the main toolbar
258 virtual wxToolBar *GetToolBar() const;
259 virtual void SetToolBar(wxToolBar *toolbar);
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);
267 // send wxUpdateUIEvents for all menu items in the menubar,
268 // or just for menu if non-NULL
269 void DoMenuUpdates(wxMenu* menu = NULL);
271 static wxVisualAttributes
272 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
275 //---------------------------------------------------------------------------
278 MustHaveApp(wxDialog);
280 class wxDialog : public wxTopLevelWindow {
282 %pythonAppend wxDialog "self._setOORInfo(self)"
283 %pythonAppend wxDialog() ""
284 %typemap(out) wxDialog*; // turn off this typemap
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());
295 // Turn it back on again
296 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
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);
307 // the modal dialogs have a return code - usually the id of the last
309 void SetReturnCode(int returnCode);
310 int GetReturnCode() const;
312 // splits text up at newlines and places the
313 // lines into a vertical wxBoxSizer
314 wxSizer* CreateTextSizer( const wxString &message );
316 // places buttons into a horizontal wxBoxSizer
317 wxSizer* CreateButtonSizer( long flags );
318 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
320 //void SetModal(bool flag);
322 // is the dialog in modal state right now?
323 virtual bool IsModal() const;
325 // Shows the dialog and starts a nested event loop that returns when
326 // EndModal is called.
327 virtual int ShowModal();
329 // may be called to terminate the dialog with the given return code
330 virtual void EndModal(int retCode);
332 static wxVisualAttributes
333 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
336 def SendSizeEvent(self):
337 self.ProcessEvent(wx.SizeEvent((-1,-1)))
341 //---------------------------------------------------------------------------
345 MustHaveApp(wxMiniFrame);
347 class wxMiniFrame : public wxFrame {
349 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
350 %pythonAppend wxMiniFrame() ""
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());
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);
370 //---------------------------------------------------------------------------
375 wxSPLASH_CENTRE_ON_PARENT,
376 wxSPLASH_CENTRE_ON_SCREEN,
383 MustHaveApp(wxSplashScreenWindow);
385 class wxSplashScreenWindow: public wxWindow
388 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
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);
396 void SetBitmap(const wxBitmap& bitmap);
397 wxBitmap& GetBitmap();
401 MustHaveApp(wxSplashScreen);
403 class wxSplashScreen : public wxFrame {
405 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
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);
413 long GetSplashStyle() const;
414 wxSplashScreenWindow* GetSplashWindow() const;
415 int GetTimeout() const;
419 //---------------------------------------------------------------------------