]> git.saurik.com Git - wxWidgets.git/blame - src/mac/classic/statbmp.cpp
printing to CW console only for debug builds
[wxWidgets.git] / src / mac / classic / statbmp.cpp
CommitLineData
2646f485
SC
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
65571936 9// Licence: wxWindows licence
2646f485
SC
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#if !USE_SHARED_LIBRARY
22IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
23#endif
24
25/*
26 * wxStaticBitmap
27 */
28
29BEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase)
30 EVT_PAINT(wxStaticBitmap::OnPaint)
31END_EVENT_TABLE()
32
33bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
34 const wxBitmap& bitmap,
35 const wxPoint& pos,
36 const wxSize& s,
37 long style,
38 const wxString& name)
39{
40 SetName(name);
41 wxSize size = s ;
42 if ( bitmap.Ok() )
43 {
44 if ( size.x == -1 )
45 size.x = bitmap.GetWidth() ;
46 if ( size.y == -1 )
47 size.y = bitmap.GetHeight() ;
48 }
49
50 m_backgroundColour = parent->GetBackgroundColour() ;
51 m_foregroundColour = parent->GetForegroundColour() ;
52
53 m_bitmap = bitmap;
54 if ( id == -1 )
55 m_windowId = (int)NewControlId();
56 else
57 m_windowId = id;
58
59 m_windowStyle = style;
60
61 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
62 SetBestSize( size ) ;
63
64 return ret;
65}
66
67void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
68{
69 m_bitmap = bitmap;
9f884528 70 InvalidateBestSize();
2646f485
SC
71 SetSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
72 Refresh() ;
73}
74
75void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
76{
77 wxPaintDC dc(this);
78 PrepareDC(dc);
79
80 dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ;
81}
82
83wxSize wxStaticBitmap::DoGetBestSize() const
84{
85 return wxWindow::DoGetBestSize() ;
86}
87