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 }
167 bool EnableCloseButton(bool enable = true);
170 bool EnableCloseButton(bool enable = true) { return false; }
174 virtual bool SetTransparent(byte alpha);
175 virtual bool CanSetTransparent();
180 //---------------------------------------------------------------------------
183 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
185 // For each of *bars, a frame may have several of them, but only one is
186 // managed by the frame, i.e. resized/moved when the frame is and whose size
187 // is accounted for in client size calculations - all others should be taken
190 MustHaveApp(wxFrame);
192 class wxFrame : public wxTopLevelWindow
195 %pythonAppend wxFrame "self._setOORInfo(self)"
196 %pythonAppend wxFrame() ""
197 %typemap(out) wxFrame*; // turn off this typemap
199 wxFrame(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);
206 %RenameCtor(PreFrame, wxFrame());
208 // Turn it back on again
209 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
211 bool Create(wxWindow* parent,
212 const wxWindowID id = -1,
213 const wxString& title = wxPyEmptyString,
214 const wxPoint& pos = wxDefaultPosition,
215 const wxSize& size = wxDefaultSize,
216 long style = wxDEFAULT_FRAME_STYLE,
217 const wxString& name = wxPyFrameNameStr);
222 // get the origin of the client area (which may be different from (0, 0)
223 // if the frame has a toolbar) in client coordinates
224 virtual wxPoint GetClientAreaOrigin() const;
226 // sends a size event to the window using its current size:
227 // this has a side effect of refreshing the window layout
228 virtual void SendSizeEvent();
230 // menu bar functions
231 // ------------------
233 virtual void SetMenuBar(wxMenuBar *menubar);
234 virtual wxMenuBar *GetMenuBar() const;
236 // process menu command: returns True if processed
237 bool ProcessCommand(int winid);
238 %pythoncode { Command = ProcessCommand }
240 // status bar functions
241 // --------------------
243 // create the main status bar by calling OnCreateStatusBar()
244 virtual wxStatusBar* CreateStatusBar(int number = 1,
245 long style = wxDEFAULT_STATUSBAR_STYLE,
246 wxWindowID winid = 0,
247 const wxString& name = wxPyStatusLineNameStr);
249 // TODO: with directors?
250 // // return a new status bar
251 // virtual wxStatusBar *OnCreateStatusBar(int number,
254 // const wxString& name);
256 // get the main status bar
257 virtual wxStatusBar *GetStatusBar() const;
259 // sets the main status bar
260 void SetStatusBar(wxStatusBar *statBar);
262 // forward these to status bar
263 virtual void SetStatusText(const wxString &text, int number = 0);
264 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
265 void PushStatusText(const wxString &text, int number = 0);
266 void PopStatusText(int number = 0);
268 // set the status bar pane the help will be shown in
269 void SetStatusBarPane(int n);
270 int GetStatusBarPane() const;
275 // create main toolbar bycalling OnCreateToolBar()
276 virtual wxToolBar* CreateToolBar(long style = -1,
277 wxWindowID winid = -1,
278 const wxString& name = wxPyToolBarNameStr);
280 // TODO: with directors?
281 // // return a new toolbar
282 // virtual wxToolBar *OnCreateToolBar(long style,
284 // const wxString& name );
286 // get/set the main toolbar
287 virtual wxToolBar *GetToolBar() const;
288 virtual void SetToolBar(wxToolBar *toolbar);
290 // show help text (typically in the statusbar); show is False
291 // if you are hiding the help, True otherwise
292 virtual void DoGiveHelp(const wxString& text, bool show);
294 // send wxUpdateUIEvents for all menu items in the menubar,
295 // or just for menu if non-NULL
296 void DoMenuUpdates(wxMenu* menu = NULL);
298 static wxVisualAttributes
299 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
302 //---------------------------------------------------------------------------
305 MustHaveApp(wxDialog);
307 class wxDialog : public wxTopLevelWindow
312 // all flags allowed in wxDialogBase::CreateButtonSizer()
313 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
316 %pythonAppend wxDialog "self._setOORInfo(self)"
317 %pythonAppend wxDialog() ""
318 %typemap(out) wxDialog*; // turn off this typemap
320 wxDialog(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);
327 %RenameCtor(PreDialog, wxDialog());
329 // Turn it back on again
330 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
332 bool Create(wxWindow* parent,
333 const wxWindowID id = -1,
334 const wxString& title = wxPyEmptyString,
335 const wxPoint& pos = wxDefaultPosition,
336 const wxSize& size = wxDefaultSize,
337 long style = wxDEFAULT_DIALOG_STYLE,
338 const wxString& name = wxPyDialogNameStr);
340 // the modal dialogs have a return code - usually the ID of the last
342 void SetReturnCode(int returnCode);
343 int GetReturnCode() const;
345 // The identifier for the affirmative button
346 void SetAffirmativeId(int affirmativeId);
347 int GetAffirmativeId() const;
349 // Identifier for Esc key translation
350 void SetEscapeId(int escapeId);
351 int GetEscapeId() const;
353 // splits text up at newlines and places the
354 // lines into a vertical wxBoxSizer
355 wxSizer* CreateTextSizer( const wxString &message );
357 // places buttons into a horizontal wxBoxSizer
358 wxSizer* CreateButtonSizer( long flags,
359 bool separated = false,
360 wxCoord distance = 0 );
361 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
363 //void SetModal( bool flag );
365 // is the dialog in modal state right now?
366 virtual bool IsModal() const;
368 // Shows the dialog and starts a nested event loop that returns when
369 // EndModal is called.
370 virtual int ShowModal();
372 // may be called to terminate the dialog with the given return code
373 virtual void EndModal(int retCode);
375 static wxVisualAttributes
376 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
379 //---------------------------------------------------------------------------
383 MustHaveApp(wxMiniFrame);
385 class wxMiniFrame : public wxFrame
388 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
389 %pythonAppend wxMiniFrame() ""
391 wxMiniFrame(wxWindow* parent,
392 const wxWindowID id = -1,
393 const wxString& title = wxPyEmptyString,
394 const wxPoint& pos = wxDefaultPosition,
395 const wxSize& size = wxDefaultSize,
396 long style = wxDEFAULT_FRAME_STYLE,
397 const wxString& name = wxPyFrameNameStr);
398 %RenameCtor(PreMiniFrame, wxMiniFrame());
400 bool Create(wxWindow* parent,
401 const wxWindowID id = -1,
402 const wxString& title = wxPyEmptyString,
403 const wxPoint& pos = wxDefaultPosition,
404 const wxSize& size = wxDefaultSize,
405 long style = wxDEFAULT_FRAME_STYLE,
406 const wxString& name = wxPyFrameNameStr);
410 //---------------------------------------------------------------------------
416 wxSPLASH_CENTRE_ON_PARENT,
417 wxSPLASH_CENTRE_ON_SCREEN,
424 MustHaveApp(wxSplashScreenWindow);
426 class wxSplashScreenWindow: public wxWindow
429 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
431 wxSplashScreenWindow(const wxBitmap& bitmap,
434 const wxPoint& pos = wxDefaultPosition,
435 const wxSize& size = wxDefaultSize,
436 long style = wxNO_BORDER);
438 void SetBitmap(const wxBitmap& bitmap);
439 wxBitmap& GetBitmap();
443 MustHaveApp(wxSplashScreen);
445 class wxSplashScreen : public wxFrame
448 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
450 wxSplashScreen(const wxBitmap& bitmap,
451 long splashStyle, int milliseconds,
454 const wxPoint& pos = wxDefaultPosition,
455 const wxSize& size = wxDefaultSize,
456 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
458 long GetSplashStyle() const;
459 wxSplashScreenWindow* GetSplashWindow() const;
460 int GetTimeout() const;
464 //---------------------------------------------------------------------------