]> git.saurik.com Git - wxWidgets.git/blob - src/univ/statbmp.cpp
No real changes, just fix some typos in comments in wxMSW code.
[wxWidgets.git] / src / univ / statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/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 licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #if wxUSE_STATBMP
27
28 #include "wx/statbmp.h"
29
30 #ifndef WX_PRECOMP
31 #include "wx/dc.h"
32 #include "wx/icon.h"
33 #include "wx/validate.h"
34 #endif
35
36 #include "wx/univ/renderer.h"
37 #include "wx/univ/theme.h"
38
39 // ============================================================================
40 // implementation
41 // ============================================================================
42
43 // ----------------------------------------------------------------------------
44 // wxStaticBitmap
45 // ----------------------------------------------------------------------------
46
47 bool wxStaticBitmap::Create(wxWindow *parent,
48 wxWindowID id,
49 const wxBitmap &label,
50 const wxPoint &pos,
51 const wxSize &size,
52 long style,
53 const wxString &name)
54 {
55 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
56 return false;
57
58 // set bitmap first
59 SetBitmap(label);
60
61 // and adjust our size to fit it after this
62 SetInitialSize(size);
63
64 return true;
65 }
66
67 // ----------------------------------------------------------------------------
68 // bitmap/icon setting/getting and converting between
69 // ----------------------------------------------------------------------------
70
71 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
72 {
73 m_bitmap = bitmap;
74 }
75
76 void wxStaticBitmap::SetIcon(const wxIcon& icon)
77 {
78 #ifdef __WXMSW__
79 m_bitmap.CopyFromIcon(icon);
80 #else
81 m_bitmap = (const wxBitmap&)icon;
82 #endif
83 }
84
85 wxIcon wxStaticBitmap::GetIcon() const
86 {
87 wxIcon icon;
88 #ifdef __WXMSW__
89 icon.CopyFromBitmap(m_bitmap);
90 #else
91 icon = (const wxIcon&)m_bitmap;
92 #endif
93 return icon;
94 }
95
96 // ----------------------------------------------------------------------------
97 // drawing
98 // ----------------------------------------------------------------------------
99
100 void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
101 {
102 wxControl::DoDraw(renderer);
103 renderer->DrawBitmap(GetBitmap());
104 }
105
106 #endif // wxUSE_STATBMP