X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/716e96df2b2beb65074744a6d833794b1c8a5790..4f85606724061367d0d5ab79444990e36b0acfa6:/include/wx/window.h?ds=inline diff --git a/include/wx/window.h b/include/wx/window.h index eeb5f98656..795fe59b75 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -96,14 +96,26 @@ WXDLLEXPORT_DATA(extern wxWindowList) wxTopLevelWindows; // temporarily switches event handlers). // ---------------------------------------------------------------------------- +// different window variants, on platforms like eg mac uses different rendering sizes + +enum wxWindowVariant +{ + wxWINDOW_VARIANT_DEFAULT, // Default size (usually == normal, may be set by a wxSystemOptions entry) + wxWINDOW_VARIANT_NORMAL, // Normal size + wxWINDOW_VARIANT_SMALL, // Smaller size (about 25 % smaller than normal ) + wxWINDOW_VARIANT_MINI, // Mini size (about 33 % smaller than normal ) + wxWINDOW_VARIANT_LARGE, // Large size (about 25 % larger than normal ) +}; + class WXDLLEXPORT wxWindowBase : public wxEvtHandler { public: // creating the window // ------------------- - // default ctor - wxWindowBase() { InitBase(); } + // default ctor, initializes everything which can be initialized before + // Create() + wxWindowBase() ; // pseudo ctor (can't be virtual, called from ctor) bool CreateBase(wxWindowBase *parent, @@ -157,6 +169,11 @@ public: virtual void SetName( const wxString &name ) { m_windowName = name; } virtual wxString GetName() const { return m_windowName; } + // sets the window variant, calls internally DoSetVariant if variant has changed + void SetWindowVariant( wxWindowVariant variant ) ; + wxWindowVariant GetWindowVariant() const { return m_windowVariant ; } + + // window id uniquely identifies the window among its siblings unless // it is -1 which means "don't care" void SetId( wxWindowID winid ) { m_windowId = winid; } @@ -393,6 +410,14 @@ public: virtual void SetThemeEnabled(bool enableTheme) { m_themeEnabled = enableTheme; } virtual bool GetThemeEnabled() const { return m_themeEnabled; } + // Returns true if this class should have the background colour + // changed to match the parent window's theme. For example when a + // page is added to a notebook it and it's children may need to have + // the colours adjusted depending on the current theme settings, but + // not all windows/controls can do this without looking wrong. + virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg)) + { /* do nothing */ } + // returns true if this window should inherit its parent colours on // creation virtual bool ShouldInheritColours() const { return false; } @@ -1025,19 +1050,18 @@ protected: int m_minVirtualHeight; int m_maxVirtualWidth; int m_maxVirtualHeight; - - // common part of all ctors: it is not virtual because it is called from - // ctor - void InitBase(); + + wxWindowVariant m_windowVariant ; // override this to change the default (i.e. used when no style is // specified) border for the window class virtual wxBorder GetDefaultBorder() const; - // get the default size for the new window if no explicit size given - // FIXME why 20 and not 30, 10 or ...? - static int WidthDefault(int w) { return w == -1 ? 20 : w; } - static int HeightDefault(int h) { return h == -1 ? 20 : h; } + // Get the default size for the new window if no explicit size given If + // there are better default sizes then these can be changed, just as long + // as they are not too small for TLWs. + static int WidthDefault(int w) { return w == -1 ? 400 : w; } + static int HeightDefault(int h) { return h == -1 ? 250 : h; } // set the best size for the control if the default size was given: // replaces the fields of size == -1 with the best values for them and @@ -1126,6 +1150,8 @@ protected: virtual void AdjustForParentClientOrigin(int& x, int& y, int sizeFlags = 0) const; + // implements the window variants + virtual void DoSetWindowVariant( wxWindowVariant variant ) ; private: