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();
 
 138         void MacSetMetalAppearance( bool on ) {
 
 139             int style = self->GetExtraStyle();
 
 141                 style |= wxFRAME_EX_METAL;
 
 143                 style &= ~wxFRAME_EX_METAL;
 
 144             self->SetExtraStyle(style);
 
 147     bool MacGetMetalAppearance() const;
 
 151         // TODO: Should they raise not implemented or just NOP???
 
 152         void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
 
 153         bool MacGetMetalAppearance() const    { /*wxPyRaiseNotImplemented();*/ return false; }
 
 158         void , CenterOnScreen(int dir = wxBOTH),
 
 159         "Center the window on screen", "");
 
 160     %pythoncode { CentreOnScreen = CenterOnScreen }
 
 164 //---------------------------------------------------------------------------
 
 167 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
 
 169 // For each of *bars, a frame may have several of them, but only one is
 
 170 // managed by the frame, i.e. resized/moved when the frame is and whose size
 
 171 // is accounted for in client size calculations - all others should be taken
 
 174 MustHaveApp(wxFrame);
 
 176 class wxFrame : public wxTopLevelWindow
 
 179     %pythonAppend wxFrame         "self._setOORInfo(self)"
 
 180     %pythonAppend wxFrame()       ""
 
 181     %typemap(out) wxFrame*;    // turn off this typemap
 
 183     wxFrame(wxWindow* parent,
 
 184             const wxWindowID id = -1,
 
 185             const wxString& title = wxPyEmptyString,
 
 186             const wxPoint& pos = wxDefaultPosition,
 
 187             const wxSize& size = wxDefaultSize,
 
 188             long style = wxDEFAULT_FRAME_STYLE,
 
 189             const wxString& name = wxPyFrameNameStr);
 
 190     %RenameCtor(PreFrame, wxFrame());
 
 192     // Turn it back on again
 
 193     %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
 
 195     bool Create(wxWindow* parent,
 
 196             const wxWindowID id = -1,
 
 197             const wxString& title = wxPyEmptyString,
 
 198             const wxPoint& pos = wxDefaultPosition,
 
 199             const wxSize& size = wxDefaultSize,
 
 200             long style = wxDEFAULT_FRAME_STYLE,
 
 201             const wxString& name = wxPyFrameNameStr);
 
 206     // get the origin of the client area (which may be different from (0, 0)
 
 207     // if the frame has a toolbar) in client coordinates
 
 208     virtual wxPoint GetClientAreaOrigin() const;
 
 210     // sends a size event to the window using its current size:
 
 211     //  this has a side effect of refreshing the window layout
 
 212     virtual void SendSizeEvent();
 
 214     // menu bar functions
 
 215     // ------------------
 
 217     virtual void SetMenuBar(wxMenuBar *menubar);
 
 218     virtual wxMenuBar *GetMenuBar() const;
 
 220     // process menu command: returns True if processed
 
 221     bool ProcessCommand(int winid);
 
 222     %pythoncode { Command = ProcessCommand }
 
 224     // status bar functions
 
 225     // --------------------
 
 227     // create the main status bar by calling OnCreateStatusBar()
 
 228     virtual wxStatusBar* CreateStatusBar(int number = 1,
 
 229                                          long style = wxDEFAULT_STATUSBAR_STYLE,
 
 230                                          wxWindowID winid = 0,
 
 231                                          const wxString& name = wxPyStatusLineNameStr);
 
 233 // TODO: with directors?
 
 234 //     // return a new status bar
 
 235 //     virtual wxStatusBar *OnCreateStatusBar(int number,
 
 238 //                                            const wxString& name);
 
 240     // get the main status bar
 
 241     virtual wxStatusBar *GetStatusBar() const;
 
 243     // sets the main status bar
 
 244     void SetStatusBar(wxStatusBar *statBar);
 
 246     // forward these to status bar
 
 247     virtual void SetStatusText(const wxString &text, int number = 0);
 
 248     virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
 
 249     void PushStatusText(const wxString &text, int number = 0);
 
 250     void PopStatusText(int number = 0);
 
 252     // set the status bar pane the help will be shown in
 
 253     void SetStatusBarPane(int n);
 
 254     int GetStatusBarPane() const;
 
 259     // create main toolbar bycalling OnCreateToolBar()
 
 260     virtual wxToolBar* CreateToolBar(long style = -1,
 
 261                                      wxWindowID winid = -1,
 
 262                                      const wxString& name = wxPyToolBarNameStr);
 
 264 // TODO: with directors?
 
 265 //     // return a new toolbar
 
 266 //     virtual wxToolBar *OnCreateToolBar(long style,
 
 268 //                                        const wxString& name );
 
 270     // get/set the main toolbar
 
 271     virtual wxToolBar *GetToolBar() const;
 
 272     virtual void SetToolBar(wxToolBar *toolbar);
 
 274     // show help text (typically in the statusbar); show is False
 
 275     // if you are hiding the help, True otherwise
 
 276     virtual void DoGiveHelp(const wxString& text, bool show);
 
 278     // send wxUpdateUIEvents for all menu items in the menubar,
 
 279     // or just for menu if non-NULL
 
 280     void DoMenuUpdates(wxMenu* menu = NULL);
 
 282     static wxVisualAttributes
 
 283     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 286 //---------------------------------------------------------------------------
 
 289 MustHaveApp(wxDialog);
 
 291 class wxDialog : public wxTopLevelWindow
 
 296         // all flags allowed in wxDialogBase::CreateButtonSizer()
 
 297         ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
 
 300     %pythonAppend wxDialog   "self._setOORInfo(self)"
 
 301     %pythonAppend wxDialog() ""
 
 302     %typemap(out) wxDialog*;    // turn off this typemap
 
 304     wxDialog(wxWindow* parent,
 
 305              const wxWindowID id = -1,
 
 306              const wxString& title = wxPyEmptyString,
 
 307              const wxPoint& pos = wxDefaultPosition,
 
 308              const wxSize& size = wxDefaultSize,
 
 309              long style = wxDEFAULT_DIALOG_STYLE,
 
 310              const wxString& name = wxPyDialogNameStr);
 
 311     %RenameCtor(PreDialog, wxDialog());
 
 313     // Turn it back on again
 
 314     %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
 
 316     bool Create(wxWindow* parent,
 
 317                 const wxWindowID id = -1,
 
 318                 const wxString& title = wxPyEmptyString,
 
 319                 const wxPoint& pos = wxDefaultPosition,
 
 320                 const wxSize& size = wxDefaultSize,
 
 321                 long style = wxDEFAULT_DIALOG_STYLE,
 
 322                 const wxString& name = wxPyDialogNameStr);
 
 324     // the modal dialogs have a return code - usually the ID of the last
 
 326     void SetReturnCode(int returnCode);
 
 327     int GetReturnCode() const;
 
 329     // The identifier for the affirmative button
 
 330     void SetAffirmativeId(int affirmativeId);
 
 331     int GetAffirmativeId() const;
 
 333     // Identifier for Esc key translation
 
 334     void SetEscapeId(int escapeId);
 
 335     int GetEscapeId() const;
 
 337     // splits text up at newlines and places the
 
 338     // lines into a vertical wxBoxSizer
 
 339     wxSizer* CreateTextSizer( const wxString &message );
 
 341     // places buttons into a horizontal wxBoxSizer
 
 342     wxSizer* CreateButtonSizer( long flags,
 
 343                                 bool separated = false,
 
 344                                 wxCoord distance = 0 );
 
 345     wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
 
 347     //void SetModal( bool flag );
 
 349     // is the dialog in modal state right now?
 
 350     virtual bool IsModal() const;
 
 352     // Shows the dialog and starts a nested event loop that returns when
 
 353     // EndModal is called.
 
 354     virtual int ShowModal();
 
 356     // may be called to terminate the dialog with the given return code
 
 357     virtual void EndModal(int retCode);
 
 359     static wxVisualAttributes
 
 360     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 363 //---------------------------------------------------------------------------
 
 367 MustHaveApp(wxMiniFrame);
 
 369 class wxMiniFrame : public wxFrame
 
 372     %pythonAppend wxMiniFrame         "self._setOORInfo(self)"
 
 373     %pythonAppend wxMiniFrame()       ""
 
 375     wxMiniFrame(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);
 
 382     %RenameCtor(PreMiniFrame, wxMiniFrame());
 
 384     bool Create(wxWindow* parent,
 
 385             const wxWindowID id = -1,
 
 386             const wxString& title = wxPyEmptyString,
 
 387             const wxPoint& pos = wxDefaultPosition,
 
 388             const wxSize& size = wxDefaultSize,
 
 389             long style = wxDEFAULT_FRAME_STYLE,
 
 390             const wxString& name = wxPyFrameNameStr);
 
 394 //---------------------------------------------------------------------------
 
 400     wxSPLASH_CENTRE_ON_PARENT,
 
 401     wxSPLASH_CENTRE_ON_SCREEN,
 
 408 MustHaveApp(wxSplashScreenWindow);
 
 410 class wxSplashScreenWindow: public wxWindow
 
 413     %pythonAppend wxSplashScreenWindow         "self._setOORInfo(self)"
 
 415     wxSplashScreenWindow(const wxBitmap& bitmap,
 
 418              const wxPoint& pos = wxDefaultPosition,
 
 419              const wxSize& size = wxDefaultSize,
 
 420              long style = wxNO_BORDER);
 
 422     void SetBitmap(const wxBitmap& bitmap);
 
 423     wxBitmap& GetBitmap();
 
 427 MustHaveApp(wxSplashScreen);
 
 429 class wxSplashScreen : public wxFrame
 
 432     %pythonAppend wxSplashScreen         "self._setOORInfo(self)"
 
 434     wxSplashScreen(const wxBitmap& bitmap,
 
 435             long splashStyle, int milliseconds,
 
 438             const wxPoint& pos = wxDefaultPosition,
 
 439             const wxSize& size = wxDefaultSize,
 
 440             long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
 
 442     long GetSplashStyle() const;
 
 443     wxSplashScreenWindow* GetSplashWindow() const;
 
 444     int GetTimeout() const;
 
 448 //---------------------------------------------------------------------------