]>
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"
17 #include "wx/dcclient.h"
19 #if !USE_SHARED_LIBRARY
20 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap
, wxControl
)
27 BEGIN_EVENT_TABLE(wxStaticBitmap
, wxControl
)
28 EVT_PAINT(wxStaticBitmap::OnPaint
)
31 bool wxStaticBitmap::Create(wxWindow
*parent
, wxWindowID id
,
32 const wxBitmap
& bitmap
,
41 m_backgroundColour
= parent
->GetBackgroundColour() ;
42 m_foregroundColour
= parent
->GetForegroundColour() ;
44 m_messageBitmap
= bitmap
;
47 m_windowId
= (int)NewControlId();
51 m_windowStyle
= style
;
53 bool ret
= wxControl::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
);
54 SetSizeOrDefault( size
) ;
59 void wxStaticBitmap::SetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
61 wxControl::SetSize( x
, y
, width
, height
, sizeFlags
) ;
64 void wxStaticBitmap::SetBitmap(const wxBitmap
& bitmap
)
66 m_messageBitmap
= bitmap
;
69 void wxStaticBitmap::OnPaint( wxPaintEvent
&event
)
73 dc
.SetPalette( *m_messageBitmap
.GetPalette() ) ;
74 dc
.DrawBitmap( m_messageBitmap
, 0 , 0 ) ;
77 wxSize
wxStaticBitmap::DoGetBestSize() const
79 if ( m_messageBitmap
.Ok() )
80 return wxSize(m_messageBitmap
.GetWidth(), m_messageBitmap
.GetHeight());
82 return wxSize(16, 16); // completely arbitrary