]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_window.i
Corrected parameter names
[wxWidgets.git] / wxPython / src / _window.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _window.i
3 // Purpose: SWIG interface for wxWindow
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 24-June-1997
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 %}
20
21 MAKE_CONST_WXSTRING(PanelNameStr);
22
23 //---------------------------------------------------------------------------
24 %newgroup
25
26 class wxWindow : public wxEvtHandler
27 {
28 public:
29 %pythonAppend wxWindow "self._setOORInfo(self)"
30 %pythonAppend wxWindow() ""
31
32 wxWindow(wxWindow* parent, const wxWindowID id,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = 0,
36 const wxString& name = wxPyPanelNameStr);
37 %name(PreWindow)wxWindow();
38
39 bool Create(wxWindow* parent, const wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxString& name = wxPyPanelNameStr);
44
45
46
47 // deleting the window
48 // -------------------
49
50 // ask the window to close itself, return True if the event handler
51 // honoured our request
52 bool Close( bool force = False );
53
54 // delete window unconditionally (dangerous!), returns True if ok
55 virtual bool Destroy();
56
57 // delete all children of this window, returns True if ok
58 bool DestroyChildren();
59
60 // is the window being deleted?
61 bool IsBeingDeleted() const;
62
63
64 // window attributes
65 // -----------------
66
67 // the text which the window shows in the title if applicable
68 virtual void SetTitle( const wxString& WXUNUSED(title) );
69 virtual wxString GetTitle() const;
70
71 // the text which the window shows in its label if applicable
72 virtual void SetLabel(const wxString& label);
73 virtual wxString GetLabel() const;
74
75 // the window name is used for ressource setting in X, it is not the
76 // same as the window title/label
77 virtual void SetName( const wxString &name );
78 virtual wxString GetName() const;
79
80 // window id uniquely identifies the window among its siblings unless
81 // it is -1 which means "don't care"
82 void SetId( wxWindowID winid );
83 wxWindowID GetId() const;
84
85 // generate a control id for the controls which were not given one by
86 // user
87 static int NewControlId();
88
89 // get the id of the control following the one with the given
90 // (autogenerated) id
91 static int NextControlId(int winid);
92
93 // get the id of the control preceding the one with the given
94 // (autogenerated) id
95 static int PrevControlId(int winid);
96
97
98
99 // moving/resizing
100 // ---------------
101
102 // set the window size
103 void SetSize( const wxSize& size );
104
105 // set the window size and position
106 %name(SetDimensions) void SetSize( int x, int y, int width, int height,
107 int sizeFlags = wxSIZE_AUTO );
108
109 // set the window size and position with a wxRect
110 %name(SetRect) void SetSize(const wxRect& rect, int sizeFlags = wxSIZE_AUTO);
111
112 // set window size
113 %name(SetSizeWH)void SetSize( int width, int height );
114
115 // set window position
116 void Move(const wxPoint& pt, int flags = wxSIZE_USE_EXISTING);
117 %pythoncode { SetPosition = Move }
118
119 // set window position
120 %name(MoveXY) void Move(int x, int y, int flags = wxSIZE_USE_EXISTING);
121
122 // Z-order
123 virtual void Raise();
124 virtual void Lower();
125
126 // client size is the size of the area available for subwindows
127 void SetClientSize( const wxSize& size );
128 %name(SetClientSizeWH) void SetClientSize( int width, int height );
129 %name(SetClientRect) void SetClientSize(const wxRect& rect);
130
131
132 DocStr(GetPosition, // sets the docstring for both
133 "Get the window's position.");
134 wxPoint GetPosition();
135
136 DocDeclAName(
137 void, GetPosition(int *OUTPUT, int *OUTPUT),
138 "GetPositionTuple() -> (x,y)",
139 GetPositionTuple);
140
141
142 DocStr(GetSize, "Get the window size.");
143 wxSize GetSize() const;
144 DocDeclAName(
145 void, GetSize( int *OUTPUT, int *OUTPUT ) const,
146 "GetSizeTuple() -> (width, height)",
147 GetSizeTuple);
148
149
150 // get the window position and size
151 wxRect GetRect() const;
152
153 DocStr(GetClientSize, "Get the window's client size.");
154 wxSize GetClientSize() const;
155 DocDeclAName(
156 void, GetClientSize( int *OUTPUT, int *OUTPUT ) const,
157 "GetClientSizeTuple() -> (width, height)",
158 GetClientSizeTuple);
159
160
161 // get the origin of the client area of the window relative to the
162 // window top left corner (the client area may be shifted because of
163 // the borders, scrollbars, other decorations...)
164 virtual wxPoint GetClientAreaOrigin() const;
165
166 // get the client rectangle in window (i.e. client) coordinates
167 wxRect GetClientRect() const;
168
169 DocStr(GetBestSize,
170 "Get the size best suited for the window (in fact, minimal acceptable size\n"
171 "using which it will still look \"nice\")");
172 wxSize GetBestSize() const;
173 DocDeclAName(
174 void, GetBestSize(int *OUTPUT, int *OUTPUT) const,
175 "GetBestSizeTuple() -> (width, height)",
176 GetBestSizeTuple);
177
178
179 // There are times (and windows) where 'Best' size and 'Min' size
180 // are vastly out of sync. This should be remedied somehow, but in
181 // the meantime, this method will return the larger of BestSize
182 // (the window's smallest legible size), and any user specified
183 // MinSize hint.
184 wxSize GetAdjustedBestSize() const;
185
186
187 // the generic center function - centers the window on parent by
188 // default or on screen if it doesn't have parent or
189 // wxCENTER_ON_SCREEN flag is given
190 void Center( int direction = wxBOTH );
191 %pythoncode { Centre = Center }
192
193 // center on screen (only works for top level windows)
194 void CenterOnScreen(int dir = wxBOTH);
195 %pythoncode { CentreOnScreen = CenterOnScreen }
196
197 // center with respect to the the parent window
198 void CenterOnParent(int dir = wxBOTH);
199 %pythoncode { CentreOnParent = CenterOnParent }
200
201
202 // set window size to wrap around its children
203 virtual void Fit();
204
205 // set virtual size to satisfy children
206 virtual void FitInside();
207
208 // set min/max size of the window
209 virtual void SetSizeHints( int minW, int minH,
210 int maxW = -1, int maxH = -1,
211 int incW = -1, int incH = -1 );
212
213 virtual void SetVirtualSizeHints( int minW, int minH,
214 int maxW = -1, int maxH = -1 );
215
216 virtual int GetMinWidth() const;
217 virtual int GetMinHeight() const;
218 int GetMaxWidth() const;
219 int GetMaxHeight() const;
220
221
222 // Override this method to control the values given to Sizers etc.
223 virtual wxSize GetMaxSize() const;
224
225
226 DocStr(SetVirtualSize,
227 "Set the the virtual size of a window. For most windows this is just the\n"
228 "client area of the window, but for some like scrolled windows it is more or\n"
229 "less independent of the screen window size.");
230 void SetVirtualSize(const wxSize& size );
231 %name(SetVirtualSizeWH) void SetVirtualSize( int w, int h );
232
233
234 DocStr(GetVirtualSize,
235 "Get the the virtual size of the window. For most windows this is just\n"
236 "the client area of the window, but for some like scrolled windows it is\n"
237 "more or less independent of the screen window size.");
238 wxSize GetVirtualSize() const;
239 DocDeclAName(
240 void, GetVirtualSize( int *OUTPUT, int *OUTPUT ) const,
241 "GetVirtualSizeTuple() -> (width, height)",
242 GetVirtualSizeTuple);
243
244
245 // TODO: using directors?
246 // // Override these methods for windows that have a virtual size
247 // // independent of their client size. eg. the virtual area of a
248 // // wxScrolledWindow. Default is to alias VirtualSize to ClientSize.
249 // virtual void DoSetVirtualSize( int x, int y );
250 // virtual wxSize DoGetVirtualSize() const; // { return m_virtualSize; }
251
252
253 // Return the largest of ClientSize and BestSize (as determined
254 // by a sizer, interior children, or other means)
255 virtual wxSize GetBestVirtualSize() const;
256
257
258
259 // window state
260 // ------------
261
262 // returns True if window was shown/hidden, False if the nothing was
263 // done (window was already shown/hidden)
264 virtual bool Show( bool show = True );
265 bool Hide();
266
267 // returns True if window was enabled/disabled, False if nothing done
268 virtual bool Enable( bool enable = True );
269 bool Disable();
270
271 bool IsShown() const;
272 bool IsEnabled() const;
273
274 // get/set window style (setting style won't update the window and so
275 // is only useful for internal usage)
276 virtual void SetWindowStyleFlag( long style );
277 virtual long GetWindowStyleFlag() const;
278
279 // get/set window style (setting style won't update the window and so
280 // is only useful for internal usage)
281 void SetWindowStyle( long style );
282 long GetWindowStyle() const;
283
284 bool HasFlag(int flag) const;
285 virtual bool IsRetained() const;
286
287 // extra style: the less often used style bits which can't be set with
288 // SetWindowStyleFlag()
289 virtual void SetExtraStyle(long exStyle);
290 long GetExtraStyle() const;
291
292 // make the window modal (all other windows unresponsive)
293 virtual void MakeModal(bool modal = True);
294
295 virtual void SetThemeEnabled(bool enableTheme);
296 virtual bool GetThemeEnabled() const;
297
298 // controls by default inherit the colours of their parents, if a
299 // particular control class doesn't want to do it, it can override
300 // ShouldInheritColours() to return False
301 virtual bool ShouldInheritColours() const;
302
303
304 // focus and keyboard handling
305 // ---------------------------
306
307 // set focus to this window
308 virtual void SetFocus();
309
310 // set focus to this window as the result of a keyboard action
311 virtual void SetFocusFromKbd();
312
313 // return the window which currently has the focus or NULL
314 static wxWindow *FindFocus();
315
316 // can this window have focus?
317 virtual bool AcceptsFocus() const;
318
319 // can this window be given focus by keyboard navigation? if not, the
320 // only way to give it focus (provided it accepts it at all) is to
321 // click it
322 virtual bool AcceptsFocusFromKeyboard() const;
323
324 // get the default child of this parent, i.e. the one which is
325 // activated by pressing <Enter>
326 virtual wxWindow *GetDefaultItem() const;
327
328 // set this child as default, return the old default
329 virtual wxWindow *SetDefaultItem(wxWindow * WXUNUSED(child));
330
331 // set this child as temporary default
332 virtual void SetTmpDefaultItem(wxWindow * WXUNUSED(win));
333
334
335
336 // parent/children relations
337 // -------------------------
338
339 // get the list of children
340 //wxWindowList& GetChildren(); // TODO: Do a typemap or a wrapper for wxWindowList
341 %extend {
342 PyObject* GetChildren() {
343 wxWindowList& list = self->GetChildren();
344 return wxPy_ConvertList(&list);
345 }
346 }
347
348 // get the parent or the parent of the parent
349 wxWindow *GetParent() const;
350 wxWindow *GetGrandParent() const;
351
352 // is this window a top level one?
353 virtual bool IsTopLevel() const;
354
355 // change the real parent of this window, return True if the parent
356 // was changed, False otherwise (error or newParent == oldParent)
357 virtual bool Reparent( wxWindow *newParent );
358
359 // implementation mostly
360 virtual void AddChild( wxWindow *child );
361 virtual void RemoveChild( wxWindow *child );
362
363
364
365 // looking for windows
366 // -------------------
367
368 // find window among the descendants of this one either by id or by
369 // name (return NULL if not found)
370 %name(FindWindowById) wxWindow *FindWindow( long winid );
371 %name(FindWindowByName) wxWindow *FindWindow( const wxString& name );
372
373
374 // event handler stuff
375 // -------------------
376
377 // get the current event handler
378 wxEvtHandler *GetEventHandler() const;
379
380 // replace the event handler (allows to completely subclass the
381 // window)
382 void SetEventHandler( wxEvtHandler *handler );
383
384 // push/pop event handler: allows to chain a custom event handler to
385 // alreasy existing ones
386 void PushEventHandler( wxEvtHandler *handler );
387 wxEvtHandler *PopEventHandler( bool deleteHandler = False );
388
389 // find the given handler in the event handler chain and remove (but
390 // not delete) it from the event handler chain, return True if it was
391 // found and False otherwise (this also results in an assert failure so
392 // this function should only be called when the handler is supposed to
393 // be there)
394 bool RemoveEventHandler(wxEvtHandler *handler);
395
396
397
398 // validators
399 // ----------
400
401 // a window may have an associated validator which is used to control
402 // user input
403 virtual void SetValidator( const wxValidator &validator );
404 virtual wxValidator *GetValidator();
405
406
407 // accelerators
408 // ------------
409
410 virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
411 wxAcceleratorTable *GetAcceleratorTable();
412
413
414
415
416 // hot keys (system wide accelerators)
417 // -----------------------------------
418 %extend {
419 // hot keys (system wide accelerators)
420 bool RegisterHotKey(int hotkeyId, int modifiers, int keycode) {
421 #if wxUSE_HOTKEY
422 return self->RegisterHotKey(hotkeyId, modifiers, keycode);
423 #else
424 return False;
425 #endif
426 }
427
428 bool UnregisterHotKey(int hotkeyId) {
429 #if wxUSE_HOTKEY
430 return self->UnregisterHotKey(hotkeyId);
431 #else
432 return False;
433 #endif
434 }
435 }
436
437
438
439 // "dialog units" translations
440 // ---------------------------
441
442 %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt);
443 %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz);
444
445 %name(DLG_PNT) wxPoint ConvertDialogToPixels(const wxPoint& pt);
446 %name(DLG_SZE) wxSize ConvertDialogToPixels(const wxSize& sz);
447
448 %name(ConvertPixelPointToDialog) wxPoint ConvertPixelsToDialog(const wxPoint& pt);
449 %name(ConvertPixelSizeToDialog) wxSize ConvertPixelsToDialog(const wxSize& sz);
450
451
452
453 // mouse functions
454 // ---------------
455
456 // move the mouse to the specified position
457 virtual void WarpPointer(int x, int y);
458
459 // start or end mouse capture, these functions maintain the stack of
460 // windows having captured the mouse and after calling ReleaseMouse()
461 // the mouse is not released but returns to the window which had had
462 // captured it previously (if any)
463 void CaptureMouse();
464 void ReleaseMouse();
465
466 // get the window which currently captures the mouse or NULL
467 static wxWindow *GetCapture();
468
469 // does this window have the capture?
470 virtual bool HasCapture() const;
471
472
473
474 // painting the window
475 // -------------------
476
477 // mark the specified rectangle (or the whole window) as "dirty" so it
478 // will be repainted
479 virtual void Refresh( bool eraseBackground = True,
480 const wxRect *rect = NULL );
481
482 // a less awkward wrapper for Refresh
483 void RefreshRect(const wxRect& rect);
484
485 // repaint all invalid areas of the window immediately
486 virtual void Update();
487
488 // clear the window background
489 virtual void ClearBackground();
490
491 // freeze the window: don't redraw it until it is thawed
492 virtual void Freeze();
493
494 // thaw the window: redraw it after it had been frozen
495 virtual void Thaw();
496
497 // adjust DC for drawing on this window
498 virtual void PrepareDC( wxDC & WXUNUSED(dc) );
499
500 // the update region of the window contains the areas which must be
501 // repainted by the program
502 wxRegion& GetUpdateRegion();
503
504 // get the update rectangle region bounding box in client coords
505 wxRect GetUpdateClientRect() const;
506
507 // these functions verify whether the given point/rectangle belongs to
508 // (or at least intersects with) the update region
509 bool IsExposed( int x, int y, int w=1, int h=1 ) const;
510 %name(IsExposedPoint) bool IsExposed( const wxPoint& pt ) const;
511 %name(isExposedRect) bool IsExposed( const wxRect& rect ) const;
512
513
514
515 // colours, fonts and cursors
516 // --------------------------
517
518 // set/retrieve the window colours (system defaults are used by
519 // default): Set functions return True if colour was changed
520 virtual bool SetBackgroundColour( const wxColour &colour );
521 virtual bool SetForegroundColour( const wxColour &colour );
522
523 wxColour GetBackgroundColour() const;
524 wxColour GetForegroundColour() const;
525
526 // set/retrieve the cursor for this window (SetCursor() returns True
527 // if the cursor was really changed)
528 virtual bool SetCursor( const wxCursor &cursor );
529 wxCursor& GetCursor();
530
531 // set/retrieve the font for the window (SetFont() returns True if the
532 // font really changed)
533 virtual bool SetFont( const wxFont &font );
534 wxFont& GetFont();
535
536 // associate a caret with the window
537 void SetCaret(wxCaret *caret);
538
539 // get the current caret (may be NULL)
540 wxCaret *GetCaret() const;
541
542 // get the (average) character size for the current font
543 virtual int GetCharHeight() const;
544 virtual int GetCharWidth() const;
545
546
547 DocDeclAStr(
548 void, GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT),
549 "GetTextExtent(String string) -> (width, height)",
550 "Get the width and height of the text using the current font.");
551 DocDeclAStrName(
552 void, GetTextExtent(const wxString& string,
553 int *OUTPUT, int *OUTPUT, int *OUTPUT, int* OUTPUT,
554 const wxFont* font = NULL),
555 "GetFullTextExtent(String string, Font font=None) ->\n (width, height, descent, externalLeading)",
556 "Get the width, height, decent and leading of the text using the current or specified font.",
557 GetFullTextExtent);
558
559
560
561 // client <-> screen coords
562 // ------------------------
563
564 %apply int * INOUT { int* x, int* y };
565
566 // translate to/from screen/client coordinates
567 %name(ClientToScreenXY) void ClientToScreen( int *x, int *y ) const;
568 %name(ScreenToClientXY) void ScreenToClient( int *x, int *y ) const;
569
570 wxPoint ClientToScreen(const wxPoint& pt) const;
571 wxPoint ScreenToClient(const wxPoint& pt) const;
572
573 // test where the given (in client coords) point lies
574 %name(HitTestXY) wxHitTest HitTest(wxCoord x, wxCoord y) const;
575 wxHitTest HitTest(const wxPoint& pt) const;
576
577
578
579 // misc
580 // ----
581
582 // get the window border style from the given flags: this is different from
583 // simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to
584 // translate wxBORDER_DEFAULT to something reasonable
585 %name(GetBorderFlags) wxBorder GetBorder(long flags) const;
586
587 // get border for the flags of this window
588 wxBorder GetBorder() const { return GetBorder(GetWindowStyleFlag()); }
589
590 // send wxUpdateUIEvents to this window, and children if recurse is True
591 virtual void UpdateWindowUI(long flags = wxUPDATE_UI_NONE);
592
593 // TODO: using directors?
594 // // do the window-specific processing after processing the update event
595 // virtual void DoUpdateWindowUI(wxUpdateUIEvent& event) ;
596
597 %name(PopupMenuXY) bool PopupMenu(wxMenu *menu, int x, int y);
598 bool PopupMenu(wxMenu *menu, const wxPoint& pos);
599
600 %extend {
601 long GetHandle() {
602 return wxPyGetWinHandle(self);
603 }
604 }
605
606
607 #ifdef __WXMSW__
608 // A way to do the native draw first... Too bad it isn't in wxGTK too.
609 void OnPaint(wxPaintEvent& event);
610 #endif
611
612
613
614 // scrollbars
615 // ----------
616
617 // does the window have the scrollbar for this orientation?
618 bool HasScrollbar(int orient) const;
619
620 // configure the window scrollbars
621 virtual void SetScrollbar( int orient,
622 int pos,
623 int thumbvisible,
624 int range,
625 bool refresh = True );
626 virtual void SetScrollPos( int orient, int pos, bool refresh = True );
627 virtual int GetScrollPos( int orient ) const;
628 virtual int GetScrollThumb( int orient ) const;
629 virtual int GetScrollRange( int orient ) const;
630
631 // scroll window to the specified position
632 virtual void ScrollWindow( int dx, int dy,
633 const wxRect* rect = NULL );
634
635 // scrolls window by line/page: note that not all controls support this
636 //
637 // return True if the position changed, False otherwise
638 virtual bool ScrollLines(int WXUNUSED(lines));
639 virtual bool ScrollPages(int WXUNUSED(pages));
640
641 // convenient wrappers for ScrollLines/Pages
642 bool LineUp();
643 bool LineDown();
644 bool PageUp();
645 bool PageDown();
646
647
648
649 // context-sensitive help
650 // ----------------------
651
652 // associate this help text with this window
653 void SetHelpText(const wxString& text);
654
655 // associate this help text with all windows with the same id as this
656 // one
657 void SetHelpTextForId(const wxString& text);
658
659 // get the help string associated with this window (may be empty)
660 wxString GetHelpText() const;
661
662
663 #ifndef __WXX11__
664 // tooltips
665 // --------
666
667 // the easiest way to set a tooltip for a window is to use this method
668 %name(SetToolTipString) void SetToolTip( const wxString &tip );
669
670 // attach a tooltip to the window
671 void SetToolTip( wxToolTip *tip );
672
673 // get the associated tooltip or NULL if none
674 wxToolTip* GetToolTip() const;
675 // LINK ERROR --> wxString GetToolTipText() const;
676 #endif
677
678
679
680 #ifndef __WXX11__
681 // drag and drop
682 // -------------
683
684 // set/retrieve the drop target associated with this window (may be
685 // NULL; it's owned by the window and will be deleted by it)
686 %apply SWIGTYPE *DISOWN { wxPyDropTarget *dropTarget };
687 virtual void SetDropTarget( wxPyDropTarget *dropTarget );
688 %clear wxPyDropTarget *dropTarget;
689
690 virtual wxPyDropTarget *GetDropTarget() const;
691
692 #ifdef __WXMSW__ // TODO: should I drop-kick this?
693 void DragAcceptFiles(bool accept);
694 #endif
695 #endif
696
697
698 // constraints and sizers
699 // ----------------------
700
701 // set the constraints for this window or retrieve them (may be NULL)
702 void SetConstraints( wxLayoutConstraints *constraints );
703 wxLayoutConstraints *GetConstraints() const;
704
705 // when using constraints or sizers, it makes sense to update
706 // children positions automatically whenever the window is resized
707 // - this is done if autoLayout is on
708 void SetAutoLayout( bool autoLayout );
709 bool GetAutoLayout() const;
710
711 // lay out the window and its children
712 virtual bool Layout();
713
714 // sizers
715 void SetSizer(wxSizer *sizer, bool deleteOld = True );
716 void SetSizerAndFit( wxSizer *sizer, bool deleteOld = True );
717
718 wxSizer *GetSizer() const;
719
720 // Track if this window is a member of a sizer
721 void SetContainingSizer(wxSizer* sizer);
722 wxSizer *GetContainingSizer() const;
723
724
725
726 // accessibility
727 // ----------------------
728 #if wxUSE_ACCESSIBILITY
729 // Override to create a specific accessible object.
730 virtual wxAccessible* CreateAccessible();
731
732 // Sets the accessible object.
733 void SetAccessible(wxAccessible* accessible) ;
734
735 // Returns the accessible object.
736 wxAccessible* GetAccessible() { return m_accessible; };
737
738 // Returns the accessible object, creating if necessary.
739 wxAccessible* GetOrCreateAccessible() ;
740 #endif
741
742
743
744 %pythoncode {
745 def PostCreate(self, pre):
746 """Phase 3 of the 2-phase create <wink!>
747 Call this method after precreating the window with the 2-phase create method."""
748 self.this = pre.this
749 self.thisown = pre.thisown
750 pre.thisown = 0
751 if hasattr(self, '_setOORInfo'):
752 self._setOORInfo(self)
753 if hasattr(self, '_setCallbackInfo'):
754 self._setCallbackInfo(self, self.__class__)
755 }
756 };
757
758
759
760
761
762
763
764
765 %pythoncode {
766 def DLG_PNT(win, point_or_x, y=None):
767 if y is None:
768 return win.ConvertDialogPointToPixels(point_or_x)
769 else:
770 return win.ConvertDialogPointToPixels(wx.Point(point_or_x, y))
771
772 def DLG_SZE(win, size_width, height=None):
773 if height is None:
774 return win.ConvertDialogSizeToPixels(size_width)
775 else:
776 return win.ConvertDialogSizeToPixels(wx.Size(size_width, height))
777 }
778
779
780
781
782 // Unfortunatly the names of these new static methods clash with the
783 // names wxPython has been using forever for the overloaded
784 // wxWindow::FindWindow, so instead of swigging them as statics create
785 // standalone functions for them.
786
787
788 // Find a window among any window in the application (all return NULL if not found)
789 %inline %{
790 wxWindow* wxFindWindowById( long id, const wxWindow *parent = NULL ) {
791 return wxWindow::FindWindowById(id, parent);
792 }
793
794 wxWindow* wxFindWindowByName( const wxString& name,
795 const wxWindow *parent = NULL ) {
796 return wxWindow::FindWindowByName(name, parent);
797 }
798
799 wxWindow* wxFindWindowByLabel( const wxString& label,
800 const wxWindow *parent = NULL ) {
801 return wxWindow::FindWindowByLabel(label, parent);
802 }
803 %}
804
805
806
807 %inline %{
808 wxWindow* wxWindow_FromHWND(unsigned long hWnd) {
809 #ifdef __WXMSW__
810 wxWindow* win = new wxWindow;
811 win->SetHWND(hWnd);
812 win->SubclassWin(hWnd);
813 return win;
814 #else
815 wxPyRaiseNotImplemented();
816 return NULL;
817 #endif
818 }
819 %}
820
821 //---------------------------------------------------------------------------
822 //---------------------------------------------------------------------------
823