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);
 
 131     // Is this the active frame (highlighted in the taskbar)?
 
 132     virtual bool IsActive();
 
 135     void MacSetMetalAppearance( bool on ) ;
 
 136     bool MacGetMetalAppearance() const ;
 
 139         // TODO: Should they raise not implemented or just NOP???
 
 140         void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
 
 141         bool MacGetMetalAppearance() const    { /*wxPyRaiseNotImplemented();*/ return false; }
 
 147 //---------------------------------------------------------------------------
 
 150 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
 
 152 // For each of *bars, a frame may have several of them, but only one is
 
 153 // managed by the frame, i.e. resized/moved when the frame is and whose size
 
 154 // is accounted for in client size calculations - all others should be taken
 
 157 MustHaveApp(wxFrame);
 
 159 class wxFrame : public wxTopLevelWindow {
 
 161     %pythonAppend wxFrame         "self._setOORInfo(self)"
 
 162     %pythonAppend wxFrame()       ""
 
 163     %typemap(out) wxFrame*;    // turn off this typemap
 
 165     wxFrame(wxWindow* parent, const wxWindowID id=-1,
 
 166             const wxString& title = wxPyEmptyString,
 
 167             const wxPoint& pos = wxDefaultPosition,
 
 168             const wxSize& size = wxDefaultSize,
 
 169             long style = wxDEFAULT_FRAME_STYLE,
 
 170             const wxString& name = wxPyFrameNameStr);
 
 171     %RenameCtor(PreFrame, wxFrame());
 
 173     // Turn it back on again
 
 174     %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
 
 177     bool Create(wxWindow* parent, const wxWindowID id=-1,
 
 178                 const wxString& title = wxPyEmptyString,
 
 179                 const wxPoint& pos = wxDefaultPosition,
 
 180                 const wxSize& size = wxDefaultSize,
 
 181                 long style = wxDEFAULT_FRAME_STYLE,
 
 182                 const wxString& name = wxPyFrameNameStr);
 
 188     // get the origin of the client area (which may be different from (0, 0)
 
 189     // if the frame has a toolbar) in client coordinates
 
 190     virtual wxPoint GetClientAreaOrigin() const;
 
 192     // sends a size event to the window using its current size -- this has an
 
 193     // effect of refreshing the window layout
 
 194     virtual void SendSizeEvent();
 
 197     // menu bar functions
 
 198     // ------------------
 
 200     virtual void SetMenuBar(wxMenuBar *menubar);
 
 201     virtual wxMenuBar *GetMenuBar() const;
 
 204     // process menu command: returns True if processed
 
 205     bool ProcessCommand(int winid);
 
 206     %pythoncode { Command = ProcessCommand }
 
 209     // status bar functions
 
 210     // --------------------
 
 212     // create the main status bar by calling OnCreateStatusBar()
 
 213     virtual wxStatusBar* CreateStatusBar(int number = 1,
 
 214                                          long style = wxDEFAULT_STATUSBAR_STYLE,
 
 215                                          wxWindowID winid = 0,
 
 216                                          const wxString& name = wxPyStatusLineNameStr);
 
 217 // TODO: with directors?
 
 218 //     // return a new status bar
 
 219 //     virtual wxStatusBar *OnCreateStatusBar(int number,
 
 222 //                                            const wxString& name);
 
 224     // get the main status bar
 
 225     virtual wxStatusBar *GetStatusBar() const;
 
 227     // sets the main status bar
 
 228     void SetStatusBar(wxStatusBar *statBar);
 
 230     // forward these to status bar
 
 231     virtual void SetStatusText(const wxString &text, int number = 0);
 
 232     virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
 
 233     void PushStatusText(const wxString &text, int number = 0);
 
 234     void PopStatusText(int number = 0);
 
 236     // set the status bar pane the help will be shown in
 
 237     void SetStatusBarPane(int n);
 
 238     int GetStatusBarPane() const;
 
 244     // create main toolbar bycalling OnCreateToolBar()
 
 245     virtual wxToolBar* CreateToolBar(long style = -1,
 
 246                                      wxWindowID winid = -1,
 
 247                                      const wxString& name = wxPyToolBarNameStr);
 
 248 // TODO: with directors?
 
 249 //     // return a new toolbar
 
 250 //     virtual wxToolBar *OnCreateToolBar(long style,
 
 252 //                                        const wxString& name );
 
 254     // get/set the main toolbar
 
 255     virtual wxToolBar *GetToolBar() const;
 
 256     virtual void SetToolBar(wxToolBar *toolbar);
 
 259     // show help text (typically in the statusbar); show is False
 
 260     // if you are hiding the help, True otherwise
 
 261     virtual void DoGiveHelp(const wxString& text, bool show);
 
 264     // send wxUpdateUIEvents for all menu items in the menubar,
 
 265     // or just for menu if non-NULL
 
 266     void DoMenuUpdates(wxMenu* menu = NULL);
 
 268     static wxVisualAttributes
 
 269     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 272 //---------------------------------------------------------------------------
 
 275 MustHaveApp(wxDialog);
 
 277 class wxDialog : public wxTopLevelWindow {
 
 279     %pythonAppend wxDialog   "self._setOORInfo(self)"
 
 280     %pythonAppend wxDialog() ""
 
 281     %typemap(out) wxDialog*;    // turn off this typemap
 
 283     wxDialog(wxWindow* parent,
 
 284              const wxWindowID id=-1,
 
 285              const wxString& title = wxPyEmptyString,
 
 286              const wxPoint& pos = wxDefaultPosition,
 
 287              const wxSize& size = wxDefaultSize,
 
 288              long style = wxDEFAULT_DIALOG_STYLE,
 
 289              const wxString& name = wxPyDialogNameStr);
 
 290     %RenameCtor(PreDialog, wxDialog());
 
 292     // Turn it back on again
 
 293     %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
 
 295     bool Create(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);
 
 304     // the modal dialogs have a return code - usually the id of the last
 
 306     void SetReturnCode(int returnCode);
 
 307     int GetReturnCode() const;
 
 309     // splits text up at newlines and places the
 
 310     // lines into a vertical wxBoxSizer
 
 311     wxSizer* CreateTextSizer( const wxString &message );
 
 313     // places buttons into a horizontal wxBoxSizer
 
 314     wxSizer* CreateButtonSizer( long flags );
 
 315     wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
 
 317     //void SetModal(bool flag);
 
 319     // is the dialog in modal state right now?
 
 320     virtual bool IsModal() const;
 
 322     // Shows the dialog and starts a nested event loop that returns when
 
 323     // EndModal is called.
 
 324     virtual int ShowModal();
 
 326     // may be called to terminate the dialog with the given return code
 
 327     virtual void EndModal(int retCode);
 
 329     static wxVisualAttributes
 
 330     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 333         def SendSizeEvent(self):
 
 334             self.ProcessEvent(wx.SizeEvent((-1,-1)))
 
 338 //---------------------------------------------------------------------------
 
 342 MustHaveApp(wxMiniFrame);
 
 344 class wxMiniFrame : public wxFrame {
 
 346     %pythonAppend wxMiniFrame         "self._setOORInfo(self)"
 
 347     %pythonAppend wxMiniFrame()       ""
 
 349     wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
 
 350                 const wxString& title = wxPyEmptyString,
 
 351                 const wxPoint& pos = wxDefaultPosition,
 
 352                 const wxSize& size = wxDefaultSize,
 
 353                 long style = wxDEFAULT_FRAME_STYLE,
 
 354                 const wxString& name = wxPyFrameNameStr);
 
 355     %RenameCtor(PreMiniFrame, wxMiniFrame());
 
 357     bool Create(wxWindow* parent, const wxWindowID id=-1,
 
 358                 const wxString& title = wxPyEmptyString,
 
 359                 const wxPoint& pos = wxDefaultPosition,
 
 360                 const wxSize& size = wxDefaultSize,
 
 361                 long style = wxDEFAULT_FRAME_STYLE,
 
 362                 const wxString& name = wxPyFrameNameStr);
 
 367 //---------------------------------------------------------------------------
 
 372     wxSPLASH_CENTRE_ON_PARENT,
 
 373     wxSPLASH_CENTRE_ON_SCREEN,
 
 380 MustHaveApp(wxSplashScreenWindow);
 
 382 class wxSplashScreenWindow: public wxWindow
 
 385     %pythonAppend wxSplashScreenWindow         "self._setOORInfo(self)"
 
 387     wxSplashScreenWindow(const wxBitmap& bitmap,
 
 388                          wxWindow* parent, wxWindowID id,
 
 389                          const wxPoint& pos = wxDefaultPosition,
 
 390                          const wxSize& size = wxDefaultSize,
 
 391                          long style = wxNO_BORDER);
 
 393     void SetBitmap(const wxBitmap& bitmap);
 
 394     wxBitmap& GetBitmap();
 
 398 MustHaveApp(wxSplashScreen);
 
 400 class wxSplashScreen : public wxFrame {
 
 402     %pythonAppend wxSplashScreen         "self._setOORInfo(self)"
 
 404     wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
 
 405                    wxWindow* parent, wxWindowID id=-1,
 
 406                    const wxPoint& pos = wxDefaultPosition,
 
 407                    const wxSize& size = wxDefaultSize,
 
 408                    long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
 
 410     long GetSplashStyle() const;
 
 411     wxSplashScreenWindow* GetSplashWindow() const;
 
 412     int GetTimeout() const;
 
 416 //---------------------------------------------------------------------------