1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/custombgwin.h
3 // Purpose: wxMSW implementation of wxCustomBackgroundWindow
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_MSW_CUSTOMBGWIN_H_
11 #define _WX_MSW_CUSTOMBGWIN_H_
13 #include "wx/bitmap.h"
16 // ----------------------------------------------------------------------------
17 // wxCustomBackgroundWindow
18 // ----------------------------------------------------------------------------
21 class wxCustomBackgroundWindow
: public W
,
22 public wxCustomBackgroundWindowBase
25 typedef W BaseWindowClass
;
27 wxCustomBackgroundWindow() { m_backgroundBrush
= NULL
; }
29 virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush
; }
32 virtual void DoSetBackgroundBitmap(const wxBitmap
& bmp
)
34 delete m_backgroundBrush
;
35 m_backgroundBrush
= bmp
.IsOk() ? new wxBrush(bmp
) : NULL
;
37 // Our transparent children should use our background if we have it,
38 // otherwise try to restore m_inheritBgCol to some reasonable value: true
39 // if we also have non-default background colour or false otherwise.
40 BaseWindowClass::m_inheritBgCol
= bmp
.IsOk()
41 || BaseWindowClass::UseBgCol();
44 virtual WXHBRUSH
MSWGetCustomBgBrush()
46 if ( m_backgroundBrush
)
47 return (WXHBRUSH
)m_backgroundBrush
->GetResourceHandle();
49 return BaseWindowClass::MSWGetCustomBgBrush();
52 wxBrush
*m_backgroundBrush
;
54 wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow
, W
);
57 #endif // _WX_MSW_CUSTOMBGWIN_H_