]> git.saurik.com Git - wxWidgets.git/blame - src/mac/statbmp.cpp
use GetText() instead of GetText(wxString&), made some methods inline
[wxWidgets.git] / src / mac / statbmp.cpp
CommitLineData
e9576ca5
SC
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"
03e11df5 17#include "wx/dcclient.h"
e9576ca5 18
2f1ae414 19#if !USE_SHARED_LIBRARY
e9576ca5 20IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
2f1ae414 21#endif
e9576ca5
SC
22
23/*
24 * wxStaticBitmap
25 */
26
519cb848
SC
27BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
28 EVT_PAINT(wxStaticBitmap::OnPaint)
29END_EVENT_TABLE()
30
e9576ca5
SC
31bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
32 const wxBitmap& bitmap,
33 const wxPoint& pos,
2f1ae414 34 const wxSize& s,
e9576ca5
SC
35 long style,
36 const wxString& name)
37{
e9576ca5 38 SetName(name);
2f1ae414 39 wxSize size = s ;
7c551d95
SC
40
41 m_backgroundColour = parent->GetBackgroundColour() ;
42 m_foregroundColour = parent->GetForegroundColour() ;
43
44 m_messageBitmap = bitmap;
e9576ca5
SC
45 if ( id == -1 )
46 m_windowId = (int)NewControlId();
47 else
48 m_windowId = id;
49
50 m_windowStyle = style;
51
37e2cb08 52 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
2f1ae414 53 SetSizeOrDefault( size ) ;
7c551d95 54
519cb848 55 return ret;
e9576ca5
SC
56}
57
58void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
59{
519cb848 60 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
e9576ca5
SC
61}
62
63void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
64{
65 m_messageBitmap = bitmap;
2883443e 66 Refresh() ;
7c551d95 67 SetSizeOrDefault();
519cb848 68}
3dec57ad 69
519cb848
SC
70void wxStaticBitmap::OnPaint( wxPaintEvent &event )
71{
72 wxPaintDC dc(this);
73 PrepareDC(dc);
3dec57ad
SC
74
75 dc.DrawBitmap( m_messageBitmap , 0 , 0 , TRUE ) ;
7c551d95
SC
76}
77
78wxSize wxStaticBitmap::DoGetBestSize() const
79{
3dec57ad
SC
80 if ( m_messageBitmap.Ok() )
81 return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
82 else
83 return wxSize(16, 16); // completely arbitrary
e9576ca5
SC
84}
85