]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/statbmp.cpp
1. added range checks in wxGridStringTable
[wxWidgets.git] / src / mac / statbmp.cpp
... / ...
CommitLineData
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
18IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
19
20/*
21 * wxStaticBitmap
22 */
23
24BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
25 EVT_PAINT(wxStaticBitmap::OnPaint)
26END_EVENT_TABLE()
27
28bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
29 const wxBitmap& bitmap,
30 const wxPoint& pos,
31 const wxSize& size,
32 long style,
33 const wxString& name)
34{
35 SetName(name);
36
37 m_backgroundColour = parent->GetBackgroundColour() ;
38 m_foregroundColour = parent->GetForegroundColour() ;
39
40 m_messageBitmap = bitmap;
41
42 if ( id == -1 )
43 m_windowId = (int)NewControlId();
44 else
45 m_windowId = id;
46
47 m_windowStyle = style;
48
49 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
50
51 SetSizeOrDefault() ;
52
53 return ret;
54}
55
56void wxStaticBitmap::SetSize(int x, int y, int width, int height, int sizeFlags)
57{
58 wxControl::SetSize( x , y , width , height , sizeFlags ) ;
59}
60
61void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
62{
63 m_messageBitmap = bitmap;
64 SetSizeOrDefault();
65}
66void wxStaticBitmap::OnPaint( wxPaintEvent &event )
67{
68 wxPaintDC dc(this);
69 PrepareDC(dc);
70 dc.SetPalette( *m_messageBitmap.GetPalette() ) ;
71 dc.DrawBitmap( m_messageBitmap , 0 , 0 ) ;
72}
73
74wxSize wxStaticBitmap::DoGetBestSize() const
75{
76 if ( m_messageBitmap.Ok() )
77 return wxSize(m_messageBitmap.GetWidth(), m_messageBitmap.GetHeight());
78 else
79 return wxSize(16, 16); // completely arbitrary
80}
81