X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8815349a371e4f86be67e95d52f98c768dd97902..a9a04486a2fc7be11a42343070ff8dd859618c46:/wxPython/src/_window.i diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i index 66932fa7cc..f90a6442b9 100644 --- a/wxPython/src/_window.i +++ b/wxPython/src/_window.i @@ -175,12 +175,12 @@ Extra Styles wx.WS_EX_PROCESS_IDLE This window should always process idle events, even if the mode set by - wx.IdleEvent.SetMode is + `wx.IdleEvent.SetMode` is wx.IDLE_PROCESS_SPECIFIED. wx.WS_EX_PROCESS_UI_UPDATES This window should always process UI update events, even if the mode - set by wxUpdateUIEvent::SetMode is + set by `wx.UpdateUIEvent.SetMode` is wxUPDATE_UI_PROCESS_SPECIFIED. ============================= ===================================== @@ -259,6 +259,7 @@ instead."); + %pythonAppend Destroy "args[0].thisown = 0" DocDeclStr( virtual bool , Destroy(), "Destroys the window safely. Frames and dialogs are not destroyed @@ -286,14 +287,13 @@ destructor.", ""); // window attributes // ----------------- - DocDeclStr( - virtual void , SetTitle( const wxString& title), - "Sets the window's title. Applicable only to frames and dialogs.", ""); - - DocDeclStr( - virtual wxString , GetTitle() const, - "Gets the window's title. Applicable only to frames and dialogs.", ""); + //DocDeclStr( + // virtual void , SetTitle( const wxString& title), + // "Sets the window's title. Applicable only to frames and dialogs.", ""); + //DocDeclStr( + // virtual wxString , GetTitle() const, + // "Gets the window's title. Applicable only to frames and dialogs.", ""); DocDeclStr( virtual void , SetLabel(const wxString& label), @@ -437,13 +437,13 @@ window's *best size* values. Also set's the minsize for use with sizers.", ""); DocDeclStr( virtual void , Raise(), - "Raises the window to the top of the window hierarchy if it is a -managed window (dialog or frame).", ""); + "Raises the window to the top of the window hierarchy. In current +version of wxWidgets this works both for manage and child windows.", ""); DocDeclStr( virtual void , Lower(), - "Lowers the window to the bottom of the window hierarchy if it is a -managed window (dialog or frame).", ""); + "Lowers the window to the bottom of the window hierarchy. In current +version of wxWidgets this works both for manage and child windows.", ""); @@ -460,14 +460,32 @@ around panel items, for example.", ""); DocStr(GetPosition, // sets the docstring for both - "Get the window's position.", ""); - wxPoint GetPosition(); + "Get the window's position. Notice that the position is in client +coordinates for child windows and screen coordinates for the top level +ones, use `GetScreenPosition` if you need screen coordinates for all +kinds of windows.", ""); + wxPoint GetPosition() const; DocDeclAName( - void, GetPosition(int *OUTPUT, int *OUTPUT), + void, GetPosition(int *OUTPUT, int *OUTPUT) const, "GetPositionTuple() -> (x,y)", GetPositionTuple); + + DocStr(GetScreenPosition, // sets the docstring for both + "Get the position of the window in screen coordinantes.", ""); + wxPoint GetScreenPosition() const; + DocDeclAName( + void, GetScreenPosition(int *OUTPUT, int *OUTPUT) const, + "GetScreenPositionTuple() -> (x,y)", + GetScreenPositionTuple); + + DocDeclStr( + wxRect , GetScreenRect() const, + "Returns the size and position of the window in screen coordinantes as +a `wx.Rect` object.", " +:see: `GetRect`, `GetScreenPosition`"); + DocStr(GetSize, "Get the window size.", ""); wxSize GetSize() const; @@ -480,7 +498,7 @@ around panel items, for example.", ""); DocDeclStr( wxRect , GetRect() const, - "Returns the size and position of the window as a wx.Rect object.", ""); + "Returns the size and position of the window as a `wx.Rect` object.", ""); DocStr(GetClientSize, @@ -527,6 +545,10 @@ after calling Fit.", ""); "Reset the cached best size value so it will be recalculated the next time it is needed.", ""); + DocDeclStr( + void , CacheBestSize(const wxSize& size) const, + "Cache the best size so it doesn't need to be calculated again, (at least until +some properties of the window change.)", ""); DocDeclStr( @@ -556,17 +578,10 @@ cetering, and may be wx.HORIZONTAL, wx.VERTICAL or wx.BOTH. It may also include wx.CENTER_ON_SCREEN flag if you want to center the window on the entire screen and not on its parent window. If it is a top-level window and has no parent then it will always be centered -relative to the screen.", ""); - +relative to the screen.", ""); %pythoncode { Centre = Center } - DocDeclStr( - void , CenterOnScreen(int dir = wxBOTH), - "Center on screen (only works for top level windows)", ""); - %pythoncode { CentreOnScreen = CenterOnScreen } - - DocDeclStr( void , CenterOnParent(int dir = wxBOTH), "Center with respect to the the parent window", ""); @@ -860,8 +875,13 @@ by pressing such as the OK button on a wx.Dialog.", ""); DocDeclStr( virtual void , SetTmpDefaultItem(wxWindow * win), "Set this child as temporary default", ""); + + DocDeclStr( + virtual wxWindow *, GetTmpDefaultItem() const, + "Return the temporary default item, which can be None.", ""); + DocDeclAStr( virtual bool , Navigate(int flags = wxNavigationKeyEvent::IsForward), "Navigate(self, int flags=NavigationKeyEvent.IsForward) -> bool", @@ -965,9 +985,18 @@ functions so should not be required by the application programmer.", ""); "Removes a child window. This is called automatically by window deletion functions so should not be required by the application programmer.", ""); - + DocStr(SetDoubleBuffered, + "Currently wxGTK2 only.", ""); +#ifdef __WXGTK__ + void SetDoubleBuffered(bool on); +#else + %extend { + void SetDoubleBuffered(bool on) {} + } +#endif + // looking for windows // ------------------- @@ -1363,6 +1392,15 @@ not be used at all.", ""); foreground colour is dependent on the window class; it may be the text colour or other colour, or it may not be used at all.", ""); + DocDeclStr( + bool , InheritsBackgroundColour() const, + "", ""); + + DocDeclStr( + bool , UseBgCol() const, + "", ""); + + // TODO: // // if the window shouldn't inherit its colour from the parent, override // // this function to return true @@ -1442,9 +1480,11 @@ be reset back to default.", ""); + %disownarg( wxCaret *caret ); DocDeclStr( void , SetCaret(wxCaret *caret), "Sets the caret associated with the window.", ""); + %cleardisown( wxCaret *caret ); DocDeclStr( wxCaret *, GetCaret() const, @@ -1546,7 +1586,7 @@ send an update UI event for each menubar menu item. You can call this function from your application to ensure that your UI is up-to-date at a particular point in time (as far as your EVT_UPDATE_UI handlers are concerned). This may be necessary if you have called -wx.UpdateUIEvent.SetMode or wx.UpdateUIEvent.SetUpdateInterval to +`wx.UpdateUIEvent.SetMode` or `wx.UpdateUIEvent.SetUpdateInterval` to limit the overhead that wxWindows incurs by sending update UI events in idle time.", " @@ -1677,8 +1717,8 @@ toplevel parent of the window.", ""); "Physically scrolls the pixels in the window and move child windows accordingly. Use this function to optimise your scrolling implementations, to minimise the area that must be redrawn. Note that -it is rarely required to call this function from a user program.", -" +it is rarely required to call this function from a user program."," + :param dx: Amount to scroll horizontally. :param dy: Amount to scroll vertically. @@ -1731,7 +1771,7 @@ already on top/bottom and nothing was done.", ""); void , SetHelpText(const wxString& text), "Sets the help text to be used as context-sensitive help for this window. Note that the text is actually stored by the current -wxHelpProvider implementation, and not in the window object itself.", ""); +`wx.HelpProvider` implementation, and not in the window object itself.", ""); DocDeclStr( @@ -1741,10 +1781,20 @@ one.", ""); DocDeclStr( + virtual wxString , GetHelpTextAtPoint(const wxPoint& pt, + wxHelpEvent::Origin origin) const, + "Get the help string associated with the given position in this window. + +Notice that pt may be invalid if event origin is keyboard or unknown +and this method should return the global window help text then +", ""); + + + DocDeclStr( wxString , GetHelpText() const, "Gets the help text to be used as context-sensitive help for this window. Note that the text is actually stored by the current -wxHelpProvider implementation, and not in the window object itself.", ""); +`wx.HelpProvider` implementation, and not in the window object itself.", ""); @@ -1755,7 +1805,10 @@ wxHelpProvider implementation, and not in the window object itself.", ""); DocStr(SetToolTip, "Attach a tooltip to the window.", ""); %Rename(SetToolTipString, void, SetToolTip( const wxString &tip )); + + %disownarg( wxToolTip *tip ); void SetToolTip( wxToolTip *tip ); + %cleardisown( wxToolTip *tip ); DocDeclStr( wxToolTip* , GetToolTip() const, @@ -1770,16 +1823,12 @@ wxHelpProvider implementation, and not in the window object itself.", ""); // drag and drop // ------------- - // set/retrieve the drop target associated with this window (may be - // NULL; it's owned by the window and will be deleted by it) - %apply SWIGTYPE *DISOWN { wxPyDropTarget *dropTarget }; - + %disownarg( wxPyDropTarget *dropTarget ); DocDeclStr( virtual void , SetDropTarget( wxPyDropTarget *dropTarget ), "Associates a drop target with this window. If the window already has a drop target, it is deleted.", ""); - - %clear wxPyDropTarget *dropTarget; + %cleardisown( wxPyDropTarget *dropTarget ); DocDeclStr( @@ -1787,11 +1836,15 @@ a drop target, it is deleted.", ""); "Returns the associated drop target, which may be None.", ""); -#ifdef __WXMSW__ // TODO: should I drop-kick this? - DocDeclStr( - void , DragAcceptFiles(bool accept), + DocStr(DragAcceptFiles, "Enables or disables eligibility for drop file events, EVT_DROP_FILES. -Only available on Windows.", ""); +Only functional on Windows.", ""); +#ifdef __WXMSW__ + void DragAcceptFiles(bool accept); +#else + %extend { + void DragAcceptFiles(bool accept) {} + } #endif #endif @@ -1799,7 +1852,7 @@ Only available on Windows.", ""); // constraints and sizers // ---------------------- - // set the constraints for this window or retrieve them (may be NULL) + %disownarg(wxLayoutConstraints*); DocDeclStr( void , SetConstraints( wxLayoutConstraints *constraints ), "Sets the window to have the given layout constraints. If an existing @@ -1817,14 +1870,19 @@ effect.", ""); wxLayoutConstraints *, GetConstraints() const, "Returns a pointer to the window's layout constraints, or None if there are none.", ""); + %cleardisown(wxLayoutConstraints*); DocDeclStr( void , SetAutoLayout( bool autoLayout ), "Determines whether the Layout function will be called automatically -when the window is resized. It is called implicitly by SetSizer but -if you use SetConstraints you should call it manually or otherwise the -window layout won't be correctly updated when its size changes.", ""); +when the window is resized. lease note that this only happens for the +windows usually used to contain children, namely `wx.Panel` and +`wx.TopLevelWindow` (and the classes deriving from them). + +This method is called implicitly by `SetSizer` but if you use +`SetConstraints` you should call it manually or otherwise the window +layout won't be correctly updated when its size changes.", ""); DocDeclStr( bool , GetAutoLayout() const, @@ -1839,6 +1897,7 @@ this function gets called automatically by the default EVT_SIZE handler when the window is resized.", ""); + %disownarg( wxSizer *sizer ); DocDeclStr( void , SetSizer(wxSizer *sizer, bool deleteOld = true ), "Sets the window to have the given layout sizer. The window will then @@ -1852,7 +1911,8 @@ non-None, and False otherwise.", ""); void , SetSizerAndFit( wxSizer *sizer, bool deleteOld = true ), "The same as SetSizer, except it also sets the size hints for the window based on the sizer's minimum size.", ""); - + %cleardisown( wxSizer *sizer ); + DocDeclStr( wxSizer *, GetSizer() const, @@ -1947,6 +2007,11 @@ wxControl where it returns true.", ""); if hasattr(self, '_setCallbackInfo'): self._setCallbackInfo(self, self.__class__) } + + %pythoncode { + def SendSizeEvent(self): + self.GetEventHandler().ProcessEvent(wx.SizeEvent((-1,-1))) + } }; @@ -2044,7 +2109,8 @@ wxWindow* wxFindWindowByLabel( const wxString& label, WXHWND hWnd = (WXHWND)_hWnd; long id = wxGetWindowId(hWnd); wxWindow* win = new wxWindow; - parent->AddChild(win); + if (parent) + parent->AddChild(win); win->SetEventHandler(win); win->SetHWND(hWnd); win->SetId(id); @@ -2059,6 +2125,20 @@ wxWindow* wxFindWindowByLabel( const wxString& label, } %} +//--------------------------------------------------------------------------- + +DocStr(GetTopLevelWindows, +"Returns a list of the the application's top-level windows, (frames, +dialogs, etc.) NOTE: Currently this is a copy of the list maintained +by wxWidgets, and so it is only valid as long as no top-level windows +are closed or new top-level windows are created. +", ""); +%inline %{ + PyObject* GetTopLevelWindows() { + return wxPy_ConvertList(&wxTopLevelWindows); + } +%} + //--------------------------------------------------------------------------- //---------------------------------------------------------------------------