1
//////////////////////////////////////////////////////////////////////////
3
// pgAdmin III - PostgreSQL Tools
5
// Portions Copyright (C) 1998 - 2011, Julian Smart
6
// Portions Copyright (C) 2011, The pgAdmin Development Team
7
// This software is released under the PostgreSQL Licence
9
// bmpshape.cpp - Bitmap shape class
11
//////////////////////////////////////////////////////////////////////////
22
IMPLEMENT_DYNAMIC_CLASS(wxBitmapShape, wxRectangleShape)
24
wxBitmapShape::wxBitmapShape(): wxRectangleShape(100.0, 50.0)
26
m_filename = wxEmptyString;
29
wxBitmapShape::~wxBitmapShape()
33
void wxBitmapShape::OnDraw(wxDC &dc)
39
x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
40
y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
41
dc.DrawBitmap(m_bitmap, (int) x, (int) y, true);
44
void wxBitmapShape::SetSize(double w, double h, bool WXUNUSED(recursive))
48
w = m_bitmap.GetWidth();
49
h = m_bitmap.GetHeight();
52
SetAttachmentSize(w, h);
56
SetDefaultRegionSize();
60
void wxBitmapShape::WriteAttributes(wxExpr *clause)
62
// Can't really save the bitmap; so instantiate the bitmap
63
// at a higher level in the application, from a symbol library.
64
wxRectangleShape::WriteAttributes(clause);
65
clause->AddAttributeValueString(_T("filename"), m_filename);
68
void wxBitmapShape::ReadAttributes(wxExpr *clause)
70
wxRectangleShape::ReadAttributes(clause);
71
clause->GetAttributeValue(_T("filename"), m_filename);
75
// Does the copying for this object
76
void wxBitmapShape::Copy(wxShape ©)
78
wxRectangleShape::Copy(copy);
80
wxASSERT( copy.IsKindOf(CLASSINFO(wxBitmapShape)) ) ;
82
wxBitmapShape &bitmapCopy = (wxBitmapShape &) copy;
84
bitmapCopy.m_bitmap = m_bitmap;
85
bitmapCopy.SetFilename(m_filename);
88
void wxBitmapShape::SetBitmap(const wxBitmap &bm)
92
SetSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());