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