Changed CanApplyParentThemeBackground to ApplyParentThemeBackground

and let the windows set the the background colour themselves (or not)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-03-05 05:28:21 +00:00
parent 8eca4fef10
commit cc0bffaceb
17 changed files with 41 additions and 26 deletions

View File

@@ -61,7 +61,9 @@ public:
int GetMarginX() const { return m_marginX; } int GetMarginX() const { return m_marginX; }
int GetMarginY() const { return m_marginY; } int GetMarginY() const { return m_marginY; }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
// function called when any of the bitmaps changes // function called when any of the bitmaps changes

View File

@@ -161,6 +161,9 @@ public:
} }
} }
virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
// remove the page and return a pointer to it // remove the page and return a pointer to it
virtual wxWindow *DoRemovePage(size_t page) = 0; virtual wxWindow *DoRemovePage(size_t page) = 0;

View File

@@ -106,7 +106,8 @@ public:
return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER);
} }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; }

View File

@@ -86,7 +86,9 @@ public:
virtual bool ProvidesBackground() const { return TRUE; } virtual bool ProvidesBackground() const { return TRUE; }
#endif #endif
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
WX_DECLARE_CONTROL_CONTAINER(); WX_DECLARE_CONTROL_CONTAINER();

View File

@@ -198,7 +198,8 @@ public:
void SelectAll(); void SelectAll();
#endif #endif
virtual bool CanApplyParentThemeBackground() const { return false; } virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg))
{ /* do nothing */ }
protected: protected:
void Init(); void Init();

View File

@@ -54,6 +54,12 @@ public:
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
virtual bool MSWCommand(WXUINT param, WXWORD id); virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual void ApplyParentThemeBackground(const wxColour& bg)
{
// avoide switching into owner-drawn mode
wxControl::SetBackgroundColour(bg);
}
#ifdef __WIN32__ #ifdef __WIN32__
// coloured buttons support // coloured buttons support
virtual bool SetBackgroundColour(const wxColour &colour); virtual bool SetBackgroundColour(const wxColour &colour);

View File

@@ -124,6 +124,9 @@ public:
int GetNumVer() const; int GetNumVer() const;
int GetNumHor() const; int GetNumHor() const;
virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
// subclass one radio button // subclass one radio button
void SubclassRadioButton(WXHWND hWndBtn); void SubclassRadioButton(WXHWND hWndBtn);

View File

@@ -52,7 +52,9 @@ public:
// implementation only from now on // implementation only from now on
virtual bool MSWCommand(WXUINT param, WXWORD id); virtual bool MSWCommand(WXUINT param, WXWORD id);
virtual void Command(wxCommandEvent& event); virtual void Command(wxCommandEvent& event);
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;

View File

@@ -86,7 +86,6 @@ public:
// implement some base class functions // implement some base class functions
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const; virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
virtual bool CanApplyParentThemeBackground() const { return true; }
protected: protected:
DECLARE_NO_COPY_CLASS(wxNotebookBase) DECLARE_NO_COPY_CLASS(wxNotebookBase)

View File

@@ -86,8 +86,6 @@ public:
// return the item above/below/to the left/right of the given one // return the item above/below/to the left/right of the given one
int GetNextItem(int item, wxDirection dir, long style) const; 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! // for compatibility only, don't use these methods in new code!
#if WXWIN_COMPATIBILITY_2_2 #if WXWIN_COMPATIBILITY_2_2
int Number() const { return GetCount(); } int Number() const { return GetCount(); }

View File

@@ -81,7 +81,9 @@ public:
virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { } virtual void SetSelection(int WXUNUSED(min), int WXUNUSED(max)) { }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
private: private:
DECLARE_NO_COPY_CLASS(wxSliderBase) DECLARE_NO_COPY_CLASS(wxSliderBase)

View File

@@ -18,7 +18,8 @@ public:
// overriden base class virtuals // overriden base class virtuals
virtual bool AcceptsFocus() const { return false; } virtual bool AcceptsFocus() const { return false; }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
private: private:
DECLARE_NO_COPY_CLASS(wxStaticBoxBase) DECLARE_NO_COPY_CLASS(wxStaticBoxBase)

View File

@@ -48,7 +48,8 @@ public:
// overriden base class virtuals // overriden base class virtuals
virtual bool AcceptsFocus() const { return false; } virtual bool AcceptsFocus() const { return false; }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
protected: protected:
// set the right size for the right dimension // set the right size for the right dimension

View File

@@ -14,7 +14,8 @@ public:
// overriden base virtuals // overriden base virtuals
virtual bool AcceptsFocus() const { return false; } virtual bool AcceptsFocus() const { return false; }
virtual bool CanApplyParentThemeBackground() const { return true; } virtual void ApplyParentThemeBackground(const wxColour& bg)
{ SetBackgroundColour(bg); }
private: private:
DECLARE_NO_COPY_CLASS(wxStaticTextBase) DECLARE_NO_COPY_CLASS(wxStaticTextBase)

View File

@@ -189,7 +189,9 @@ public:
void SetSelectionBackground(const wxColour& col); void SetSelectionBackground(const wxColour& col);
virtual bool CanApplyParentThemeBackground() const { return false; } virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg))
{ /* do nothing */ }
protected: protected:
// the derived class must implement this function to actually draw the item // the derived class must implement this function to actually draw the item

View File

@@ -399,7 +399,8 @@ public:
// page is added to a notebook it and it's children may need to have // 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 // the colours adjusted depending on the current theme settings, but
// not all windows/controls can do this without looking wrong. // not all windows/controls can do this without looking wrong.
virtual bool CanApplyParentThemeBackground() const { return false; } virtual void ApplyParentThemeBackground(const wxColour& WXUNUSED(bg))
{ /* do nothing */ }
// returns true if this window should inherit its parent colours on // returns true if this window should inherit its parent colours on
// creation // creation

View File

@@ -966,19 +966,9 @@ void wxNotebook::ApplyThemeBackground(wxWindow*, const wxColour&)
#endif #endif
{ {
#if wxUSE_UXTHEME #if wxUSE_UXTHEME
// 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);
// for all other classes let them decide
else if ((window != this) && window->CanApplyParentThemeBackground())
{
window->SetBackgroundColour(colour);
}
window->ApplyParentThemeBackground(colour);
for ( wxWindowList::compatibility_iterator node = window->GetChildren().GetFirst(); node; node = node->GetNext() ) for ( wxWindowList::compatibility_iterator node = window->GetChildren().GetFirst(); node; node = node->GetNext() )
{ {
wxWindow *child = node->GetData(); wxWindow *child = node->GetData();