]> git.saurik.com Git - wxWidgets.git/blame - src/msw/panel.cpp
More understandable symbolic constants in generic wxDVC's DoJob class.
[wxWidgets.git] / src / msw / panel.cpp
CommitLineData
5b87bd6c
VZ
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
55a40ad9 27 #include "wx/bitmap.h"
cd95f7e6 28 #include "wx/brush.h"
5b87bd6c
VZ
29 #include "wx/panel.h"
30#endif // WX_PRECOMP
31
32// ============================================================================
33// implementation
34// ============================================================================
35
05d65177
VZ
36wxPanel::~wxPanel()
37{
38 delete m_backgroundBrush;
39}
40
5b87bd6c
VZ
41bool wxPanel::HasTransparentBackground()
42{
43 for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
44 {
45 if ( win->MSWHasInheritableBackground() )
46 return true;
47
48 if ( win->IsTopLevel() )
49 break;
50 }
51
52 return false;
53}
cd95f7e6
VZ
54
55void wxPanel::DoSetBackgroundBitmap(const wxBitmap& bmp)
56{
57 delete m_backgroundBrush;
58 m_backgroundBrush = bmp.IsOk() ? new wxBrush(bmp) : NULL;
af2fdacd
VZ
59
60 // Our transparent children should use our background if we have it,
61 // otherwise try to restore m_inheritBgCol to some reasonable value: true
62 // if we also have non-default background colour or false otherwise.
63 m_inheritBgCol = bmp.IsOk() || UseBgCol();
cd95f7e6
VZ
64}
65
66WXHBRUSH wxPanel::MSWGetCustomBgBrush()
67{
68 if ( m_backgroundBrush )
69 return (WXHBRUSH)m_backgroundBrush->GetResourceHandle();
70
71 return wxPanelBase::MSWGetCustomBgBrush();
72}