]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/statbmpg.h
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / include / wx / generic / statbmpg.h
CommitLineData
a30e7029
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/generic/statbmpg.h
3// Purpose: wxGenericStaticBitmap header
4// Author: Marcin Wojdyr, Stefan Csomor
5// Created: 2008-06-16
a30e7029
VZ
6// Copyright: wxWidgets developers
7// Licence: wxWindows licence
8///////////////////////////////////////////////////////////////////////////////
9
10#ifndef _WX_GENERIC_STATBMP_H_
11#define _WX_GENERIC_STATBMP_H_
12
13#include "wx/statbmp.h"
14
15class WXDLLIMPEXP_CORE wxGenericStaticBitmap : public wxStaticBitmapBase
16{
17public:
18 wxGenericStaticBitmap() {}
19 wxGenericStaticBitmap(wxWindow *parent,
20 wxWindowID id,
21 const wxBitmap& bitmap,
22 const wxPoint& pos = wxDefaultPosition,
23 const wxSize& size = wxDefaultSize,
24 long style = 0,
25 const wxString& name = wxStaticBitmapNameStr)
26 {
27 Create(parent, id, bitmap, pos, size, style, name);
28 }
29
30 bool Create(wxWindow *parent,
31 wxWindowID id,
32 const wxBitmap& bitmap,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = 0,
36 const wxString& name = wxStaticBitmapNameStr);
37
38 virtual void SetBitmap(const wxBitmap& bitmap)
39 {
40 m_bitmap = bitmap;
41 SetInitialSize(GetBitmapSize());
42 Refresh();
43 }
44
45 virtual wxBitmap GetBitmap() const { return m_bitmap; }
46
03647350
VZ
47 virtual void SetIcon(const wxIcon& icon)
48 {
49 m_bitmap.CopyFromIcon(icon);
a30e7029
VZ
50 SetInitialSize(GetBitmapSize());
51 Refresh();
52 }
53
54#if defined(__WXGTK20__) || defined(__WXMAC__)
55 // icons and bitmaps are really the same thing in wxGTK and wxMac
56 wxIcon GetIcon() const { return (const wxIcon &)m_bitmap; }
57#endif
58
59
60private:
03647350 61 wxSize GetBitmapSize()
a30e7029 62 {
a1b806b9 63 return m_bitmap.IsOk() ? wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight())
a30e7029
VZ
64 : wxSize(16, 16); // this is completely arbitrary
65 }
66
67 void OnPaint(wxPaintEvent& event);
68
69 wxBitmap m_bitmap;
70
71 DECLARE_DYNAMIC_CLASS(wxGenericStaticBitmap)
72};
73
74
75#endif //_WX_GENERIC_STATBMP_H_