| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/generic/statbmpg.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 | #ifndef WX_PRECOMP |
| 16 | #include "wx/dcclient.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/generic/statbmpg.h" |
| 20 | |
| 21 | bool wxGenericStaticBitmap::Create(wxWindow *parent, wxWindowID id, |
| 22 | const wxBitmap& bitmap, |
| 23 | const wxPoint& pos, const wxSize& size, |
| 24 | long style, const wxString& name) |
| 25 | { |
| 26 | if (! wxControl::Create(parent, id, pos, size, style, |
| 27 | wxDefaultValidator, name)) |
| 28 | return false; |
| 29 | SetBitmap(bitmap); |
| 30 | Connect(wxEVT_PAINT, wxPaintEventHandler(wxGenericStaticBitmap::OnPaint)); |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event)) |
| 35 | { |
| 36 | wxPaintDC dc(this); |
| 37 | if (m_bitmap.IsOk()) |
| 38 | dc.DrawBitmap(m_bitmap, 0, 0, true); |
| 39 | } |
| 40 | |
| 41 | // under OSX_cocoa is a define, avoid duplicate info |
| 42 | #ifndef wxGenericStaticBitmap |
| 43 | |
| 44 | IMPLEMENT_DYNAMIC_CLASS(wxGenericStaticBitmap, wxStaticBitmapBase) |
| 45 | |
| 46 | #endif |
| 47 | |
| 48 | #endif // wxUSE_STATBMP |
| 49 | |