]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statbmp.cpp
cleanup - reformat
[wxWidgets.git] / src / univ / statbmp.cpp
CommitLineData
1e6feb95
VZ
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$
442b35b5 8// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 9// Licence: wxWindows licence
1e6feb95
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
1e6feb95
VZ
20#include "wx/wxprec.h"
21
22#ifdef __BORLANDC__
23 #pragma hdrstop
24#endif
25
26#if wxUSE_STATBMP
27
28#ifndef WX_PRECOMP
29 #include "wx/dc.h"
30 #include "wx/icon.h"
31 #include "wx/statbmp.h"
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
42IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
43
44// ----------------------------------------------------------------------------
45// wxStaticBitmap
46// ----------------------------------------------------------------------------
47
48bool wxStaticBitmap::Create(wxWindow *parent,
49 wxWindowID id,
50 const wxBitmap &label,
51 const wxPoint &pos,
52 const wxSize &size,
53 long style,
54 const wxString &name)
55{
56 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
a290fa5a 57 return false;
1e6feb95
VZ
58
59 // set bitmap first
60 SetBitmap(label);
61
62 // and adjust our size to fit it after this
63 SetBestSize(size);
64
a290fa5a 65 return true;
1e6feb95
VZ
66}
67
68// ----------------------------------------------------------------------------
69// bitmap/icon setting/getting and converting between
70// ----------------------------------------------------------------------------
71
72void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
73{
74 m_bitmap = bitmap;
75}
76
77void wxStaticBitmap::SetIcon(const wxIcon& icon)
78{
79#ifdef __WXMSW__
80 m_bitmap.CopyFromIcon(icon);
81#else
82 m_bitmap = (const wxBitmap&)icon;
83#endif
84}
85
86wxIcon wxStaticBitmap::GetIcon() const
87{
88 wxIcon icon;
89#ifdef __WXMSW__
90 icon.CopyFromBitmap(m_bitmap);
91#else
92 icon = (const wxIcon&)m_bitmap;
93#endif
94 return icon;
95}
96
97// ----------------------------------------------------------------------------
98// drawing
99// ----------------------------------------------------------------------------
100
101void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
102{
103 wxControl::DoDraw(renderer);
104 renderer->DrawBitmap(GetBitmap());
105}
106
107#endif // wxUSE_STATBMP
108