]> git.saurik.com Git - wxWidgets.git/blob - src/univ/statbmp.cpp
Fixed GetShapeList and similar methods to use OOR.
[wxWidgets.git] / src / univ / statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: univ/statbmp.cpp
3 // Purpose: wxStaticBitmap implementation
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 25.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "univstatbmp.h"
22 #endif
23
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #if wxUSE_STATBMP
31
32 #ifndef WX_PRECOMP
33 #include "wx/dc.h"
34 #include "wx/icon.h"
35 #include "wx/statbmp.h"
36 #include "wx/validate.h"
37 #endif
38
39 #include "wx/univ/renderer.h"
40 #include "wx/univ/theme.h"
41
42 // ============================================================================
43 // implementation
44 // ============================================================================
45
46 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
47
48 // ----------------------------------------------------------------------------
49 // wxStaticBitmap
50 // ----------------------------------------------------------------------------
51
52 bool wxStaticBitmap::Create(wxWindow *parent,
53 wxWindowID id,
54 const wxBitmap &label,
55 const wxPoint &pos,
56 const wxSize &size,
57 long style,
58 const wxString &name)
59 {
60 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
61 return FALSE;
62
63 m_hasDialogBackground = TRUE;
64
65 // set bitmap first
66 SetBitmap(label);
67
68 // and adjust our size to fit it after this
69 SetBestSize(size);
70
71 return TRUE;
72 }
73
74 // ----------------------------------------------------------------------------
75 // bitmap/icon setting/getting and converting between
76 // ----------------------------------------------------------------------------
77
78 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
79 {
80 m_bitmap = bitmap;
81 }
82
83 void wxStaticBitmap::SetIcon(const wxIcon& icon)
84 {
85 #ifdef __WXMSW__
86 m_bitmap.CopyFromIcon(icon);
87 #else
88 m_bitmap = (const wxBitmap&)icon;
89 #endif
90 }
91
92 wxIcon wxStaticBitmap::GetIcon() const
93 {
94 wxIcon icon;
95 #ifdef __WXMSW__
96 icon.CopyFromBitmap(m_bitmap);
97 #else
98 icon = (const wxIcon&)m_bitmap;
99 #endif
100 return icon;
101 }
102
103 // ----------------------------------------------------------------------------
104 // drawing
105 // ----------------------------------------------------------------------------
106
107 void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
108 {
109 wxControl::DoDraw(renderer);
110 renderer->DrawBitmap(GetBitmap());
111 }
112
113 #endif // wxUSE_STATBMP
114