]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/statbmpg.h
insert missing iclude file
[wxWidgets.git] / include / wx / generic / statbmpg.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/statbmpg.h
3 // Purpose: wxGenericStaticBitmap header
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 #ifndef _WX_GENERIC_STATBMP_H_
12 #define _WX_GENERIC_STATBMP_H_
13
14 #include "wx/statbmp.h"
15
16 class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase
17 {
18 public:
19 wxGenericStaticBitmap() {}
20 wxGenericStaticBitmap(wxWindow *parent,
21 wxWindowID id,
22 const wxBitmap& bitmap,
23 const wxPoint& pos = wxDefaultPosition,
24 const wxSize& size = wxDefaultSize,
25 long style = 0,
26 const wxString& name = wxStaticBitmapNameStr)
27 {
28 Create(parent, id, bitmap, pos, size, style, name);
29 }
30
31 bool Create(wxWindow *parent,
32 wxWindowID id,
33 const wxBitmap& bitmap,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 long style = 0,
37 const wxString& name = wxStaticBitmapNameStr);
38
39 virtual void SetBitmap(const wxBitmap& bitmap)
40 {
41 m_bitmap = bitmap;
42 SetInitialSize(GetBitmapSize());
43 Refresh();
44 }
45
46 virtual wxBitmap GetBitmap() const { return m_bitmap; }
47
48 virtual void SetIcon(const wxIcon& icon)
49 {
50 m_bitmap.CopyFromIcon(icon);
51 SetInitialSize(GetBitmapSize());
52 Refresh();
53 }
54
55 #if defined(__WXGTK20__) || defined(__WXMAC__)
56 // icons and bitmaps are really the same thing in wxGTK and wxMac
57 wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; }
58 #endif
59
60
61 private:
62 wxSize GetBitmapSize()
63 {
64 return m_bitmap.Ok() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight())
65 : wxSize(16, 16); // this is completely arbitrary
66 }
67
68 void OnPaint(wxPaintEvent& event);
69
70 wxBitmap m_bitmap;
71
72 DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap)
73 };
74
75
76 #endif //_WX_GENERIC_STATBMP_H_