]>
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
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
15 #include "wx/statbmp.h"
18 #include "wx/dcclient.h"
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
);
50 SetInitialSize( size
) ;
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
76 if ( m_bitmap
.IsOk() )
77 return DoGetSizeFromClientSize( wxSize(m_bitmap
.GetWidth(), m_bitmap
.GetHeight()) );
79 // this is completely arbitrary
80 return DoGetSizeFromClientSize( wxSize(16, 16) );