Allow wxStaticText to have a custom fg without a custom bg
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32780 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -133,7 +133,7 @@ protected:
|
|||||||
// common part of the 3 functions above: pass wxNullColour to use the
|
// common part of the 3 functions above: pass wxNullColour to use the
|
||||||
// appropriate background colour (meaning ours or our parents) or a fixed
|
// appropriate background colour (meaning ours or our parents) or a fixed
|
||||||
// one
|
// one
|
||||||
WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
|
virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
|
||||||
|
|
||||||
// another WM_CTLCOLOR-related function: override this to return the brush
|
// another WM_CTLCOLOR-related function: override this to return the brush
|
||||||
// which should be used to paint the control background by default
|
// which should be used to paint the control background by default
|
||||||
|
@@ -51,6 +51,7 @@ protected:
|
|||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
|
||||||
|
virtual WXHBRUSH DoMSWControlColor(WXHDC pDC, wxColour colBg);
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText)
|
DECLARE_DYNAMIC_CLASS_NO_COPY(wxStaticText)
|
||||||
};
|
};
|
||||||
|
@@ -126,6 +126,19 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
return msStyle;
|
return msStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WXHBRUSH wxStaticText::DoMSWControlColor(WXHDC pDC, wxColour colBg)
|
||||||
|
{
|
||||||
|
// If this control has a non-standard fg colour but still has the standard
|
||||||
|
// bg then we need to also give it a non-standard bg otherwise the fg
|
||||||
|
// setting has no effect.
|
||||||
|
WXHBRUSH hbr = wxControl::DoMSWControlColor(pDC, colBg);
|
||||||
|
if (!hbr && m_hasFgCol)
|
||||||
|
{
|
||||||
|
hbr = MSWGetBgBrushForChild(pDC, this);
|
||||||
|
}
|
||||||
|
return hbr;
|
||||||
|
}
|
||||||
|
|
||||||
wxSize wxStaticText::DoGetBestSize() const
|
wxSize wxStaticText::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxClientDC dc(wx_const_cast(wxStaticText *, this));
|
wxClientDC dc(wx_const_cast(wxStaticText *, this));
|
||||||
|
Reference in New Issue
Block a user