]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_toplvl.i
Applied patch [ 845171 ] Use transparancy mask in wxBitmapShape
[wxWidgets.git] / wxPython / src / _toplvl.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _toplvl.i
3 // Purpose: SWIG definitions for wxTopLevelWindow, wxFrame, wxDialog and etc.
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 27-Aug-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17
18 %{
19 // Put some wx default wxChar* values into wxStrings.
20 DECLARE_DEF_STRING(FrameNameStr);
21 DECLARE_DEF_STRING(DialogNameStr);
22 DECLARE_DEF_STRING(StatusLineNameStr);
23 DECLARE_DEF_STRING(ToolBarNameStr);
24 %}
25
26 //---------------------------------------------------------------------------
27 %newgroup
28
29 enum
30 {
31 wxFULLSCREEN_NOMENUBAR,
32 wxFULLSCREEN_NOTOOLBAR,
33 wxFULLSCREEN_NOSTATUSBAR,
34 wxFULLSCREEN_NOBORDER,
35 wxFULLSCREEN_NOCAPTION,
36 wxFULLSCREEN_ALL,
37
38 wxTOPLEVEL_EX_DIALOG,
39 };
40
41
42
43 %typemap(in) (int widths, int* widths_field) {
44 $1 = PyList_Size($input);
45 $2 = int_LIST_helper($input);
46 if ($2 == NULL) SWIG_fail;
47 }
48
49 %typemap(freearg) (int widths, int* widths_field) {
50 if ($2) delete [] $2;
51 }
52
53
54 //---------------------------------------------------------------------------
55
56 class wxTopLevelWindow : public wxWindow
57 {
58 public:
59
60 // No constructor as it can not be used directly from Python
61
62 // maximize = True => maximize, otherwise - restore
63 virtual void Maximize(bool maximize = True);
64
65 // undo Maximize() or Iconize()
66 virtual void Restore();
67
68 // iconize = True => iconize, otherwise - restore
69 virtual void Iconize(bool iconize = True);
70
71 // return True if the frame is maximized
72 virtual bool IsMaximized() const;
73
74 // return True if the frame is iconized
75 virtual bool IsIconized() const;
76
77 // get the frame icon
78 wxIcon GetIcon() const;
79
80 // set the frame icon
81 virtual void SetIcon(const wxIcon& icon);
82
83 // set the frame icons
84 virtual void SetIcons(const wxIconBundle& icons );
85
86 // maximize the window to cover entire screen
87 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
88
89 // return True if the frame is in fullscreen mode
90 virtual bool IsFullScreen() const;
91
92 virtual void SetTitle(const wxString& title);
93 virtual wxString GetTitle() const;
94
95 // Set the shape of the window to the given region.
96 // Returns True if the platform supports this feature (and the operation
97 // is successful.)
98 virtual bool SetShape(const wxRegion& region);
99
100 };
101
102
103 //---------------------------------------------------------------------------
104 %newgroup
105
106 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
107 //
108 // For each of *bars, a frame may have several of them, but only one is
109 // managed by the frame, i.e. resized/moved when the frame is and whose size
110 // is accounted for in client size calculations - all others should be taken
111 // care of manually.
112
113 class wxFrame : public wxTopLevelWindow {
114 public:
115 %addtofunc wxFrame "self._setOORInfo(self)"
116 %addtofunc wxFrame() ""
117
118 wxFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
119 const wxPoint& pos = wxDefaultPosition,
120 const wxSize& size = wxDefaultSize,
121 long style = wxDEFAULT_FRAME_STYLE,
122 const wxString& name = wxPyFrameNameStr);
123 %name(PreFrame)wxFrame();
124
125 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
126 const wxPoint& pos = wxDefaultPosition,
127 const wxSize& size = wxDefaultSize,
128 long style = wxDEFAULT_FRAME_STYLE,
129 const wxString& name = wxPyFrameNameStr);
130
131
132 // frame state
133 // -----------
134
135 // get the origin of the client area (which may be different from (0, 0)
136 // if the frame has a toolbar) in client coordinates
137 virtual wxPoint GetClientAreaOrigin() const;
138
139 // sends a size event to the window using its current size -- this has an
140 // effect of refreshing the window layout
141 //
142 virtual void SendSizeEvent() { }
143
144
145 // menu bar functions
146 // ------------------
147
148 virtual void SetMenuBar(wxMenuBar *menubar);
149 virtual wxMenuBar *GetMenuBar() const;
150
151
152 // process menu command: returns True if processed
153 bool ProcessCommand(int winid);
154 %pythoncode { Command = ProcessCommand }
155
156
157 // status bar functions
158 // --------------------
159
160 // create the main status bar by calling OnCreateStatusBar()
161 virtual wxStatusBar* CreateStatusBar(int number = 1,
162 long style = wxST_SIZEGRIP,
163 wxWindowID winid = 0,
164 const wxString& name = wxPyStatusLineNameStr);
165 // TODO: with directors?
166 // // return a new status bar
167 // virtual wxStatusBar *OnCreateStatusBar(int number,
168 // long style,
169 // wxWindowID winid,
170 // const wxString& name);
171
172 // get the main status bar
173 virtual wxStatusBar *GetStatusBar() const;
174
175 // sets the main status bar
176 void SetStatusBar(wxStatusBar *statBar);
177
178 // forward these to status bar
179 virtual void SetStatusText(const wxString &text, int number = 0);
180 virtual void SetStatusWidths(int widths, const int* widths_field); //uses typemap above
181 void PushStatusText(const wxString &text, int number = 0);
182 void PopStatusText(int number = 0);
183
184 // set the status bar pane the help will be shown in
185 void SetStatusBarPane(int n);
186 int GetStatusBarPane() const;
187
188
189 // toolbar functions
190 // -----------------
191
192 // create main toolbar bycalling OnCreateToolBar()
193 virtual wxToolBar* CreateToolBar(long style = -1,
194 wxWindowID winid = -1,
195 const wxString& name = wxPyToolBarNameStr);
196 // TODO: with directors?
197 // // return a new toolbar
198 // virtual wxToolBar *OnCreateToolBar(long style,
199 // wxWindowID winid,
200 // const wxString& name );
201
202 // get/set the main toolbar
203 virtual wxToolBar *GetToolBar() const;
204 virtual void SetToolBar(wxToolBar *toolbar);
205
206
207 // show help text (typically in the statusbar); show is False
208 // if you are hiding the help, True otherwise
209 virtual void DoGiveHelp(const wxString& text, bool show);
210
211
212 // send wxUpdateUIEvents for all menu items in the menubar,
213 // or just for menu if non-NULL
214 void DoMenuUpdates(wxMenu* menu = NULL);
215 };
216
217 //---------------------------------------------------------------------------
218 %newgroup
219
220 class wxDialog : public wxTopLevelWindow {
221 public:
222 %addtofunc wxDialog "self._setOORInfo(self)"
223 %addtofunc wxDialog() ""
224
225 wxDialog(wxWindow* parent,
226 const wxWindowID id,
227 const wxString& title,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
230 long style = wxDEFAULT_DIALOG_STYLE,
231 const wxString& name = wxPyDialogNameStr);
232 %name(PreDialog)wxDialog();
233
234 bool Create(wxWindow* parent,
235 const wxWindowID id,
236 const wxString& title,
237 const wxPoint& pos = wxDefaultPosition,
238 const wxSize& size = wxDefaultSize,
239 long style = wxDEFAULT_DIALOG_STYLE,
240 const wxString& name = wxPyDialogNameStr);
241
242
243 // the modal dialogs have a return code - usually the id of the last
244 // pressed button
245 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
246 int GetReturnCode() const { return m_returnCode; }
247
248 // splits text up at newlines and places the
249 // lines into a vertical wxBoxSizer
250 wxSizer *CreateTextSizer( const wxString &message );
251
252 // places buttons into a horizontal wxBoxSizer
253 wxSizer *CreateButtonSizer( long flags );
254
255
256 void SetModal(bool flag);
257 virtual bool IsModal() const;
258
259 // Shows the dialog and starts a nested event loop that returns when
260 // EndModal is called.
261 virtual int ShowModal();
262
263 // may be called to terminate the dialog with the given return code
264 virtual void EndModal(int retCode);
265
266 // returns True if we're in a modal loop
267 %extend {
268 bool IsModalShowing() {
269 #ifdef __WXGTK__
270 return self->m_modalShowing;
271 #else
272 return self->IsModalShowing();
273 #endif
274 }
275 }
276 };
277
278 //---------------------------------------------------------------------------
279 %newgroup
280
281
282 class wxMiniFrame : public wxFrame {
283 public:
284 %addtofunc wxMiniFrame "self._setOORInfo(self)"
285 %addtofunc wxMiniFrame() ""
286
287 wxMiniFrame(wxWindow* parent, const wxWindowID id, const wxString& title,
288 const wxPoint& pos = wxDefaultPosition,
289 const wxSize& size = wxDefaultSize,
290 long style = wxDEFAULT_FRAME_STYLE,
291 const wxString& name = wxPyFrameNameStr);
292 %name(PreMiniFrame)wxMiniFrame();
293
294 bool Create(wxWindow* parent, const wxWindowID id, const wxString& title,
295 const wxPoint& pos = wxDefaultPosition,
296 const wxSize& size = wxDefaultSize,
297 long style = wxDEFAULT_FRAME_STYLE,
298 const wxString& name = wxPyFrameNameStr);
299
300 };
301
302
303 //---------------------------------------------------------------------------
304 %newgroup
305
306
307 enum {
308 wxSPLASH_CENTRE_ON_PARENT,
309 wxSPLASH_CENTRE_ON_SCREEN,
310 wxSPLASH_NO_CENTRE,
311 wxSPLASH_TIMEOUT,
312 wxSPLASH_NO_TIMEOUT,
313 };
314
315
316 class wxSplashScreenWindow: public wxWindow
317 {
318 public:
319 %addtofunc wxSplashScreenWindow "self._setOORInfo(self)"
320
321 wxSplashScreenWindow(const wxBitmap& bitmap,
322 wxWindow* parent, wxWindowID id,
323 const wxPoint& pos = wxDefaultPosition,
324 const wxSize& size = wxDefaultSize,
325 long style = wxNO_BORDER);
326
327 void SetBitmap(const wxBitmap& bitmap);
328 wxBitmap& GetBitmap();
329 };
330
331
332 class wxSplashScreen : public wxFrame {
333 public:
334 %addtofunc wxSplashScreen "self._setOORInfo(self)"
335
336 wxSplashScreen(const wxBitmap& bitmap, long splashStyle, int milliseconds,
337 wxWindow* parent, wxWindowID id,
338 const wxPoint& pos = wxDefaultPosition,
339 const wxSize& size = wxDefaultSize,
340 long style = wxSIMPLE_BORDER|wxFRAME_NO_TASKBAR|wxSTAY_ON_TOP);
341
342 long GetSplashStyle() const;
343 wxSplashScreenWindow* GetSplashWindow() const;
344 int GetTimeout() const;
345 };
346
347
348 //---------------------------------------------------------------------------