added wxGenericStaticBitmap (#9608)
[wxWidgets.git] / src / generic / statbmpg.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/statbmp.cpp
3 // Purpose: wxGenericStaticBitmap
4 // Author: Marcin Wojdyr, Stefan Csomor
5 // Created: 2008-06-16
6 // RCS-ID: $Id$
7 // Copyright: wxWidgets developers
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #if wxUSE_STATBMP
14
15 #include "wx/generic/statbmpg.h"
16
17
18 IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase)
19
20 bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id,
21 const wxBitmap& bitmap,
22 const wxPoint& pos, const wxSize& size,
23 long style, const wxString& name)
24 {
25 if (! wxControl::Create(parent, id, pos, size, style,
26 wxDefaultValidator, name))
27 return false;
28 SetBitmap(bitmap);
29 Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticBitmap::OnPaint));
30 return true;
31 }
32
33 void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
34 {
35 wxPaintDC dc(this);
36 PrepareDC(dc);
37 if (m_bitmap.Ok())
38 dc.DrawBitmap(m_bitmap, 0, 0, true);
39 }
40
41 #endif // wxUSE_STATBMP
42