]>
git.saurik.com Git - wxWidgets.git/blob - src/mac/statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStaticBitmap
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "statbmp.h"
16 #include "wx/statbmp.h"
18 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
24 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxControl
)
25 EVT_PAINT(wxStaticBitmap::OnPaint
)
28 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
29 const wxBitmap
& bitmap
,
37 m_backgroundColour
= parent
->GetBackgroundColour() ;
38 m_foregroundColour
= parent
->GetForegroundColour() ;
40 m_messageBitmap
= bitmap
;
43 m_windowId
= (int)NewControlId();
47 m_windowStyle
= style
;
49 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
56 void wxStaticBitmap::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
58 wxControl::SetSize( x
, y
, width
, height
, sizeFlags
) ;
61 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
63 m_messageBitmap
= bitmap
;
66 void wxStaticBitmap::OnPaint( wxPaintEvent
&event
)
70 dc
.SetPalette( *m_messageBitmap
.GetPalette() ) ;
71 dc
.DrawBitmap( m_messageBitmap
, 0 , 0 ) ;
74 wxSize
wxStaticBitmap::DoGetBestSize() const
76 if ( m_messageBitmap
.Ok() )
77 return wxSize(m_messageBitmap
.GetWidth(), m_messageBitmap
.GetHeight());
79 return wxSize(16, 16); // completely arbitrary