Added CanApplyParentThemeBackground and use it in wxMSW's
wxNotebook::ApplyThemeBackground. It's in the common base classes so that someday it's usage can expand to the other platforms as well. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,6 +61,8 @@ public:
|
||||
int GetMarginX() const { return m_marginX; }
|
||||
int GetMarginY() const { return m_marginY; }
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
protected:
|
||||
// function called when any of the bitmaps changes
|
||||
virtual void OnSetBitmap() { }
|
||||
|
@@ -106,6 +106,8 @@ public:
|
||||
return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER);
|
||||
}
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
protected:
|
||||
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
|
||||
|
||||
|
@@ -86,6 +86,8 @@ public:
|
||||
virtual bool ProvidesBackground() const { return TRUE; }
|
||||
#endif
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
WX_DECLARE_CONTROL_CONTAINER();
|
||||
|
||||
protected:
|
||||
|
@@ -198,6 +198,8 @@ public:
|
||||
void SelectAll();
|
||||
#endif
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return false; }
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
// implementation only from now on
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
@@ -86,6 +86,7 @@ public:
|
||||
|
||||
// implement some base class functions
|
||||
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
protected:
|
||||
DECLARE_NO_COPY_CLASS(wxNotebookBase)
|
||||
|
@@ -46,6 +46,8 @@ public:
|
||||
virtual void Position(const wxPoint& ptOrigin,
|
||||
const wxSize& size);
|
||||
|
||||
virtual bool IsTopLevel() const { return TRUE; }
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxPopupWindowBase)
|
||||
};
|
||||
|
||||
|
@@ -86,6 +86,8 @@ public:
|
||||
// return the item above/below/to the left/right of the given one
|
||||
int GetNextItem(int item, wxDirection dir, long style) const;
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
// for compatibility only, don't use these methods in new code!
|
||||
#if WXWIN_COMPATIBILITY_2_2
|
||||
int Number() const { return GetCount(); }
|
||||
|
@@ -80,6 +80,9 @@ public:
|
||||
virtual int GetSelStart() const { return GetMax(); }
|
||||
virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
|
||||
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxSliderBase)
|
||||
};
|
||||
|
@@ -17,7 +17,8 @@ public:
|
||||
wxStaticBoxBase() { }
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxStaticBoxBase)
|
||||
|
@@ -47,7 +47,8 @@ public:
|
||||
static int GetDefaultSize() { return 2; }
|
||||
|
||||
// overriden base class virtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
protected:
|
||||
// set the right size for the right dimension
|
||||
|
@@ -12,8 +12,9 @@ class WXDLLEXPORT wxStaticTextBase : public wxControl
|
||||
public:
|
||||
wxStaticTextBase() { }
|
||||
|
||||
// overriden base cirtuals
|
||||
virtual bool AcceptsFocus() const { return FALSE; }
|
||||
// overriden base virtuals
|
||||
virtual bool AcceptsFocus() const { return false; }
|
||||
virtual bool CanApplyParentThemeBackground() const { return true; }
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxStaticTextBase)
|
||||
|
@@ -189,6 +189,8 @@ public:
|
||||
void SetSelectionBackground(const wxColour& col);
|
||||
|
||||
|
||||
virtual bool CanApplyParentThemeBackground() const { return false; }
|
||||
|
||||
protected:
|
||||
// the derived class must implement this function to actually draw the item
|
||||
// with the given index on the provided DC
|
||||
|
@@ -394,6 +394,13 @@ 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 bool CanApplyParentThemeBackground() const { return false; }
|
||||
|
||||
// returns true if this window should inherit its parent colours on
|
||||
// creation
|
||||
virtual bool ShouldInheritColours() const { return false; }
|
||||
|
@@ -966,24 +966,15 @@ void wxNotebook::ApplyThemeBackground(wxWindow*, const wxColour&)
|
||||
#endif
|
||||
{
|
||||
#if wxUSE_UXTHEME
|
||||
// Don't set the background for buttons since this will
|
||||
// switch it into ownerdraw mode
|
||||
// Special case for wxButton: Don't set the background for buttons since
|
||||
// this will switch it into ownerdraw mode
|
||||
if (window->IsKindOf(CLASSINFO(wxButton)) && !window->IsKindOf(CLASSINFO(wxBitmapButton)))
|
||||
// This is essential, otherwise you'll see dark grey
|
||||
// corners in the buttons.
|
||||
((wxButton*)window)->wxControl::SetBackgroundColour(colour);
|
||||
else if (window->IsKindOf(CLASSINFO(wxStaticText)) ||
|
||||
window->IsKindOf(CLASSINFO(wxStaticBox)) ||
|
||||
window->IsKindOf(CLASSINFO(wxStaticLine)) ||
|
||||
window->IsKindOf(CLASSINFO(wxRadioButton)) ||
|
||||
window->IsKindOf(CLASSINFO(wxRadioBox)) ||
|
||||
window->IsKindOf(CLASSINFO(wxCheckBox)) ||
|
||||
window->IsKindOf(CLASSINFO(wxBitmapButton)) ||
|
||||
window->IsKindOf(CLASSINFO(wxSlider)) ||
|
||||
window->IsKindOf(CLASSINFO(wxPanel)) ||
|
||||
(window->IsKindOf(CLASSINFO(wxNotebook)) && (window != this)) ||
|
||||
window->IsKindOf(CLASSINFO(wxScrolledWindow))
|
||||
)
|
||||
|
||||
// for all other classes let them decide
|
||||
else if ((window != this) && window->CanApplyParentThemeBackground())
|
||||
{
|
||||
window->SetBackgroundColour(colour);
|
||||
}
|
||||
|
Reference in New Issue
Block a user