+ %pythonAppend Destroy "args[0].thisown = 0"
DocDeclStr(
virtual bool , Destroy(),
"Destroys the window safely. Frames and dialogs are not destroyed
// 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),
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.", "");
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;
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,
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", "");
-
- DocDeclStr(
- virtual wxWindow *, GetDefaultItem() const,
- "Get the default child of this parent, i.e. the one which is activated
-by pressing <Enter> such as the OK button on a wx.Dialog.", "");
-
- DocDeclStr(
- virtual wxWindow *, SetDefaultItem(wxWindow * child),
- "Set this child as default, return the old default.", "");
-
- DocDeclStr(
- virtual void , SetTmpDefaultItem(wxWindow * win),
- "Set this child as temporary default", "");
-
DocDeclAStr(
virtual bool , Navigate(int flags = wxNavigationKeyEvent::IsForward),
"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
// -------------------
mouse and when the mouse is released the capture returns to the window
which had had captured it previously and it is only really released if
there were no previous window. In particular, this means that you must
-release the mouse as many times as you capture it.", "");
+release the mouse as many times as you capture it, unless the window
+receives the `wx.MouseCaptureLostEvent` event.
+
+Any application which captures the mouse in the beginning of some
+operation *must* handle `wx.MouseCaptureLostEvent` and cancel this
+operation when it receives the event. The event handler must not
+recapture mouse.", "");
DocDeclStr(
void , ReleaseMouse(),
+ %disownarg( wxCaret *caret );
DocDeclStr(
void , SetCaret(wxCaret *caret),
"Sets the caret associated with the window.", "");
+ %cleardisown( wxCaret *caret );
DocDeclStr(
wxCaret *, GetCaret() const,
bool PopupMenu(wxMenu *menu, const wxPoint& pos=wxDefaultPosition);
-
+ DocDeclStr(
+ virtual bool , HasMultiplePages() const,
+ "", "");
+
%extend {
DocStr(GetHandle,
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(
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.", "");
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,
// 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(
// 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
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,
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
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,
The base class version returns false, but this method is overridden in
wxControl where it returns true.", "");
+
+
+ DocDeclStr(
+ virtual bool , CanSetTransparent(),
+ "Returns ``True`` if the platform supports setting the transparency for
+this window. Note that this method will err on the side of caution,
+so it is possible that this will return ``False`` when it is in fact
+possible to set the transparency.
+
+NOTE: On X-windows systems the X server must have the composite
+extension loaded, and there must be a composite manager program (such
+as xcompmgr) running.", "");
+
+ DocDeclStr(
+ virtual bool , SetTransparent(byte alpha),
+ "Attempt to set the transparency of this window to the ``alpha`` value,
+returns True on success. The ``alpha`` value is an integer in the
+range of 0 to 255, where 0 is fully transparent and 255 is fully
+opaque.", "");
+
%pythoncode {
if hasattr(self, '_setCallbackInfo'):
self._setCallbackInfo(self, self.__class__)
}
+
+ %pythoncode {
+ def SendSizeEvent(self):
+ self.GetEventHandler().ProcessEvent(wx.SizeEvent((-1,-1)))
+ }
};
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);