]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "statbmp.h"
16 #include "wx/wxprec.h"
18 #include "wx/statbmp.h"
19 #include "wx/dcclient.h"
21 #if !USE_SHARED_LIBRARY
22 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
29 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxStaticBitmapBase
)
30 EVT_PAINT(wxStaticBitmap::OnPaint
)
33 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
34 const wxBitmap
& bitmap
,
42 m_backgroundColour
= parent
->GetBackgroundColour() ;
43 m_foregroundColour
= parent
->GetForegroundColour() ;
47 m_windowId
= (int)NewControlId();
51 m_windowStyle
= style
;
53 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
59 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
63 SetSize(GetBestSize());
67 void wxStaticBitmap::OnPaint( wxPaintEvent
& WXUNUSED(event
) )
72 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) );