Renamed bitmap.cpp to bmpshape.cpp to aid debugging
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
123
utils/ogl/src/bmpshape.cpp
Normal file
123
utils/ogl/src/bmpshape.cpp
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bmpshape.cpp
|
||||||
|
// Purpose: Bitmap shape class
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "bmpshape.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include <wx/wxprec.h>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROLOGIO
|
||||||
|
#include <wx/wxexpr.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "basic.h"
|
||||||
|
#include "basicp.h"
|
||||||
|
#include "canvas.h"
|
||||||
|
#include "bmpshape.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bitmap object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapShape, wxShape)
|
||||||
|
|
||||||
|
wxBitmapShape::wxBitmapShape():wxRectangleShape(100.0, 50.0)
|
||||||
|
{
|
||||||
|
m_filename = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmapShape::~wxBitmapShape()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapShape::OnDraw(wxDC& dc)
|
||||||
|
{
|
||||||
|
if (!m_bitmap.Ok())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxMemoryDC tempDC;
|
||||||
|
tempDC.SelectObject(m_bitmap);
|
||||||
|
double x, y;
|
||||||
|
x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
|
||||||
|
y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
|
||||||
|
dc.Blit(x, y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), &tempDC, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapShape::SetSize(double w, double h, bool recursive)
|
||||||
|
{
|
||||||
|
if (m_bitmap.Ok())
|
||||||
|
{
|
||||||
|
w = m_bitmap.GetWidth();
|
||||||
|
h = m_bitmap.GetHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
SetAttachmentSize(w, h);
|
||||||
|
|
||||||
|
m_width = w;
|
||||||
|
m_height = h;
|
||||||
|
SetDefaultRegionSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PROLOGIO
|
||||||
|
// Prolog database stuff
|
||||||
|
char *wxBitmapShape::GetFunctor()
|
||||||
|
{
|
||||||
|
return "node_image";
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapShape::WritePrologAttributes(wxExpr *clause)
|
||||||
|
{
|
||||||
|
// Can't really save the bitmap; so instantiate the bitmap
|
||||||
|
// at a higher level in the application, from a symbol library.
|
||||||
|
wxRectangleShape::WritePrologAttributes(clause);
|
||||||
|
clause->AddAttributeValueString("filename", m_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapShape::ReadPrologAttributes(wxExpr *clause)
|
||||||
|
{
|
||||||
|
wxRectangleShape::ReadPrologAttributes(clause);
|
||||||
|
clause->GetAttributeValue("filename", m_filename);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Does the copying for this object
|
||||||
|
void wxBitmapShape::Copy(wxShape& copy)
|
||||||
|
{
|
||||||
|
wxRectangleShape::Copy(copy);
|
||||||
|
|
||||||
|
wxASSERT( copy.IsKindOf(CLASSINFO(wxBitmapShape)) ) ;
|
||||||
|
|
||||||
|
wxBitmapShape& bitmapCopy = (wxBitmapShape&) copy;
|
||||||
|
|
||||||
|
bitmapCopy.m_bitmap = m_bitmap;
|
||||||
|
bitmapCopy.SetFilename(m_filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBitmapShape::SetBitmap(const wxBitmap& bm)
|
||||||
|
{
|
||||||
|
m_bitmap = bm;
|
||||||
|
if (m_bitmap.Ok())
|
||||||
|
SetSize(m_bitmap.GetWidth(), m_bitmap.GetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
54
utils/ogl/src/bmpshape.h
Normal file
54
utils/ogl/src/bmpshape.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: bmpshape.h
|
||||||
|
// Purpose: wxBitmapShape
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12/07/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _OGL_BITMAP_H_
|
||||||
|
#define _OGL_BITMAP_H_
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface "bmpshape.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "basic.h"
|
||||||
|
|
||||||
|
class wxBitmapShape: public wxRectangleShape
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxBitmapShape)
|
||||||
|
public:
|
||||||
|
wxBitmapShape();
|
||||||
|
~wxBitmapShape();
|
||||||
|
|
||||||
|
void OnDraw(wxDC& dc);
|
||||||
|
|
||||||
|
#ifdef PROLOGIO
|
||||||
|
// Prolog database stuff
|
||||||
|
char *GetFunctor();
|
||||||
|
void WritePrologAttributes(wxExpr *clause);
|
||||||
|
void ReadPrologAttributes(wxExpr *clause);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Does the copying for this object
|
||||||
|
void Copy(wxShape& copy);
|
||||||
|
|
||||||
|
void SetSize(double w, double h, bool recursive = TRUE);
|
||||||
|
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
|
||||||
|
void SetBitmap(const wxBitmap& bm);
|
||||||
|
inline void SetFilename(const wxString& f) { m_filename = f; };
|
||||||
|
inline wxString GetFilename() const { return m_filename; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxBitmap m_bitmap;
|
||||||
|
wxString m_filename;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// _OGL_BITMAP_H_
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user