]> git.saurik.com Git - wxWidgets.git/blame - src/univ/statbmp.cpp
Set the file name for temporary wxFFile objects.
[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
1e6feb95
VZ
43// ----------------------------------------------------------------------------
44// wxStaticBitmap
45// ----------------------------------------------------------------------------
46
47bool 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) )
a290fa5a 56 return false;
1e6feb95
VZ
57
58 // set bitmap first
59 SetBitmap(label);
60
61 // and adjust our size to fit it after this
170acdc9 62 SetInitialSize(size);
1e6feb95 63
a290fa5a 64 return true;
1e6feb95
VZ
65}
66
67// ----------------------------------------------------------------------------
68// bitmap/icon setting/getting and converting between
69// ----------------------------------------------------------------------------
70
71void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
72{
73 m_bitmap = bitmap;
74}
75
76void 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
85wxIcon 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
100void wxStaticBitmap::DoDraw(wxControlRenderer *renderer)
101{
102 wxControl::DoDraw(renderer);
103 renderer->DrawBitmap(GetBitmap());
104}
105
106#endif // wxUSE_STATBMP