No real changes, just change type of MSWGetBgBrush() argument.
Pass wxWindow instead of HWND to it as in most cases we already have wxWindow for the HWND we have and calling wxFindWinFromHandle() once more is unnecessary. This also makes the code of MSWGetBgBrushForChild() slightly simpler. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,7 +183,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return the themed brush for painting our children
|
// return the themed brush for painting our children
|
||||||
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd);
|
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindow *child);
|
||||||
|
|
||||||
// draw child background
|
// draw child background
|
||||||
virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win);
|
virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win);
|
||||||
|
@@ -399,17 +399,19 @@ public:
|
|||||||
// background or 0 if this window doesn't impose any particular background
|
// background or 0 if this window doesn't impose any particular background
|
||||||
// on its children
|
// on its children
|
||||||
//
|
//
|
||||||
|
// the hDC parameter is the DC background will be drawn on, it can be used
|
||||||
|
// to call SetBrushOrgEx() on it if the returned brush is a bitmap one
|
||||||
|
//
|
||||||
|
// child parameter is never NULL
|
||||||
|
//
|
||||||
// the base class version returns a solid brush if we have a non default
|
// the base class version returns a solid brush if we have a non default
|
||||||
// background colour or 0 otherwise
|
// background colour or 0 otherwise
|
||||||
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd);
|
virtual WXHBRUSH MSWGetBgBrushForChild(WXHDC hDC, wxWindowMSW *child);
|
||||||
|
|
||||||
// return the background brush to use for painting the given window by
|
// return the background brush to use for painting the given window by
|
||||||
// quering the parent windows via their MSWGetBgBrushForChild() recursively
|
// quering the parent windows via their MSWGetBgBrushForChild() recursively
|
||||||
//
|
WXHBRUSH MSWGetBgBrush(WXHDC hDC) { return MSWGetBgBrush(hDC, this); }
|
||||||
// hWndToPaint is normally NULL meaning this window itself, but it can also
|
WXHBRUSH MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child);
|
||||||
// be a child of this window which is used by the static box and could be
|
|
||||||
// potentially useful for other transparent controls
|
|
||||||
WXHBRUSH MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint = NULL);
|
|
||||||
|
|
||||||
// gives the parent the possibility to draw its children background, e.g.
|
// gives the parent the possibility to draw its children background, e.g.
|
||||||
// this is used by wxNotebook to do it using DrawThemeBackground()
|
// this is used by wxNotebook to do it using DrawThemeBackground()
|
||||||
|
@@ -367,7 +367,8 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
|
|||||||
WXHBRUSH hbr = 0;
|
WXHBRUSH hbr = 0;
|
||||||
if ( !colBg.Ok() )
|
if ( !colBg.Ok() )
|
||||||
{
|
{
|
||||||
hbr = MSWGetBgBrush(pDC, hWnd);
|
if ( wxWindow *win = wxFindWinFromHandle(hWnd) )
|
||||||
|
hbr = MSWGetBgBrush(pDC, win);
|
||||||
|
|
||||||
// if the control doesn't have any bg colour, foreground colour will be
|
// if the control doesn't have any bg colour, foreground colour will be
|
||||||
// ignored as the return value would be 0 -- so forcefully give it a
|
// ignored as the return value would be 0 -- so forcefully give it a
|
||||||
|
@@ -1248,14 +1248,14 @@ void wxNotebook::UpdateBgBrush()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd)
|
WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, wxWindow *child)
|
||||||
{
|
{
|
||||||
if ( m_hbrBackground )
|
if ( m_hbrBackground )
|
||||||
{
|
{
|
||||||
// before drawing with the background brush, we need to position it
|
// before drawing with the background brush, we need to position it
|
||||||
// correctly
|
// correctly
|
||||||
RECT rc;
|
RECT rc;
|
||||||
::GetWindowRect((HWND)hWnd, &rc);
|
::GetWindowRect(GetHwndOf(child), &rc);
|
||||||
|
|
||||||
::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
|
::MapWindowPoints(NULL, GetHwnd(), (POINT *)&rc, 1);
|
||||||
|
|
||||||
@@ -1267,7 +1267,7 @@ WXHBRUSH wxNotebook::MSWGetBgBrushForChild(WXHDC hDC, WXHWND hWnd)
|
|||||||
return m_hbrBackground;
|
return m_hbrBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxNotebookBase::MSWGetBgBrushForChild(hDC, hWnd);
|
return wxNotebookBase::MSWGetBgBrushForChild(hDC, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child)
|
bool wxNotebook::MSWPrintChild(WXHDC hDC, wxWindow *child)
|
||||||
|
@@ -365,7 +365,7 @@ void wxStaticBox::PaintBackground(wxDC& dc, const RECT& rc)
|
|||||||
// see http://groups.google.com/groups?selm=4252E932.3080801%40able.es
|
// see http://groups.google.com/groups?selm=4252E932.3080801%40able.es
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
|
wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
|
||||||
HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(impl->GetHDC(), GetHWND());
|
HBRUSH hbr = (HBRUSH)parent->MSWGetBgBrush(impl->GetHDC(), this);
|
||||||
|
|
||||||
// if there is no special brush for painting this control, just use the
|
// if there is no special brush for painting this control, just use the
|
||||||
// solid background colour
|
// solid background colour
|
||||||
|
@@ -4816,7 +4816,7 @@ bool wxWindowMSW::DoEraseBackground(WXHDC hDC)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH
|
WXHBRUSH
|
||||||
wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd)
|
wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), wxWindowMSW *child)
|
||||||
{
|
{
|
||||||
if ( m_hasBgCol )
|
if ( m_hasBgCol )
|
||||||
{
|
{
|
||||||
@@ -4828,11 +4828,10 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd)
|
|||||||
// children because it would look wrong if a child of non
|
// children because it would look wrong if a child of non
|
||||||
// transparent child would show our bg colour when the child itself
|
// transparent child would show our bg colour when the child itself
|
||||||
// does not
|
// does not
|
||||||
wxWindow *win = wxFindWinFromHandle(hWnd);
|
if ( child == this ||
|
||||||
if ( win == this ||
|
|
||||||
m_inheritBgCol ||
|
m_inheritBgCol ||
|
||||||
(win && win->HasTransparentBackground() &&
|
(child->HasTransparentBackground() &&
|
||||||
win->GetParent() == this) )
|
child->GetParent() == this) )
|
||||||
{
|
{
|
||||||
// draw children with the same colour as the parent
|
// draw children with the same colour as the parent
|
||||||
wxBrush *
|
wxBrush *
|
||||||
@@ -4845,14 +4844,11 @@ wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), WXHWND hWnd)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, WXHWND hWndToPaint)
|
WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child)
|
||||||
{
|
{
|
||||||
if ( !hWndToPaint )
|
|
||||||
hWndToPaint = GetHWND();
|
|
||||||
|
|
||||||
for ( wxWindowMSW *win = this; win; win = win->GetParent() )
|
for ( wxWindowMSW *win = this; win; win = win->GetParent() )
|
||||||
{
|
{
|
||||||
WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, hWndToPaint);
|
WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, child);
|
||||||
if ( hBrush )
|
if ( hBrush )
|
||||||
return hBrush;
|
return hBrush;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user