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
126 // (and the operation is successful.)
127 virtual bool SetShape(const wxRegion& region);
129 // Attracts the users attention to this window if the application is inactive
130 // (should be called when a background event occurs)
131 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
133 // Is this the active frame (highlighted in the taskbar)?
134 virtual bool IsActive();
137 void MacSetMetalAppearance( bool on );
138 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; }
149 void , CenterOnScreen(int dir = wxBOTH),
150 "Center the window on screen", "");
151 %pythoncode { CentreOnScreen = CenterOnScreen }
155 //---------------------------------------------------------------------------
158 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
160 // For each of *bars, a frame may have several of them, but only one is
161 // managed by the frame, i.e. resized/moved when the frame is and whose size
162 // is accounted for in client size calculations - all others should be taken
165 MustHaveApp(wxFrame);
167 class wxFrame : public wxTopLevelWindow
170 %pythonAppend wxFrame "self._setOORInfo(self)"
171 %pythonAppend wxFrame() ""
172 %typemap(out) wxFrame*; // turn off this typemap
174 wxFrame(wxWindow* parent,
175 const wxWindowID id = -1,
176 const wxString& title = wxPyEmptyString,
177 const wxPoint& pos = wxDefaultPosition,
178 const wxSize& size = wxDefaultSize,
179 long style = wxDEFAULT_FRAME_STYLE,
180 const wxString& name = wxPyFrameNameStr);
181 %RenameCtor(PreFrame, wxFrame());
183 // Turn it back on again
184 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
186 bool Create(wxWindow* parent,
187 const wxWindowID id = -1,
188 const wxString& title = wxPyEmptyString,
189 const wxPoint& pos = wxDefaultPosition,
190 const wxSize& size = wxDefaultSize,
191 long style = wxDEFAULT_FRAME_STYLE,
192 const wxString& name = wxPyFrameNameStr);
197 // get the origin of the client area (which may be different from (0, 0)
198 // if the frame has a toolbar) in client coordinates
199 virtual wxPoint GetClientAreaOrigin() const;
201 // sends a size event to the window using its current size:
202 // this has a side effect of refreshing the window layout
203 virtual void SendSizeEvent();
205 // menu bar functions
206 // ------------------
208 virtual void SetMenuBar(wxMenuBar *menubar);
209 virtual wxMenuBar *GetMenuBar() const;
211 // process menu command: returns True if processed
212 bool ProcessCommand(int winid);
213 %pythoncode { Command = ProcessCommand }
215 // status bar functions
216 // --------------------
218 // create the main status bar by calling OnCreateStatusBar()
219 virtual wxStatusBar* CreateStatusBar(int number = 1,
220 long style = wxDEFAULT_STATUSBAR_STYLE,
221 wxWindowID winid = 0,
222 const wxString& name = wxPyStatusLineNameStr);
224 // TODO: with directors?
225 // // return a new status bar
226 // virtual wxStatusBar *OnCreateStatusBar(int number,
229 // const wxString& name);
231 // get the main status bar
232 virtual wxStatusBar *GetStatusBar() const;
234 // sets the main status bar
235 void SetStatusBar(wxStatusBar *statBar);
237 // forward these to status bar
238 virtual void SetStatusText(const wxString &text, int number = 0);
239 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
240 void PushStatusText(const wxString &text, int number = 0);
241 void PopStatusText(int number = 0);
243 // set the status bar pane the help will be shown in
244 void SetStatusBarPane(int n);
245 int GetStatusBarPane() const;
250 // create main toolbar bycalling OnCreateToolBar()
251 virtual wxToolBar* CreateToolBar(long style = -1,
252 wxWindowID winid = -1,
253 const wxString& name = wxPyToolBarNameStr);
255 // TODO: with directors?
256 // // return a new toolbar
257 // virtual wxToolBar *OnCreateToolBar(long style,
259 // const wxString& name );
261 // get/set the main toolbar
262 virtual wxToolBar *GetToolBar() const;
263 virtual void SetToolBar(wxToolBar *toolbar);
265 // show help text (typically in the statusbar); show is False
266 // if you are hiding the help, True otherwise
267 virtual void DoGiveHelp(const wxString& text, bool show);
269 // send wxUpdateUIEvents for all menu items in the menubar,
270 // or just for menu if non-NULL
271 void DoMenuUpdates(wxMenu* menu = NULL);
273 static wxVisualAttributes
274 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
277 //---------------------------------------------------------------------------
280 MustHaveApp(wxDialog);
282 class wxDialog : public wxTopLevelWindow
287 // all flags allowed in wxDialogBase::CreateButtonSizer()
288 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
291 %pythonAppend wxDialog "self._setOORInfo(self)"
292 %pythonAppend wxDialog() ""
293 %typemap(out) wxDialog*; // turn off this typemap
295 wxDialog(wxWindow* parent,
296 const wxWindowID id = -1,
297 const wxString& title = wxPyEmptyString,
298 const wxPoint& pos = wxDefaultPosition,
299 const wxSize& size = wxDefaultSize,
300 long style = wxDEFAULT_DIALOG_STYLE,
301 const wxString& name = wxPyDialogNameStr);
302 %RenameCtor(PreDialog, wxDialog());
304 // Turn it back on again
305 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
307 bool Create(wxWindow* parent,
308 const wxWindowID id = -1,
309 const wxString& title = wxPyEmptyString,
310 const wxPoint& pos = wxDefaultPosition,
311 const wxSize& size = wxDefaultSize,
312 long style = wxDEFAULT_DIALOG_STYLE,
313 const wxString& name = wxPyDialogNameStr);
315 // the modal dialogs have a return code - usually the ID of the last
317 void SetReturnCode(int returnCode);
318 int GetReturnCode() const;
320 // The identifier for the affirmative button
321 void SetAffirmativeId(int affirmativeId);
322 int GetAffirmativeId() const;
324 // Identifier for Esc key translation
325 void SetEscapeId(int escapeId);
326 int GetEscapeId() const;
328 // splits text up at newlines and places the
329 // lines into a vertical wxBoxSizer
330 wxSizer* CreateTextSizer( const wxString &message );
332 // places buttons into a horizontal wxBoxSizer
333 wxSizer* CreateButtonSizer( long flags,
334 bool separated = false,
335 wxCoord distance = 0 );
336 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
338 //void SetModal( bool flag );
340 // is the dialog in modal state right now?
341 virtual bool IsModal() const;
343 // Shows the dialog and starts a nested event loop that returns when
344 // EndModal is called.
345 virtual int ShowModal();
347 // may be called to terminate the dialog with the given return code
348 virtual void EndModal(int retCode);
350 static wxVisualAttributes
351 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
354 //---------------------------------------------------------------------------
358 MustHaveApp(wxMiniFrame);
360 class wxMiniFrame : public wxFrame
363 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
364 %pythonAppend wxMiniFrame() ""
366 wxMiniFrame(wxWindow* parent,
367 const wxWindowID id = -1,
368 const wxString& title = wxPyEmptyString,
369 const wxPoint& pos = wxDefaultPosition,
370 const wxSize& size = wxDefaultSize,
371 long style = wxDEFAULT_FRAME_STYLE,
372 const wxString& name = wxPyFrameNameStr);
373 %RenameCtor(PreMiniFrame, wxMiniFrame());
375 bool Create(wxWindow* parent,
376 const wxWindowID id = -1,
377 const wxString& title = wxPyEmptyString,
378 const wxPoint& pos = wxDefaultPosition,
379 const wxSize& size = wxDefaultSize,
380 long style = wxDEFAULT_FRAME_STYLE,
381 const wxString& name = wxPyFrameNameStr);
385 //---------------------------------------------------------------------------
391 wxSPLASH_CENTRE_ON_PARENT,
392 wxSPLASH_CENTRE_ON_SCREEN,
399 MustHaveApp(wxSplashScreenWindow);
401 class wxSplashScreenWindow: public wxWindow
404 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
406 wxSplashScreenWindow(const wxBitmap& bitmap,
409 const wxPoint& pos = wxDefaultPosition,
410 const wxSize& size = wxDefaultSize,
411 long style = wxNO_BORDER);
413 void SetBitmap(const wxBitmap& bitmap);
414 wxBitmap& GetBitmap();
418 MustHaveApp(wxSplashScreen);
420 class wxSplashScreen : public wxFrame
423 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
425 wxSplashScreen(const wxBitmap& bitmap,
426 long splashStyle, int milliseconds,
429 const wxPoint& pos = wxDefaultPosition,
430 const wxSize& size = wxDefaultSize,
431 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
433 long GetSplashStyle() const;
434 wxSplashScreenWindow* GetSplashWindow() const;
435 int GetTimeout() const;
439 //---------------------------------------------------------------------------