]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
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"
17 #include "wx/dcclient.h"
19 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
25 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxStaticBitmapBase
)
26 EVT_PAINT(wxStaticBitmap::OnPaint
)
29 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
30 const wxBitmap
& bitmap
,
38 m_backgroundColour
= parent
->GetBackgroundColour() ;
39 m_foregroundColour
= parent
->GetForegroundColour() ;
43 m_windowId
= (int)NewControlId();
47 m_windowStyle
= style
;
49 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
55 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
59 SetSize(GetBestSize());
63 void wxStaticBitmap::OnPaint( wxPaintEvent
& WXUNUSED(event
) )
70 dc
.DrawBitmap( m_bitmap
, 0 , 0 , TRUE
) ;
74 wxSize
wxStaticBitmap::DoGetBestSize() const
77 return DoGetSizeFromClientSize( wxSize(m_bitmap
.GetWidth(), m_bitmap
.GetHeight()) );
79 // this is completely arbitrary
80 return DoGetSizeFromClientSize( wxSize(16, 16) );