]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/statbmp.cpp
3 // Purpose: wxStaticBitmap
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/statbmp.h"
19 #include "wx/dcclient.h"
22 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
28 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxStaticBitmapBase
)
29 EVT_PAINT(wxStaticBitmap::OnPaint
)
32 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
33 const wxBitmap
& bitmap
,
41 m_backgroundColour
= parent
->GetBackgroundColour() ;
42 m_foregroundColour
= parent
->GetForegroundColour() ;
46 m_windowId
= (int)NewControlId();
50 m_windowStyle
= style
;
52 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
53 SetInitialSize( size
) ;
58 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
62 SetSize(GetBestSize());
66 void wxStaticBitmap::OnPaint( wxPaintEvent
& WXUNUSED(event
) )
73 dc
.DrawBitmap( m_bitmap
, 0 , 0 , TRUE
) ;
77 wxSize
wxStaticBitmap::DoGetBestSize() const
80 return DoGetSizeFromClientSize( wxSize(m_bitmap
.GetWidth(), m_bitmap
.GetHeight()) );
82 // this is completely arbitrary
83 return DoGetSizeFromClientSize( wxSize(16, 16) );