]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbmp.cpp
Blind fixes for warnings in wxTinderbox.
[wxWidgets.git] / src / mac / carbon / statbmp.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.cpp
3// Purpose: wxStaticBitmap
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
65571936 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
3d1a4878 12#include "wx/wxprec.h"
d8c736e5 13
179e085f
RN
14#if wxUSE_STATBMP
15
e9576ca5 16#include "wx/statbmp.h"
03e11df5 17#include "wx/dcclient.h"
e9576ca5 18
90b959ae 19IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
e9576ca5
SC
20
21/*
22 * wxStaticBitmap
23 */
24
584bede0 25BEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase)
519cb848
SC
26 EVT_PAINT(wxStaticBitmap::OnPaint)
27END_EVENT_TABLE()
28
e9576ca5
SC
29bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
30 const wxBitmap& bitmap,
31 const wxPoint& pos,
982a831b 32 const wxSize& size,
e9576ca5
SC
33 long style,
34 const wxString& name)
35{
e9576ca5 36 SetName(name);
7c551d95
SC
37
38 m_backgroundColour = parent->GetBackgroundColour() ;
39 m_foregroundColour = parent->GetForegroundColour() ;
40
584bede0 41 m_bitmap = bitmap;
e9576ca5 42 if ( id == -1 )
e40298d5 43 m_windowId = (int)NewControlId();
e9576ca5 44 else
e40298d5 45 m_windowId = id;
e9576ca5
SC
46
47 m_windowStyle = style;
48
37e2cb08 49 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
e40298d5 50 SetBestSize( size ) ;
7c551d95 51
519cb848 52 return ret;
e9576ca5
SC
53}
54
e9576ca5
SC
55void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
56{
584bede0 57 m_bitmap = bitmap;
9f884528 58 InvalidateBestSize();
982a831b 59 SetSize(GetBestSize());
2883443e 60 Refresh() ;
519cb848 61}
3dec57ad 62
eb22f2a6 63void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
519cb848
SC
64{
65 wxPaintDC dc(this);
66 PrepareDC(dc);
3dec57ad 67
45aee08b
JS
68 if (m_bitmap.Ok())
69 {
70 dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ;
71 }
7c551d95
SC
72}
73
74wxSize wxStaticBitmap::DoGetBestSize() const
75{
0bf1e7cb
SC
76 if ( m_bitmap.Ok() )
77 return DoGetSizeFromClientSize( wxSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()) );
78
79 // this is completely arbitrary
80 return DoGetSizeFromClientSize( wxSize(16, 16) );
e9576ca5
SC
81}
82
179e085f
RN
83#endif
84