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,
62 wxFULLSCREEN_NOMENUBAR,
63 wxFULLSCREEN_NOTOOLBAR,
64 wxFULLSCREEN_NOSTATUSBAR,
65 wxFULLSCREEN_NOBORDER,
66 wxFULLSCREEN_NOCAPTION,
73 //---------------------------------------------------------------------------
75 class wxTopLevelWindow : public wxWindow
79 // No constructor as it can not be used directly from Python
81 // maximize = True => maximize, otherwise - restore
82 virtual void Maximize(bool maximize = True);
84 // undo Maximize() or Iconize()
85 virtual void Restore();
87 // iconize = True => iconize, otherwise - restore
88 virtual void Iconize(bool iconize = True);
90 // return True if the frame is maximized
91 virtual bool IsMaximized() const;
93 // return True if the frame is iconized
94 virtual bool IsIconized() const;
97 wxIcon GetIcon() const;
100 virtual void SetIcon(const wxIcon& icon);
102 // set the frame icons
103 virtual void SetIcons(const wxIconBundle& icons );
105 // maximize the window to cover entire screen
106 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
108 // return True if the frame is in fullscreen mode
109 virtual bool IsFullScreen() const;
111 virtual void SetTitle(const wxString& title);
112 virtual wxString GetTitle() const;
114 // Set the shape of the window to the given region.
115 // Returns True if the platform supports this feature (and the operation
117 virtual bool SetShape(const wxRegion& region);
120 void MacSetMetalAppearance( bool on ) ;
121 bool MacGetMetalAppearance() const ;
126 //---------------------------------------------------------------------------
129 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
131 // For each of *bars, a frame may have several of them, but only one is
132 // managed by the frame, i.e. resized/moved when the frame is and whose size
133 // is accounted for in client size calculations - all others should be taken
136 MustHaveApp(wxFrame);
138 class wxFrame : public wxTopLevelWindow {
140 %pythonAppend wxFrame "self._setOORInfo(self)"
141 %pythonAppend wxFrame() ""
142 %typemap(out) wxFrame*; // turn off this typemap
144 wxFrame(wxWindow* parent, const wxWindowID id=-1,
145 const wxString& title = wxPyEmptyString,
146 const wxPoint& pos = wxDefaultPosition,
147 const wxSize& size = wxDefaultSize,
148 long style = wxDEFAULT_FRAME_STYLE,
149 const wxString& name = wxPyFrameNameStr);
150 %name(PreFrame)wxFrame();
152 // Turn it back on again
153 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
156 bool Create(wxWindow* parent, const wxWindowID id=-1,
157 const wxString& title = wxPyEmptyString,
158 const wxPoint& pos = wxDefaultPosition,
159 const wxSize& size = wxDefaultSize,
160 long style = wxDEFAULT_FRAME_STYLE,
161 const wxString& name = wxPyFrameNameStr);
167 // get the origin of the client area (which may be different from (0, 0)
168 // if the frame has a toolbar) in client coordinates
169 virtual wxPoint GetClientAreaOrigin() const;
171 // sends a size event to the window using its current size -- this has an
172 // effect of refreshing the window layout
174 virtual void SendSizeEvent();
177 // menu bar functions
178 // ------------------
180 virtual void SetMenuBar(wxMenuBar *menubar);
181 virtual wxMenuBar *GetMenuBar() const;
184 // process menu command: returns True if processed
185 bool ProcessCommand(int winid);
186 %pythoncode { Command = ProcessCommand }
189 // status bar functions
190 // --------------------
192 // create the main status bar by calling OnCreateStatusBar()
193 virtual wxStatusBar* CreateStatusBar(int number = 1,
194 long style = wxDEFAULT_STATUSBAR_STYLE,
195 wxWindowID winid = 0,
196 const wxString& name = wxPyStatusLineNameStr);
197 // TODO: with directors?
198 // // return a new status bar
199 // virtual wxStatusBar *OnCreateStatusBar(int number,
202 // const wxString& name);
204 // get the main status bar
205 virtual wxStatusBar *GetStatusBar() const;
207 // sets the main status bar
208 void SetStatusBar(wxStatusBar *statBar);
210 // forward these to status bar
211 virtual void SetStatusText(const wxString &text, int number = 0);
212 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
213 void PushStatusText(const wxString &text, int number = 0);
214 void PopStatusText(int number = 0);
216 // set the status bar pane the help will be shown in
217 void SetStatusBarPane(int n);
218 int GetStatusBarPane() const;
224 // create main toolbar bycalling OnCreateToolBar()
225 virtual wxToolBar* CreateToolBar(long style = -1,
226 wxWindowID winid = -1,
227 const wxString& name = wxPyToolBarNameStr);
228 // TODO: with directors?
229 // // return a new toolbar
230 // virtual wxToolBar *OnCreateToolBar(long style,
232 // const wxString& name );
234 // get/set the main toolbar
235 virtual wxToolBar *GetToolBar() const;
236 virtual void SetToolBar(wxToolBar *toolbar);
239 // show help text (typically in the statusbar); show is False
240 // if you are hiding the help, True otherwise
241 virtual void DoGiveHelp(const wxString& text, bool show);
244 // send wxUpdateUIEvents for all menu items in the menubar,
245 // or just for menu if non-NULL
246 void DoMenuUpdates(wxMenu* menu = NULL);
248 static wxVisualAttributes
249 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
252 //---------------------------------------------------------------------------
255 MustHaveApp(wxDialog);
257 class wxDialog : public wxTopLevelWindow {
259 %pythonAppend wxDialog "self._setOORInfo(self)"
260 %pythonAppend wxDialog() ""
261 %typemap(out) wxDialog*; // turn off this typemap
263 wxDialog(wxWindow* parent,
264 const wxWindowID id=-1,
265 const wxString& title = wxPyEmptyString,
266 const wxPoint& pos = wxDefaultPosition,
267 const wxSize& size = wxDefaultSize,
268 long style = wxDEFAULT_DIALOG_STYLE,
269 const wxString& name = wxPyDialogNameStr);
270 %name(PreDialog)wxDialog();
272 // Turn it back on again
273 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
275 bool Create(wxWindow* parent,
276 const wxWindowID id=-1,
277 const wxString& title = wxPyEmptyString,
278 const wxPoint& pos = wxDefaultPosition,
279 const wxSize& size = wxDefaultSize,
280 long style = wxDEFAULT_DIALOG_STYLE,
281 const wxString& name = wxPyDialogNameStr);
284 // the modal dialogs have a return code - usually the id of the last
286 void SetReturnCode(int returnCode);
287 int GetReturnCode() const;
289 // splits text up at newlines and places the
290 // lines into a vertical wxBoxSizer
291 wxSizer *CreateTextSizer( const wxString &message );
293 // places buttons into a horizontal wxBoxSizer
294 wxSizer *CreateButtonSizer( long flags );
297 //void SetModal(bool flag);
299 // is the dialog in modal state right now?
300 virtual bool IsModal() const;
302 // Shows the dialog and starts a nested event loop that returns when
303 // EndModal is called.
304 virtual int ShowModal();
306 // may be called to terminate the dialog with the given return code
307 virtual void EndModal(int retCode);
309 static wxVisualAttributes
310 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
313 def SendSizeEvent(self):
314 self.ProcessEvent(wx.SizeEvent((-1,-1)))
318 //---------------------------------------------------------------------------
322 MustHaveApp(wxMiniFrame);
324 class wxMiniFrame : public wxFrame {
326 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
327 %pythonAppend wxMiniFrame() ""
329 wxMiniFrame(wxWindow* parent, const wxWindowID id=-1,
330 const wxString& title = wxPyEmptyString,
331 const wxPoint& pos = wxDefaultPosition,
332 const wxSize& size = wxDefaultSize,
333 long style = wxDEFAULT_FRAME_STYLE,
334 const wxString& name = wxPyFrameNameStr);
335 %name(PreMiniFrame)wxMiniFrame();
337 bool Create(wxWindow* parent, const wxWindowID id=-1,
338 const wxString& title = wxPyEmptyString,
339 const wxPoint& pos = wxDefaultPosition,
340 const wxSize& size = wxDefaultSize,
341 long style = wxDEFAULT_FRAME_STYLE,
342 const wxString& name = wxPyFrameNameStr);
347 //---------------------------------------------------------------------------
352 wxSPLASH_CENTRE_ON_PARENT,
353 wxSPLASH_CENTRE_ON_SCREEN,
360 MustHaveApp(wxSplashScreenWindow);
362 class wxSplashScreenWindow: public wxWindow
365 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
367 wxSplashScreenWindow(const wxBitmap& bitmap,
368 wxWindow* parent, wxWindowID id,
369 const wxPoint& pos = wxDefaultPosition,
370 const wxSize& size = wxDefaultSize,
371 long style = wxNO_BORDER);
373 void SetBitmap(const wxBitmap& bitmap);
374 wxBitmap& GetBitmap();
378 MustHaveApp(wxSplashScreen);
380 class wxSplashScreen : public wxFrame {
382 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
384 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
385 wxWindow* parent, wxWindowID id=-1,
386 const wxPoint& pos = wxDefaultPosition,
387 const wxSize& size = wxDefaultSize,
388 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
390 long GetSplashStyle() const;
391 wxSplashScreenWindow* GetSplashWindow() const;
392 int GetTimeout() const;
396 //---------------------------------------------------------------------------