]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/statbmp.cpp
removed unused variables
[wxWidgets.git] / src / mac / carbon / statbmp.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: statbmp.cpp
3 // Purpose: wxStaticBitmap
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "statbmp.h"
14 #endif
15
16 #include "wx/statbmp.h"
17
18 #if !USE_SHARED_LIBRARY
19 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
20 #endif
21
22 /*
23 * wxStaticBitmap
24 */
25
26 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
27 EVT_PAINT(wxStaticBitmap::OnPaint)
28 END_EVENT_TABLE()
29
30 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
31 const wxBitmap& bitmap,
32 const wxPoint& pos,
33 const wxSize& s,
34 long style,
35 const wxString& name)
36 {
37 SetName(name);
38 wxSize size = s ;
39
40 m_backgroundColour = parent->GetBackgroundColour() ;
41 m_foregroundColour = parent->GetForegroundColour() ;
42
43 m_messageBitmap = bitmap;
44
45 if ( id == -1 )
46 m_windowId = (int)NewControlId();
47 else
48 m_windowId = id;
49
50 m_windowStyle = style;
51
52 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
53 SetSizeOrDefault( size ) ;
54
55 return ret;
56 }
57
58 void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
59 {
60 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
61 }
62
63 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
64 {
65 m_messageBitmap = bitmap;
66 SetSizeOrDefault();
67 }
68 void wxStaticBitmap::OnPaint( wxPaintEvent &event )
69 {
70 wxPaintDC dc(this);
71 PrepareDC(dc);
72 dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
73 dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
74 }
75
76 wxSize wxStaticBitmap::DoGetBestSize() const
77 {
78 if ( m_messageBitmap.Ok() )
79 return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
80 else
81 return wxSize(16, 16); // completely arbitrary
82 }
83