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() { }
return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER);
}
+ virtual bool CanApplyParentThemeBackground() const { return true; }
+
protected:
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }
virtual bool ProvidesBackground() const { return TRUE; }
#endif
+ virtual bool CanApplyParentThemeBackground() const { return true; }
+
WX_DECLARE_CONTROL_CONTAINER();
protected:
void SelectAll();
#endif
+ virtual bool CanApplyParentThemeBackground() const { return false; }
+
protected:
void Init();
// 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;
// implement some base class functions
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
+ virtual bool CanApplyParentThemeBackground() const { return true; }
protected:
DECLARE_NO_COPY_CLASS(wxNotebookBase)
virtual void Position(const wxPoint& ptOrigin,
const wxSize& size);
+ virtual bool IsTopLevel() const { return TRUE; }
+
DECLARE_NO_COPY_CLASS(wxPopupWindowBase)
};
// 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(); }
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)
};
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)
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
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)
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
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; }
#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);
}