From 7c7a653bec7c85eccce74ee1dcb060011f5b51cf Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 7 Jan 2005 16:54:09 +0000 Subject: [PATCH] moved HasTransparentBackground() from wxUniv to common wxWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31272 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/window.tex | 13 ++++++++++++- include/wx/checkbox.h | 3 +-- include/wx/statbox.h | 17 ++++++++--------- include/wx/stattext.h | 3 +-- include/wx/univ/checkbox.h | 2 -- include/wx/univ/statbox.h | 2 -- include/wx/univ/stattext.h | 2 -- include/wx/univ/window.h | 5 ----- include/wx/window.h | 5 +++++ 9 files changed, 27 insertions(+), 25 deletions(-) diff --git a/docs/latex/wx/window.tex b/docs/latex/wx/window.tex index 62a3be878a..6a0f3ab2ed 100644 --- a/docs/latex/wx/window.tex +++ b/docs/latex/wx/window.tex @@ -1326,7 +1326,6 @@ Returns {\tt true} if this window has the current mouse capture. \constfunc{virtual bool}{HasScrollbar}{\param{int }{orient}} - Returns {\tt true} if this window has a scroll bar for this orientation. \wxheading{Parameters} @@ -1334,6 +1333,18 @@ Returns {\tt true} if this window has a scroll bar for this orientation. \docparam{orient}{Orientation to check, either {\tt wxHORIZONTAL} or {\tt wxVERTICAL}.} +\membersection{wxWindow::HasTransparentBackground}\label{wxwindowhastransparentbackground} + +\constfunc{virtual bool}{HasTransparentBackground}{\void} + +Returns \true if this window background is transparent (as, for example, for +wxStaticText) and should show the parent window background. + +This method is mostly used internally by the library itself and you normally +shouldn't have to call it. You may, however, have to override it in your +wxWindow-derived class to ensure that background is painted correctly. + + \membersection{wxWindow::Hide}\label{wxwindowhide} \func{bool}{Hide}{\void} diff --git a/include/wx/checkbox.h b/include/wx/checkbox.h index dc333f37e8..7ed44aaefc 100644 --- a/include/wx/checkbox.h +++ b/include/wx/checkbox.h @@ -106,8 +106,7 @@ public: return HasFlag(wxCHK_ALLOW_3RD_STATE_FOR_USER); } - virtual void ApplyParentThemeBackground(const wxColour& bg) - { SetBackgroundColour(bg); } + virtual bool HasTransparentBackground() { return true; } protected: virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)) { wxFAIL; } diff --git a/include/wx/statbox.h b/include/wx/statbox.h index d5661e10fc..c286ad829d 100644 --- a/include/wx/statbox.h +++ b/include/wx/statbox.h @@ -18,27 +18,26 @@ public: // overriden base class virtuals virtual bool AcceptsFocus() const { return false; } - virtual void ApplyParentThemeBackground(const wxColour& bg) - { SetBackgroundColour(bg); } + virtual bool HasTransparentBackground() { return true; } private: DECLARE_NO_COPY_CLASS(wxStaticBoxBase) }; #if defined(__WXUNIVERSAL__) -#include "wx/univ/statbox.h" + #include "wx/univ/statbox.h" #elif defined(__WXMSW__) -#include "wx/msw/statbox.h" + #include "wx/msw/statbox.h" #elif defined(__WXMOTIF__) -#include "wx/motif/statbox.h" + #include "wx/motif/statbox.h" #elif defined(__WXGTK__) -#include "wx/gtk/statbox.h" + #include "wx/gtk/statbox.h" #elif defined(__WXMAC__) -#include "wx/mac/statbox.h" + #include "wx/mac/statbox.h" #elif defined(__WXCOCOA__) -#include "wx/cocoa/statbox.h" + #include "wx/cocoa/statbox.h" #elif defined(__WXPM__) -#include "wx/os2/statbox.h" + #include "wx/os2/statbox.h" #endif #endif // wxUSE_STATBOX diff --git a/include/wx/stattext.h b/include/wx/stattext.h index 8590052f74..979152cb16 100644 --- a/include/wx/stattext.h +++ b/include/wx/stattext.h @@ -14,8 +14,7 @@ public: // overriden base virtuals virtual bool AcceptsFocus() const { return false; } - virtual void ApplyParentThemeBackground(const wxColour& bg) - { SetBackgroundColour(bg); } + virtual bool HasTransparentBackground() { return true; } private: DECLARE_NO_COPY_CLASS(wxStaticTextBase) diff --git a/include/wx/univ/checkbox.h b/include/wx/univ/checkbox.h index 9c6108fac9..b2c7b4ec4f 100644 --- a/include/wx/univ/checkbox.h +++ b/include/wx/univ/checkbox.h @@ -101,8 +101,6 @@ public: // overridden base class virtuals virtual bool IsPressed() const { return m_isPressed; } - virtual bool HasTransparentBackground() { return true; } - protected: virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state)); virtual wxCheckBoxState DoGet3StateValue() const; diff --git a/include/wx/univ/statbox.h b/include/wx/univ/statbox.h index cdc8223bdc..c4578fa6c2 100644 --- a/include/wx/univ/statbox.h +++ b/include/wx/univ/statbox.h @@ -51,8 +51,6 @@ public: // take account of this virtual wxPoint GetBoxAreaOrigin() const; - virtual bool HasTransparentBackground() { return true; } - protected: // draw the control virtual void DoDraw(wxControlRenderer *renderer); diff --git a/include/wx/univ/stattext.h b/include/wx/univ/stattext.h index 0961ba67ab..95de78f9ef 100644 --- a/include/wx/univ/stattext.h +++ b/include/wx/univ/stattext.h @@ -55,8 +55,6 @@ public: virtual void SetLabel(const wxString& label); - virtual bool HasTransparentBackground() { return true; } - virtual bool IsFocused() const { return false; } protected: diff --git a/include/wx/univ/window.h b/include/wx/univ/window.h index 2ef6b3ea94..13a54c9421 100644 --- a/include/wx/univ/window.h +++ b/include/wx/univ/window.h @@ -144,11 +144,6 @@ public: // controls only virtual bool IsCanvasWindow() const { return false; } - // returns true if the control has "transparent" areas such - // as a wxStaticText and wxCheckBox and the background should - // be adapted from a parent window - virtual bool HasTransparentBackground() { return false; } - // return true if this control can be highlighted when the mouse is over // it (the theme decides itself whether it is really highlighted or not) virtual bool CanBeHighlighted() const { return false; } diff --git a/include/wx/window.h b/include/wx/window.h index ffa36e365e..7c72d59bb1 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -777,6 +777,11 @@ public: virtual bool SetBackgroundStyle(wxBackgroundStyle style) { m_backgroundStyle = style; return true; } virtual wxBackgroundStyle GetBackgroundStyle() const { return m_backgroundStyle; } + // returns true if the control has "transparent" areas such as a + // wxStaticText and wxCheckBox and the background should be adapted + // from a parent window + virtual bool HasTransparentBackground() { return false; } + // set/retrieve the font for the window (SetFont() returns true if the // font really changed) virtual bool SetFont(const wxFont& font) = 0; -- 2.45.2