]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/statbmp.cpp
visibility changed code fixed
[wxWidgets.git] / src / mac / carbon / statbmp.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: statbmp.cpp
3// Purpose: wxStaticBitmap
a31a5f85 4// Author: Stefan Csomor
e9576ca5 5// Modified by:
a31a5f85 6// Created: 1998-01-01
e9576ca5 7// RCS-ID: $Id$
a31a5f85 8// Copyright: (c) Stefan Csomor
e40298d5 9// Licence: wxWindows licence
e9576ca5
SC
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
b698c8e9 13 #pragma implementation "statbmp.h"
e9576ca5
SC
14#endif
15
d8c736e5
GD
16#include "wx/defs.h"
17
e9576ca5 18#include "wx/statbmp.h"
03e11df5 19#include "wx/dcclient.h"
e9576ca5 20
2f1ae414 21#if !USE_SHARED_LIBRARY
90b959ae 22IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
2f1ae414 23#endif
e9576ca5
SC
24
25/*
26 * wxStaticBitmap
27 */
28
584bede0 29BEGIN_EVENT_TABLE(wxStaticBitmap, wxStaticBitmapBase)
519cb848
SC
30 EVT_PAINT(wxStaticBitmap::OnPaint)
31END_EVENT_TABLE()
32
e9576ca5
SC
33bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
34 const wxBitmap& bitmap,
35 const wxPoint& pos,
2f1ae414 36 const wxSize& s,
e9576ca5
SC
37 long style,
38 const wxString& name)
39{
e9576ca5 40 SetName(name);
e40298d5
JS
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() ;
16106d96 48 }
7c551d95
SC
49
50 m_backgroundColour = parent->GetBackgroundColour() ;
51 m_foregroundColour = parent->GetForegroundColour() ;
52
584bede0 53 m_bitmap = bitmap;
e9576ca5 54 if ( id == -1 )
e40298d5 55 m_windowId = (int)NewControlId();
e9576ca5 56 else
e40298d5 57 m_windowId = id;
e9576ca5
SC
58
59 m_windowStyle = style;
60
37e2cb08 61 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
e40298d5 62 SetBestSize( size ) ;
7c551d95 63
519cb848 64 return ret;
e9576ca5
SC
65}
66
e9576ca5
SC
67void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
68{
584bede0 69 m_bitmap = bitmap;
16106d96 70 SetSize(wxSize(bitmap.GetWidth(), bitmap.GetHeight()));
2883443e 71 Refresh() ;
519cb848 72}
3dec57ad 73
eb22f2a6 74void wxStaticBitmap::OnPaint( wxPaintEvent& WXUNUSED(event) )
519cb848
SC
75{
76 wxPaintDC dc(this);
77 PrepareDC(dc);
3dec57ad 78
584bede0 79 dc.DrawBitmap( m_bitmap , 0 , 0 , TRUE ) ;
7c551d95
SC
80}
81
82wxSize wxStaticBitmap::DoGetBestSize() const
83{
16106d96 84 return wxWindow::DoGetBestSize() ;
e9576ca5
SC
85}
86