]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/carbon/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/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"
26 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxStaticBitmapBase
)
27 EVT_PAINT(wxStaticBitmap::OnPaint
)
30 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
31 const wxBitmap
& bitmap
,
39 m_backgroundColour
= parent
->GetBackgroundColour() ;
40 m_foregroundColour
= parent
->GetForegroundColour() ;
44 m_windowId
= (int)NewControlId();
48 m_windowStyle
= style
;
50 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
51 SetInitialSize( size
) ;
56 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
60 SetSize(GetBestSize());
64 void wxStaticBitmap::OnPaint( wxPaintEvent
& WXUNUSED(event
) )
71 dc
.DrawBitmap( m_bitmap
, 0 , 0 , TRUE
) ;
75 wxSize
wxStaticBitmap::DoGetBestSize() const
78 return DoGetSizeFromClientSize( wxSize(m_bitmap
.GetWidth(), m_bitmap
.GetHeight()) );
80 // this is completely arbitrary
81 return DoGetSizeFromClientSize( wxSize(16, 16) );