]> git.saurik.com Git - wxWidgets.git/blame - src/mac/statbmp.cpp
Added wxTreeCtrl::GetItemParent to deprecate GetParent.
[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__
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);
2f1ae414 41 wxSize size = s ;
16106d96
SC
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 }
7c551d95
SC
49
50 m_backgroundColour = parent->GetBackgroundColour() ;
51 m_foregroundColour = parent->GetForegroundColour() ;
52
584bede0 53 m_bitmap = bitmap;
e9576ca5
SC
54 if ( id == -1 )
55 m_windowId = (int)NewControlId();
56 else
57 m_windowId = id;
58
59 m_windowStyle = style;
60
37e2cb08 61 bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name );
584bede0 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
519cb848
SC
74void wxStaticBitmap::OnPaint( wxPaintEvent &event )
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