1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/custombgwin.h
3 // Purpose: wxMSW implementation of wxCustomBackgroundWindow
4 // Author: Vadim Zeitlin
6 // RCS-ID: $Id: wxhead.h,v 1.12 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_CUSTOMBGWIN_H_
12 #define _WX_MSW_CUSTOMBGWIN_H_
14 #include "wx/bitmap.h"
17 // ----------------------------------------------------------------------------
18 // wxCustomBackgroundWindow
19 // ----------------------------------------------------------------------------
22 class wxCustomBackgroundWindow
: public W
,
23 public wxCustomBackgroundWindowBase
26 typedef W BaseWindowClass
;
28 wxCustomBackgroundWindow() { m_backgroundBrush
= NULL
; }
30 virtual ~wxCustomBackgroundWindow() { delete m_backgroundBrush
; }
33 virtual void DoSetBackgroundBitmap(const wxBitmap
& bmp
)
35 delete m_backgroundBrush
;
36 m_backgroundBrush
= bmp
.IsOk() ? new wxBrush(bmp
) : NULL
;
38 // Our transparent children should use our background if we have it,
39 // otherwise try to restore m_inheritBgCol to some reasonable value: true
40 // if we also have non-default background colour or false otherwise.
41 BaseWindowClass::m_inheritBgCol
= bmp
.IsOk()
42 || BaseWindowClass::UseBgCol();
45 virtual WXHBRUSH
MSWGetCustomBgBrush()
47 if ( m_backgroundBrush
)
48 return (WXHBRUSH
)m_backgroundBrush
->GetResourceHandle();
50 return BaseWindowClass::MSWGetCustomBgBrush();
53 wxBrush
*m_backgroundBrush
;
55 wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxCustomBackgroundWindow
, W
);
58 #endif // _WX_MSW_CUSTOMBGWIN_H_