X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/33e10b88cfafe0d95a5ec0e1e454dee25acf8bae..3bcdbe527fde583072eefab67de8974c0e17a1e2:/wxPython/src/_window.i?ds=sidebyside diff --git a/wxPython/src/_window.i b/wxPython/src/_window.i index 37479191f0..70e855e1d3 100644 --- a/wxPython/src/_window.i +++ b/wxPython/src/_window.i @@ -30,7 +30,7 @@ DocStr(wxVisualAttributes, struct wxVisualAttributes { %extend { - wxVisualAttributes() {} + wxVisualAttributes() { return new wxVisualAttributes; } ~wxVisualAttributes() {} } @@ -194,7 +194,7 @@ public: RefDoc(wxWindow, ""); // turn it off for the ctors DocCtorStr( - wxWindow(wxWindow* parent, const wxWindowID id, + wxWindow(wxWindow* parent, const wxWindowID id=-1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -208,7 +208,7 @@ public: DocDeclStr( - bool , Create(wxWindow* parent, const wxWindowID id, + bool , Create(wxWindow* parent, const wxWindowID id=-1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -682,9 +682,10 @@ window had already been in the specified state."); DocDeclStr( virtual void , SetWindowStyleFlag( long style ), - "Sets the style of the window. Please note that some styles cannot be -changed after the window creation and that Refresh() might be called -after changing the others for the change to take place immediately."); + "Sets the style of the window. Please note that some styles cannot +be changed after the window creation and that Refresh() might +need to be called after changing the others for the change to +take place immediately."); DocDeclStr( virtual long , GetWindowStyleFlag() const, @@ -1010,11 +1011,11 @@ other application. To bind an event handler function to this hotkey use EVT_HOTKEY with an id equal to hotkeyId. Returns True if the hotkey was registered successfully."); bool RegisterHotKey(int hotkeyId, int modifiers, int keycode) { - #if wxUSE_HOTKEY + %#if wxUSE_HOTKEY return self->RegisterHotKey(hotkeyId, modifiers, keycode); - #else + %#else return False; - #endif + %#endif } @@ -1227,6 +1228,12 @@ Use this function with care under GTK+ as the new appearance of the window might not look equally well when used with themes, i.e GTK+'s ability to change its look as the user wishes with run-time loadable modules."); + + DocDeclStr( + void , SetDefaultBackgroundColour(const wxColour& colour), + ""); + + DocDeclStr( virtual bool , SetForegroundColour( const wxColour &colour ), @@ -1235,7 +1242,12 @@ was changed. The interpretation of 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( + void , SetDefaultForegroundColour(const wxColour& colour), + ""); + + DocDeclStr( wxColour , GetBackgroundColour() const, "Returns the background colour of the window."); @@ -1267,6 +1279,12 @@ be reset back to default."); virtual bool , SetFont( const wxFont &font ), "Sets the font for this window."); + DocDeclStr( + void , SetDefaultFont(const wxFont& font), + ""); + + + DocDeclStr( wxFont& , GetFont(), "Returns the default font used for this window."); @@ -1705,6 +1723,47 @@ the window can remove itself from the sizer when it is destroyed."); + + DocDeclStr( + virtual void , InheritAttributes(), + "This function is (or should be, in case of custom controls) +called during window creation to intelligently set up the window +visual attributes, that is the font and the foreground and +background colours. + +By 'intelligently' the following is meant: by default, all +windows use their own default attributes. However if some of the +parent's attributes are explicitly changed (that is, using +SetFont and not SetDefaultFont) and if the corresponding +attribute hadn't been explicitly set for this window itself, then +this window takes the same value as used by the parent. In +addition, if the window overrides ShouldInheritColours to return +false, the colours will not be changed no matter what and only +the font might. + +This rather complicated logic is necessary in order to accomodate +the different usage scenarius. The most common one is when all +default attributes are used and in this case, nothing should be +inherited as in modern GUIs different controls use different +fonts (and colours) than their siblings so they can't inherit the +same value from the parent. However it was also deemed desirable +to allow to simply change the attributes of all children at once +by just changing the font or colour of their common parent, hence +in this case we do inherit the parents attributes."); + + +// TODO: Virtualize this with directors + DocDeclStr( + virtual bool , ShouldInheritColours() const, + "Return true from here to allow the colours of this window to be +changed by InheritAttributes, returning false forbids inheriting +them from the parent window. + +The base class version returns false, but this method is +overridden in wxControl where it returns true."); + + + %pythoncode { def PostCreate(self, pre): """