]>
git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/bitmap.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Bitmap shape class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "bitmap.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include <wx/wxprec.h>
28 #include <wx/wxexpr.h>
42 IMPLEMENT_DYNAMIC_CLASS(wxBitmapShape
, wxShape
)
44 wxBitmapShape::wxBitmapShape():wxRectangleShape(100.0, 50.0)
49 wxBitmapShape::~wxBitmapShape()
53 void wxBitmapShape::OnDraw(wxDC
& dc
)
59 tempDC
.SelectObject(m_bitmap
);
61 x
= (long)(m_xpos
- m_bitmap
.GetWidth() / 2.0);
62 y
= (long)(m_ypos
- m_bitmap
.GetHeight() / 2.0);
63 dc
.Blit(x
, y
, m_bitmap
.GetWidth(), m_bitmap
.GetHeight(), &tempDC
, 0, 0);
66 void wxBitmapShape::SetSize(float w
, float h
, bool recursive
)
70 w
= m_bitmap
.GetWidth();
71 h
= m_bitmap
.GetHeight();
74 SetAttachmentSize(w
, h
);
78 SetDefaultRegionSize();
82 // Prolog database stuff
83 char *wxBitmapShape::GetFunctor()
88 void wxBitmapShape::WritePrologAttributes(wxExpr
*clause
)
90 // Can't really save the bitmap; so instantiate the bitmap
91 // at a higher level in the application, from a symbol library.
92 wxRectangleShape::WritePrologAttributes(clause
);
93 clause
->AddAttributeValueString("filename", m_filename
);
96 void wxBitmapShape::ReadPrologAttributes(wxExpr
*clause
)
98 wxRectangleShape::ReadPrologAttributes(clause
);
99 clause
->GetAttributeValue("filename", m_filename
);
103 // Does the copying for this object
104 void wxBitmapShape::Copy(wxBitmapShape
& copy
)
106 wxRectangleShape::Copy(copy
);
107 copy
.m_bitmap
= m_bitmap
;
108 copy
.SetFilename(m_filename
);
111 // Returns a new instance, and does the copy for this class. Define for each class.
112 wxShape
*wxBitmapShape::PrivateCopy()
114 wxBitmapShape
*obj
= new wxBitmapShape
;
119 void wxBitmapShape::SetBitmap(const wxBitmap
& bm
)
123 SetSize(m_bitmap
.GetWidth(), m_bitmap
.GetHeight());