]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/panelg.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/panelg.cpp
3 // Purpose: Generic wxPanel implementation.
4 // Author: Vadim Zeitlin
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 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
31 #ifdef wxHAS_GENERIC_PANEL
33 // ============================================================================
35 // ============================================================================
37 void wxPanel::DoSetBackgroundBitmap(const wxBitmap
& bmp
)
41 if ( m_bitmapBg
.IsOk() )
43 Connect(wxEVT_ERASE_BACKGROUND
,
44 wxEraseEventHandler(wxPanel::OnEraseBackground
));
48 Disconnect(wxEVT_ERASE_BACKGROUND
,
49 wxEraseEventHandler(wxPanel::OnEraseBackground
));
53 void wxPanel::OnEraseBackground(wxEraseEvent
& event
)
55 wxDC
& dc
= *event
.GetDC();
57 const wxSize clientSize
= GetClientSize();
58 const wxSize bitmapSize
= m_bitmapBg
.GetSize();
60 for ( int x
= 0; x
< clientSize
.x
; x
+= bitmapSize
.x
)
62 for ( int y
= 0; y
< clientSize
.y
; y
+= bitmapSize
.y
)
64 dc
.DrawBitmap(m_bitmapBg
, x
, y
);
69 #endif // wxHAS_GENERIC_PANEL