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