]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statbmp.cpp
use const char*, not char*, for embedded XPMs to fix gcc warnings
[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
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
e267406e
WS
28#include "wx/statbmp.h"
29
1e6feb95
VZ
30#ifndef WX_PRECOMP
31 #include "wx/dc.h"
32 #include "wx/icon.h"
1e6feb95
VZ
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
43IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
44
45// ----------------------------------------------------------------------------
46// wxStaticBitmap
47// ----------------------------------------------------------------------------
48
49bool wxStaticBitmap::Create(wxWindow *parent,
50 wxWindowID id,
51 const wxBitmap &label,
52 const wxPoint &pos,
53 const wxSize &size,
54 long style,
55 const wxString &name)
56{
57 if ( !wxControl::Create(parent, id, pos, size, style, wxDefaultValidator, name) )
a290fa5a 58 return false;
1e6feb95
VZ
59
60 // set bitmap first
61 SetBitmap(label);
62
63 // and adjust our size to fit it after this
170acdc9 64 SetInitialSize(size);
1e6feb95 65
a290fa5a 66 return true;
1e6feb95
VZ
67}
68
69// ----------------------------------------------------------------------------
70// bitmap/icon setting/getting and converting between
71// ----------------------------------------------------------------------------
72
73void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
74{
75 m_bitmap = bitmap;
76}
77
78void wxStaticBitmap::SetIcon(const wxIcon& icon)
79{
80#ifdef __WXMSW__
81 m_bitmap.CopyFromIcon(icon);
82#else
83 m_bitmap = (const wxBitmap&)icon;
84#endif
85}
86
87wxIcon wxStaticBitmap::GetIcon() const
88{
89 wxIcon icon;
90#ifdef __WXMSW__
91 icon.CopyFromBitmap(m_bitmap);
92#else
93 icon = (const wxIcon&)m_bitmap;
94#endif
95 return icon;
96}
97
98// ----------------------------------------------------------------------------
99// drawing
100// ----------------------------------------------------------------------------
101
102void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
103{
104 wxControl::DoDraw(renderer);
105 renderer->DrawBitmap(GetBitmap());
106}
107
108#endif // wxUSE_STATBMP