]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_toplvl.i
Add wxWS_EX_CONTEXTHELP, leaving wxFRAME_EX_CONTEXTHELP and
[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 MAKE_CONST_WXSTRING(FrameNameStr);
19 MAKE_CONST_WXSTRING(DialogNameStr);
20 MAKE_CONST_WXSTRING(StatusLineNameStr);
21 MAKE_CONST_WXSTRING(ToolBarNameStr);
22
23 //---------------------------------------------------------------------------
24 %newgroup
25
26 enum
27 {
28 wxSTAY_ON_TOP,
29 wxICONIZE,
30 wxMINIMIZE,
31 wxMAXIMIZE,
32 wxCLOSE_BOX,
33 wxTHICK_FRAME,
34 wxSYSTEM_MENU,
35 wxMINIMIZE_BOX,
36 wxMAXIMIZE_BOX,
37 wxTINY_CAPTION_HORIZ,
38 wxTINY_CAPTION_VERT,
39 wxRESIZE_BOX,
40 wxRESIZE_BORDER,
41
42 wxDIALOG_NO_PARENT,
43
44 wxDEFAULT_FRAME_STYLE,
45 wxDEFAULT_DIALOG_STYLE,
46
47 wxFRAME_TOOL_WINDOW,
48 wxFRAME_FLOAT_ON_PARENT,
49 wxFRAME_NO_WINDOW_MENU,
50 wxFRAME_NO_TASKBAR,
51 wxFRAME_SHAPED,
52 wxFRAME_DRAWER,
53
54 wxFRAME_EX_METAL,
55 wxDIALOG_EX_METAL,
56 wxWS_EX_CONTEXTHELP,
57
58 // Obsolete
59 wxDIALOG_MODAL,
60 wxDIALOG_MODELESS,
61 wxUSER_COLOURS,
62 wxNO_3D,
63
64 wxFRAME_EX_CONTEXTHELP,
65 wxDIALOG_EX_CONTEXTHELP,
66 };
67
68
69 enum
70 {
71 wxFULLSCREEN_NOMENUBAR,
72 wxFULLSCREEN_NOTOOLBAR,
73 wxFULLSCREEN_NOSTATUSBAR,
74 wxFULLSCREEN_NOBORDER,
75 wxFULLSCREEN_NOCAPTION,
76 wxFULLSCREEN_ALL,
77
78 wxTOPLEVEL_EX_DIALOG,
79 };
80
81 // Styles for RequestUserAttention
82 enum
83 {
84 wxUSER_ATTENTION_INFO = 1,
85 wxUSER_ATTENTION_ERROR = 2
86 };
87
88 //---------------------------------------------------------------------------
89
90 class wxTopLevelWindow : public wxWindow
91 {
92 public:
93
94 // No constructor as it can not be used directly from Python
95
96 // maximize = True => maximize, otherwise - restore
97 virtual void Maximize(bool maximize = true);
98
99 // undo Maximize() or Iconize()
100 virtual void Restore();
101
102 // iconize = True => iconize, otherwise - restore
103 virtual void Iconize(bool iconize = true);
104
105 // return True if the frame is maximized
106 virtual bool IsMaximized() const;
107
108 // return true if the frame is always maximized
109 // due to native guidelines or current policy
110 virtual bool IsAlwaysMaximized() const;
111
112 // return True if the frame is iconized
113 virtual bool IsIconized() const;
114
115 // get the frame icon
116 wxIcon GetIcon() const;
117
118 // set the frame icon
119 virtual void SetIcon(const wxIcon& icon);
120
121 // set the frame icons
122 virtual void SetIcons(const wxIconBundle& icons);
123
124 // maximize the window to cover entire screen
125 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
126
127 // return True if the frame is in fullscreen mode
128 virtual bool IsFullScreen() const;
129
130 virtual void SetTitle(const wxString& title);
131 virtual wxString GetTitle() const;
132
133 // Set the shape of the window to the given region.
134 // Returns True if the platform supports this feature
135 // (and the operation is successful.)
136 virtual bool SetShape(const wxRegion& region);
137
138 // Attracts the users attention to this window if the application is inactive
139 // (should be called when a background event occurs)
140 virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO);
141
142 // Is this the active frame (highlighted in the taskbar)?
143 virtual bool IsActive();
144
145 #ifdef __WXMAC__
146 %extend {
147 void MacSetMetalAppearance( bool on ) {
148 int style = self->GetExtraStyle();
149 if ( on )
150 style |= wxFRAME_EX_METAL;
151 else
152 style &= ~wxFRAME_EX_METAL;
153 self->SetExtraStyle(style);
154 }
155 }
156 bool MacGetMetalAppearance() const;
157 #else
158 %extend
159 {
160 // TODO: Should they raise not implemented or just NOP???
161 void MacSetMetalAppearance( bool on ) { /*wxPyRaiseNotImplemented();*/ }
162 bool MacGetMetalAppearance() const { /*wxPyRaiseNotImplemented();*/ return false; }
163 }
164 #endif
165
166 DocDeclStr(
167 void , CenterOnScreen(int dir = wxBOTH),
168 "Center the window on screen", "");
169 %pythoncode { CentreOnScreen = CenterOnScreen }
170
171 #ifdef __WXMSW__
172 bool EnableCloseButton(bool enable = true);
173 #else
174 %extend {
175 bool EnableCloseButton(bool enable = true) { return false; }
176 }
177 #endif
178
179 virtual bool SetTransparent(byte alpha);
180 virtual bool CanSetTransparent();
181
182
183
184 DocDeclStr(
185 virtual wxWindow *, GetDefaultItem() const,
186 "Get the default child of this parent, i.e. the one which is activated
187 by pressing <Enter> such as the OK button on a wx.Dialog.", "");
188
189 DocDeclStr(
190 virtual wxWindow *, SetDefaultItem(wxWindow * child),
191 "Set this child as default, return the old default.", "");
192
193 DocDeclStr(
194 virtual void , SetTmpDefaultItem(wxWindow * win),
195 "Set this child as temporary default", "");
196
197 DocDeclStr(
198 virtual wxWindow *, GetTmpDefaultItem() const,
199 "Return the temporary default item, which can be None.", "");
200
201 };
202
203
204 //---------------------------------------------------------------------------
205 %newgroup
206
207 // wxFrame is a top-level window with optional menubar, statusbar and toolbar
208 //
209 // For each of *bars, a frame may have several of them, but only one is
210 // managed by the frame, i.e. resized/moved when the frame is and whose size
211 // is accounted for in client size calculations - all others should be taken
212 // care of manually.
213
214 MustHaveApp(wxFrame);
215
216 class wxFrame : public wxTopLevelWindow
217 {
218 public:
219 %pythonAppend wxFrame "self._setOORInfo(self)"
220 %pythonAppend wxFrame() ""
221 %typemap(out) wxFrame*; // turn off this typemap
222
223 wxFrame(wxWindow* parent,
224 const wxWindowID id = -1,
225 const wxString& title = wxPyEmptyString,
226 const wxPoint& pos = wxDefaultPosition,
227 const wxSize& size = wxDefaultSize,
228 long style = wxDEFAULT_FRAME_STYLE,
229 const wxString& name = wxPyFrameNameStr);
230 %RenameCtor(PreFrame, wxFrame());
231
232 // Turn it back on again
233 %typemap(out) wxFrame* { $result = wxPyMake_wxObject($1, $owner); }
234
235 bool Create(wxWindow* parent,
236 const wxWindowID id = -1,
237 const wxString& title = wxPyEmptyString,
238 const wxPoint& pos = wxDefaultPosition,
239 const wxSize& size = wxDefaultSize,
240 long style = wxDEFAULT_FRAME_STYLE,
241 const wxString& name = wxPyFrameNameStr);
242
243 // frame state
244 // -----------
245
246 // get the origin of the client area (which may be different from (0, 0)
247 // if the frame has a toolbar) in client coordinates
248 virtual wxPoint GetClientAreaOrigin() const;
249
250 // sends a size event to the window using its current size:
251 // this has a side effect of refreshing the window layout
252 virtual void SendSizeEvent();
253
254 // menu bar functions
255 // ------------------
256
257 virtual void SetMenuBar(wxMenuBar *menubar);
258 virtual wxMenuBar *GetMenuBar() const;
259
260 // process menu command: returns True if processed
261 bool ProcessCommand(int winid);
262 %pythoncode { Command = ProcessCommand }
263
264 // status bar functions
265 // --------------------
266
267 // create the main status bar by calling OnCreateStatusBar()
268 virtual wxStatusBar* CreateStatusBar(int number = 1,
269 long style = wxDEFAULT_STATUSBAR_STYLE,
270 wxWindowID winid = 0,
271 const wxString& name = wxPyStatusLineNameStr);
272
273 // TODO: with directors?
274 // // return a new status bar
275 // virtual wxStatusBar *OnCreateStatusBar(int number,
276 // long style,
277 // wxWindowID winid,
278 // const wxString& name);
279
280 // get the main status bar
281 virtual wxStatusBar *GetStatusBar() const;
282
283 // sets the main status bar
284 void SetStatusBar(wxStatusBar *statBar);
285
286 // forward these to status bar
287 virtual void SetStatusText(const wxString &text, int number = 0);
288 virtual void SetStatusWidths(int widths, const int* widths_field); // uses typemap above
289 void PushStatusText(const wxString &text, int number = 0);
290 void PopStatusText(int number = 0);
291
292 // set the status bar pane the help will be shown in
293 void SetStatusBarPane(int n);
294 int GetStatusBarPane() const;
295
296 // toolbar functions
297 // -----------------
298
299 // create main toolbar bycalling OnCreateToolBar()
300 virtual wxToolBar* CreateToolBar(long style = -1,
301 wxWindowID winid = -1,
302 const wxString& name = wxPyToolBarNameStr);
303
304 // TODO: with directors?
305 // // return a new toolbar
306 // virtual wxToolBar *OnCreateToolBar(long style,
307 // wxWindowID winid,
308 // const wxString& name );
309
310 // get/set the main toolbar
311 virtual wxToolBar *GetToolBar() const;
312 virtual void SetToolBar(wxToolBar *toolbar);
313
314 // show help text (typically in the statusbar); show is False
315 // if you are hiding the help, True otherwise
316 virtual void DoGiveHelp(const wxString& text, bool show);
317
318 // send wxUpdateUIEvents for all menu items in the menubar,
319 // or just for menu if non-NULL
320 void DoMenuUpdates(wxMenu* menu = NULL);
321
322 static wxVisualAttributes
323 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
324 };
325
326 //---------------------------------------------------------------------------
327 %newgroup
328
329 MustHaveApp(wxDialog);
330
331 class wxDialog : public wxTopLevelWindow
332 {
333 public:
334 enum
335 {
336 // all flags allowed in wxDialogBase::CreateButtonSizer()
337 ButtonSizerFlags = wxOK | wxCANCEL | wxYES | wxNO | wxHELP | wxNO_DEFAULT
338 };
339
340 %pythonAppend wxDialog "self._setOORInfo(self)"
341 %pythonAppend wxDialog() ""
342 %typemap(out) wxDialog*; // turn off this typemap
343
344 wxDialog(wxWindow* parent,
345 const wxWindowID id = -1,
346 const wxString& title = wxPyEmptyString,
347 const wxPoint& pos = wxDefaultPosition,
348 const wxSize& size = wxDefaultSize,
349 long style = wxDEFAULT_DIALOG_STYLE,
350 const wxString& name = wxPyDialogNameStr);
351 %RenameCtor(PreDialog, wxDialog());
352
353 // Turn it back on again
354 %typemap(out) wxDialog* { $result = wxPyMake_wxObject($1, $owner); }
355
356 bool Create(wxWindow* parent,
357 const wxWindowID id = -1,
358 const wxString& title = wxPyEmptyString,
359 const wxPoint& pos = wxDefaultPosition,
360 const wxSize& size = wxDefaultSize,
361 long style = wxDEFAULT_DIALOG_STYLE,
362 const wxString& name = wxPyDialogNameStr);
363
364 // the modal dialogs have a return code - usually the ID of the last
365 // pressed button
366 void SetReturnCode(int returnCode);
367 int GetReturnCode() const;
368
369 // The identifier for the affirmative button
370 void SetAffirmativeId(int affirmativeId);
371 int GetAffirmativeId() const;
372
373 // Identifier for Esc key translation
374 void SetEscapeId(int escapeId);
375 int GetEscapeId() const;
376
377 // splits text up at newlines and places the
378 // lines into a vertical wxBoxSizer
379 wxSizer* CreateTextSizer( const wxString &message );
380
381 // places buttons into a horizontal wxBoxSizer
382 wxSizer* CreateButtonSizer( long flags,
383 bool separated = false,
384 wxCoord distance = 0 );
385 wxStdDialogButtonSizer* CreateStdDialogButtonSizer( long flags );
386
387 //void SetModal( bool flag );
388
389 // is the dialog in modal state right now?
390 virtual bool IsModal() const;
391
392 // Shows the dialog and starts a nested event loop that returns when
393 // EndModal is called.
394 virtual int ShowModal();
395
396 // may be called to terminate the dialog with the given return code
397 virtual void EndModal(int retCode);
398
399 static wxVisualAttributes
400 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
401 };
402
403 //---------------------------------------------------------------------------
404 %newgroup
405
406
407 MustHaveApp(wxMiniFrame);
408
409 class wxMiniFrame : public wxFrame
410 {
411 public:
412 %pythonAppend wxMiniFrame "self._setOORInfo(self)"
413 %pythonAppend wxMiniFrame() ""
414
415 wxMiniFrame(wxWindow* parent,
416 const wxWindowID id = -1,
417 const wxString& title = wxPyEmptyString,
418 const wxPoint& pos = wxDefaultPosition,
419 const wxSize& size = wxDefaultSize,
420 long style = wxDEFAULT_FRAME_STYLE,
421 const wxString& name = wxPyFrameNameStr);
422 %RenameCtor(PreMiniFrame, wxMiniFrame());
423
424 bool Create(wxWindow* parent,
425 const wxWindowID id = -1,
426 const wxString& title = wxPyEmptyString,
427 const wxPoint& pos = wxDefaultPosition,
428 const wxSize& size = wxDefaultSize,
429 long style = wxDEFAULT_FRAME_STYLE,
430 const wxString& name = wxPyFrameNameStr);
431 };
432
433
434 //---------------------------------------------------------------------------
435 %newgroup
436
437
438 enum
439 {
440 wxSPLASH_CENTRE_ON_PARENT,
441 wxSPLASH_CENTRE_ON_SCREEN,
442 wxSPLASH_NO_CENTRE,
443 wxSPLASH_TIMEOUT,
444 wxSPLASH_NO_TIMEOUT,
445 };
446
447
448 MustHaveApp(wxSplashScreenWindow);
449
450 class wxSplashScreenWindow: public wxWindow
451 {
452 public:
453 %pythonAppend wxSplashScreenWindow "self._setOORInfo(self)"
454
455 wxSplashScreenWindow(const wxBitmap& bitmap,
456 wxWindow* parent,
457 wxWindowID id,
458 const wxPoint& pos = wxDefaultPosition,
459 const wxSize& size = wxDefaultSize,
460 long style = wxNO_BORDER);
461
462 void SetBitmap(const wxBitmap& bitmap);
463 wxBitmap& GetBitmap();
464 };
465
466
467 MustHaveApp(wxSplashScreen);
468
469 class wxSplashScreen : public wxFrame
470 {
471 public:
472 %pythonAppend wxSplashScreen "self._setOORInfo(self)"
473
474 wxSplashScreen(const wxBitmap& bitmap,
475 long splashStyle, int milliseconds,
476 wxWindow* parent,
477 wxWindowID id = -1,
478 const wxPoint& pos = wxDefaultPosition,
479 const wxSize& size = wxDefaultSize,
480 long style = wxSIMPLE_BORDER | wxFRAME_NO_TASKBAR | wxSTAY_ON_TOP);
481
482 long GetSplashStyle() const;
483 wxSplashScreenWindow* GetSplashWindow() const;
484 int GetTimeout() const;
485 };
486
487
488 //---------------------------------------------------------------------------