]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbmp.cpp
redraw fixes
[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
12#ifdef __GNUG__
b698c8e9 13 #pragma implementation "statbmp.h"
e9576ca5
SC
14#endif
15
d8c736e5
GD
16#include "wx/defs.h"
17
e9576ca5 18#include "wx/statbmp.h"
03e11df5 19#include "wx/dcclient.h"
e9576ca5 20
2f1ae414 21#if !USE_SHARED_LIBRARY
90b959ae 22IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
2f1ae414 23#endif
e9576ca5
SC
24
25/*
26 * wxStaticBitmap
27 */
28
584bede0 29BEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase)
519cb848
SC
30 EVT_PAINT(wxStaticBitmap::OnPaint)
31END_EVENT_TABLE()
32
e9576ca5
SC
33bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
34 const wxBitmap& bitmap,
35 const wxPoint& pos,
982a831b 36 const wxSize& size,
e9576ca5
SC
37 long style,
38 const wxString& name)
39{
e9576ca5 40 SetName(name);
7c551d95
SC
41
42 m_backgroundColour = parent->GetBackgroundColour() ;
43 m_foregroundColour = parent->GetForegroundColour() ;
44
584bede0 45 m_bitmap = bitmap;
e9576ca5 46 if ( id == -1 )
e40298d5 47 m_windowId = (int)NewControlId();
e9576ca5 48 else
e40298d5 49 m_windowId = id;
e9576ca5
SC
50
51 m_windowStyle = style;
52
37e2cb08 53 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
e40298d5 54 SetBestSize( size ) ;
7c551d95 55
519cb848 56 return ret;
e9576ca5
SC
57}
58
e9576ca5
SC
59void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
60{
584bede0 61 m_bitmap = bitmap;
9f884528 62 InvalidateBestSize();
982a831b 63 SetSize(GetBestSize());
2883443e 64 Refresh() ;
519cb848 65}
3dec57ad 66
eb22f2a6 67void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
519cb848
SC
68{
69 wxPaintDC dc(this);
70 PrepareDC(dc);
3dec57ad 71
584bede0 72 dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ;
7c551d95
SC
73}
74
75wxSize wxStaticBitmap::DoGetBestSize() const
76{
982a831b 77 return DoGetSizeFromClientSize( wxSize( m_bitmap.GetWidth() , m_bitmap.GetHeight() ) ) ;
e9576ca5
SC
78}
79