]> git.saurik.com Git - wxWidgets.git/blob - src/msw/panel.cpp
Fix the build system in gtk, plus a couple of compilation errors. wxWebView now succe...
[wxWidgets.git] / src / msw / panel.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/panel.cpp
3 // Purpose: Implementation of wxMSW-specific wxPanel class.
4 // Author: Vadim Zeitlin
5 // Created: 2011-03-18
6 // RCS-ID: $Id: wxhead.cpp,v 1.11 2010-04-22 12:44:51 zeitlin Exp $
7 // Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #ifndef WX_PRECOMP
27 #include "wx/bitmap.h"
28 #include "wx/brush.h"
29 #include "wx/panel.h"
30 #endif // WX_PRECOMP
31
32 // ============================================================================
33 // implementation
34 // ============================================================================
35
36 bool wxPanel::HasTransparentBackground()
37 {
38 for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
39 {
40 if ( win->MSWHasInheritableBackground() )
41 return true;
42
43 if ( win->IsTopLevel() )
44 break;
45 }
46
47 return false;
48 }
49
50 void wxPanel::DoSetBackgroundBitmap(const wxBitmap& bmp)
51 {
52 delete m_backgroundBrush;
53 m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL;
54
55 // Our transparent children should use our background if we have it,
56 // otherwise try to restore m_inheritBgCol to some reasonable value: true
57 // if we also have non-default background colour or false otherwise.
58 m_inheritBgCol = bmp.IsOk() || UseBgCol();
59 }
60
61 WXHBRUSH wxPanel::MSWGetCustomBgBrush()
62 {
63 if ( m_backgroundBrush )
64 return (WXHBRUSH)m_backgroundBrush->GetResourceHandle();
65
66 return wxPanelBase::MSWGetCustomBgBrush();
67 }