]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statbmp.cpp
updated xml project file with latest changes (spinctrl, display, msgout, ...)
[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)
1e6feb95
VZ
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#ifdef __GNUG__
a3870b2f 21 #pragma implementation "univstatbmp.h"
1e6feb95
VZ
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
46IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
47
48// ----------------------------------------------------------------------------
49// wxStaticBitmap
50// ----------------------------------------------------------------------------
51
52bool 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 // set bitmap first
64 SetBitmap(label);
65
66 // and adjust our size to fit it after this
67 SetBestSize(size);
68
69 return TRUE;
70}
71
72// ----------------------------------------------------------------------------
73// bitmap/icon setting/getting and converting between
74// ----------------------------------------------------------------------------
75
76void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
77{
78 m_bitmap = bitmap;
79}
80
81void wxStaticBitmap::SetIcon(const wxIcon& icon)
82{
83#ifdef __WXMSW__
84 m_bitmap.CopyFromIcon(icon);
85#else
86 m_bitmap = (const wxBitmap&)icon;
87#endif
88}
89
90wxIcon wxStaticBitmap::GetIcon() const
91{
92 wxIcon icon;
93#ifdef __WXMSW__
94 icon.CopyFromBitmap(m_bitmap);
95#else
96 icon = (const wxIcon&)m_bitmap;
97#endif
98 return icon;
99}
100
101// ----------------------------------------------------------------------------
102// drawing
103// ----------------------------------------------------------------------------
104
105void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
106{
107 wxControl::DoDraw(renderer);
108 renderer->DrawBitmap(GetBitmap());
109}
110
111#endif // wxUSE_STATBMP
112