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,
 
  63     wxFULLSCREEN_NOMENUBAR,
 
  64     wxFULLSCREEN_NOTOOLBAR,
 
  65     wxFULLSCREEN_NOSTATUSBAR,
 
  66     wxFULLSCREEN_NOBORDER,
 
  67     wxFULLSCREEN_NOCAPTION,
 
  73 // Styles for RequestUserAttention
 
  76     wxUSER_ATTENTION_INFO = 1,
 
  77     wxUSER_ATTENTION_ERROR = 2
 
  80 //---------------------------------------------------------------------------
 
  82 class  wxTopLevelWindow : public wxWindow
 
  86     // No constructor as it can not be used directly from Python
 
  88     // maximize = True => maximize, otherwise - restore
 
  89     virtual void Maximize(bool maximize = true);
 
  91     // undo Maximize() or Iconize()
 
  92     virtual void Restore();
 
  94     // iconize = True => iconize, otherwise - restore
 
  95     virtual void Iconize(bool iconize = true);
 
  97     // return True if the frame is maximized
 
  98     virtual bool IsMaximized() const;
 
 100     // return True if the frame is iconized
 
 101     virtual bool IsIconized() const;
 
 103     // get the frame icon
 
 104     wxIcon GetIcon() const;
 
 106     // set the frame icon
 
 107     virtual void SetIcon(const wxIcon& icon);
 
 109     // set the frame icons
 
 110     virtual void SetIcons(const wxIconBundle& icons );
 
 112     // maximize the window to cover entire screen
 
 113     virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
 
 115     // return True if the frame is in fullscreen mode
 
 116     virtual bool IsFullScreen() const;
 
 118     virtual void SetTitle(const wxString& title);
 
 119     virtual wxString GetTitle() const;
 
 121     // Set the shape of the window to the given region.
 
 122     // Returns True if the platform supports this feature (and the operation
 
 124     virtual bool SetShape(const wxRegion& region);
 
 127     // Attracts the users attention to this window if the application is
 
 128     // inactive (should be called when a background event occurs)
 
 129     virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
 
 133     void MacSetMetalAppearance( bool on ) ;
 
 134     bool MacGetMetalAppearance() const ;
 
 139 //---------------------------------------------------------------------------
 
 142 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
 
 144 // For each of *bars, a frame may have several of them, but only one is
 
 145 // managed by the frame, i.e. resized/moved when the frame is and whose size
 
 146 // is accounted for in client size calculations - all others should be taken
 
 149 MustHaveApp(wxFrame);
 
 151 class wxFrame : public wxTopLevelWindow {
 
 153     %pythonAppend wxFrame         "self._setOORInfo(self)"
 
 154     %pythonAppend wxFrame()       ""
 
 155     %typemap(out) wxFrame*;    // turn off this typemap
 
 157     wxFrame(wxWindow* parent, const wxWindowID id=-1,
 
 158             const wxString& title = wxPyEmptyString,
 
 159             const wxPoint& pos = wxDefaultPosition,
 
 160             const wxSize& size = wxDefaultSize,
 
 161             long style = wxDEFAULT_FRAME_STYLE,
 
 162             const wxString& name = wxPyFrameNameStr);
 
 163     %name(PreFrame)wxFrame();
 
 165     // Turn it back on again
 
 166     %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
 
 169     bool Create(wxWindow* parent, const wxWindowID id=-1,
 
 170                 const wxString& title = wxPyEmptyString,
 
 171                 const wxPoint& pos = wxDefaultPosition,
 
 172                 const wxSize& size = wxDefaultSize,
 
 173                 long style = wxDEFAULT_FRAME_STYLE,
 
 174                 const wxString& name = wxPyFrameNameStr);
 
 180     // get the origin of the client area (which may be different from (0, 0)
 
 181     // if the frame has a toolbar) in client coordinates
 
 182     virtual wxPoint GetClientAreaOrigin() const;
 
 184     // sends a size event to the window using its current size -- this has an
 
 185     // effect of refreshing the window layout
 
 187     virtual void SendSizeEvent();
 
 190     // menu bar functions
 
 191     // ------------------
 
 193     virtual void SetMenuBar(wxMenuBar *menubar);
 
 194     virtual wxMenuBar *GetMenuBar() const;
 
 197     // process menu command: returns True if processed
 
 198     bool ProcessCommand(int winid);
 
 199     %pythoncode { Command = ProcessCommand }
 
 202     // status bar functions
 
 203     // --------------------
 
 205     // create the main status bar by calling OnCreateStatusBar()
 
 206     virtual wxStatusBar* CreateStatusBar(int number = 1,
 
 207                                          long style = wxDEFAULT_STATUSBAR_STYLE,
 
 208                                          wxWindowID winid = 0,
 
 209                                          const wxString& name = wxPyStatusLineNameStr);
 
 210 // TODO: with directors?
 
 211 //     // return a new status bar
 
 212 //     virtual wxStatusBar *OnCreateStatusBar(int number,
 
 215 //                                            const wxString& name);
 
 217     // get the main status bar
 
 218     virtual wxStatusBar *GetStatusBar() const;
 
 220     // sets the main status bar
 
 221     void SetStatusBar(wxStatusBar *statBar);
 
 223     // forward these to status bar
 
 224     virtual void SetStatusText(const wxString &text, int number = 0);
 
 225     virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
 
 226     void PushStatusText(const wxString &text, int number = 0);
 
 227     void PopStatusText(int number = 0);
 
 229     // set the status bar pane the help will be shown in
 
 230     void SetStatusBarPane(int n);
 
 231     int GetStatusBarPane() const;
 
 237     // create main toolbar bycalling OnCreateToolBar()
 
 238     virtual wxToolBar* CreateToolBar(long style = -1,
 
 239                                      wxWindowID winid = -1,
 
 240                                      const wxString& name = wxPyToolBarNameStr);
 
 241 // TODO: with directors?
 
 242 //     // return a new toolbar
 
 243 //     virtual wxToolBar *OnCreateToolBar(long style,
 
 245 //                                        const wxString& name );
 
 247     // get/set the main toolbar
 
 248     virtual wxToolBar *GetToolBar() const;
 
 249     virtual void SetToolBar(wxToolBar *toolbar);
 
 252     // show help text (typically in the statusbar); show is False
 
 253     // if you are hiding the help, True otherwise
 
 254     virtual void DoGiveHelp(const wxString& text, bool show);
 
 257     // send wxUpdateUIEvents for all menu items in the menubar,
 
 258     // or just for menu if non-NULL
 
 259     void DoMenuUpdates(wxMenu* menu = NULL);
 
 261     static wxVisualAttributes
 
 262     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 265 //---------------------------------------------------------------------------
 
 268 MustHaveApp(wxDialog);
 
 270 class wxDialog : public wxTopLevelWindow {
 
 272     %pythonAppend wxDialog   "self._setOORInfo(self)"
 
 273     %pythonAppend wxDialog() ""
 
 274     %typemap(out) wxDialog*;    // turn off this typemap
 
 276     wxDialog(wxWindow* parent,
 
 277              const wxWindowID id=-1,
 
 278              const wxString& title = wxPyEmptyString,
 
 279              const wxPoint& pos = wxDefaultPosition,
 
 280              const wxSize& size = wxDefaultSize,
 
 281              long style = wxDEFAULT_DIALOG_STYLE,
 
 282              const wxString& name = wxPyDialogNameStr);
 
 283     %name(PreDialog)wxDialog();
 
 285     // Turn it back on again
 
 286     %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
 
 288     bool Create(wxWindow* parent,
 
 289                 const wxWindowID id=-1,
 
 290                 const wxString& title = wxPyEmptyString,
 
 291                 const wxPoint& pos = wxDefaultPosition,
 
 292                 const wxSize& size = wxDefaultSize,
 
 293                 long style = wxDEFAULT_DIALOG_STYLE,
 
 294                 const wxString& name = wxPyDialogNameStr);
 
 297     // the modal dialogs have a return code - usually the id of the last
 
 299     void SetReturnCode(int returnCode);
 
 300     int GetReturnCode() const;
 
 302     // splits text up at newlines and places the
 
 303     // lines into a vertical wxBoxSizer
 
 304     wxSizer *CreateTextSizer( const wxString &message );
 
 306     // places buttons into a horizontal wxBoxSizer
 
 307     wxSizer *CreateButtonSizer( long flags );
 
 310     //void SetModal(bool flag);
 
 312     // is the dialog in modal state right now?
 
 313     virtual bool IsModal() const;
 
 315     // Shows the dialog and starts a nested event loop that returns when
 
 316     // EndModal is called.
 
 317     virtual int ShowModal();
 
 319     // may be called to terminate the dialog with the given return code
 
 320     virtual void EndModal(int retCode);
 
 322     static wxVisualAttributes
 
 323     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 326         def SendSizeEvent(self):
 
 327             self.ProcessEvent(wx.SizeEvent((-1,-1)))
 
 331 //---------------------------------------------------------------------------
 
 335 MustHaveApp(wxMiniFrame);
 
 337 class wxMiniFrame : public wxFrame {
 
 339     %pythonAppend wxMiniFrame         "self._setOORInfo(self)"
 
 340     %pythonAppend wxMiniFrame()       ""
 
 342     wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
 
 343                 const wxString& title = wxPyEmptyString,
 
 344                 const wxPoint& pos = wxDefaultPosition,
 
 345                 const wxSize& size = wxDefaultSize,
 
 346                 long style = wxDEFAULT_FRAME_STYLE,
 
 347                 const wxString& name = wxPyFrameNameStr);
 
 348     %name(PreMiniFrame)wxMiniFrame();
 
 350     bool Create(wxWindow* parent, const wxWindowID id=-1,
 
 351                 const wxString& title = wxPyEmptyString,
 
 352                 const wxPoint& pos = wxDefaultPosition,
 
 353                 const wxSize& size = wxDefaultSize,
 
 354                 long style = wxDEFAULT_FRAME_STYLE,
 
 355                 const wxString& name = wxPyFrameNameStr);
 
 360 //---------------------------------------------------------------------------
 
 365     wxSPLASH_CENTRE_ON_PARENT,
 
 366     wxSPLASH_CENTRE_ON_SCREEN,
 
 373 MustHaveApp(wxSplashScreenWindow);
 
 375 class wxSplashScreenWindow: public wxWindow
 
 378     %pythonAppend wxSplashScreenWindow         "self._setOORInfo(self)"
 
 380     wxSplashScreenWindow(const wxBitmap& bitmap,
 
 381                          wxWindow* parent, wxWindowID id,
 
 382                          const wxPoint& pos = wxDefaultPosition,
 
 383                          const wxSize& size = wxDefaultSize,
 
 384                          long style = wxNO_BORDER);
 
 386     void SetBitmap(const wxBitmap& bitmap);
 
 387     wxBitmap& GetBitmap();
 
 391 MustHaveApp(wxSplashScreen);
 
 393 class wxSplashScreen : public wxFrame {
 
 395     %pythonAppend wxSplashScreen         "self._setOORInfo(self)"
 
 397     wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
 
 398                    wxWindow* parent, wxWindowID id=-1,
 
 399                    const wxPoint& pos = wxDefaultPosition,
 
 400                    const wxSize& size = wxDefaultSize,
 
 401                    long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
 
 403     long GetSplashStyle() const;
 
 404     wxSplashScreenWindow* GetSplashWindow() const;
 
 405     int GetTimeout() const;
 
 409 //---------------------------------------------------------------------------