2000-03-03 06:25:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: drawnp.h
|
|
|
|
// Purpose: Private header for wxDrawnShape
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 12/07/98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart
|
2004-06-09 12:42:34 -04:00
|
|
|
// Licence: wxWindows licence
|
2000-03-03 06:25:10 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _OGL_DRAWNP_H_
|
|
|
|
#define _OGL_DRAWNP_H_
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Drawing operations
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2000-03-03 06:25:10 -05:00
|
|
|
#define DRAWOP_SET_PEN 1
|
|
|
|
#define DRAWOP_SET_BRUSH 2
|
|
|
|
#define DRAWOP_SET_FONT 3
|
|
|
|
#define DRAWOP_SET_TEXT_COLOUR 4
|
|
|
|
#define DRAWOP_SET_BK_COLOUR 5
|
|
|
|
#define DRAWOP_SET_BK_MODE 6
|
|
|
|
#define DRAWOP_SET_CLIPPING_RECT 7
|
|
|
|
#define DRAWOP_DESTROY_CLIPPING_RECT 8
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define DRAWOP_CREATE_PEN 10
|
|
|
|
#define DRAWOP_CREATE_BRUSH 11
|
|
|
|
#define DRAWOP_CREATE_FONT 12
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define DRAWOP_DRAW_LINE 20
|
|
|
|
#define DRAWOP_DRAW_POLYLINE 21
|
|
|
|
#define DRAWOP_DRAW_POLYGON 22
|
|
|
|
#define DRAWOP_DRAW_RECT 23
|
|
|
|
#define DRAWOP_DRAW_ROUNDED_RECT 24
|
|
|
|
#define DRAWOP_DRAW_ELLIPSE 25
|
|
|
|
#define DRAWOP_DRAW_POINT 26
|
|
|
|
#define DRAWOP_DRAW_ARC 27
|
|
|
|
#define DRAWOP_DRAW_TEXT 28
|
|
|
|
#define DRAWOP_DRAW_SPLINE 29
|
|
|
|
#define DRAWOP_DRAW_ELLIPTIC_ARC 30
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Base, virtual class
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2003-07-25 17:20:57 -04:00
|
|
|
class WXDLLIMPEXP_OGL wxDrawOp: public wxObject
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
inline wxDrawOp(int theOp) { m_op = theOp; }
|
|
|
|
inline ~wxDrawOp() {}
|
2004-01-08 09:35:36 -05:00
|
|
|
inline virtual void Scale(double WXUNUSED(xScale), double WXUNUSED(yScale)) {};
|
|
|
|
inline virtual void Translate(double WXUNUSED(x), double WXUNUSED(y)) {};
|
|
|
|
inline virtual void Rotate(double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(theta), double WXUNUSED(sinTheta), double WXUNUSED(cosTheta)) {};
|
2000-03-03 06:25:10 -05:00
|
|
|
virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
|
|
|
|
virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
|
2002-12-04 09:11:26 -05:00
|
|
|
#if wxUSE_PROLOGIO
|
2000-03-03 06:25:10 -05:00
|
|
|
virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
|
|
|
|
virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
|
2002-12-04 09:11:26 -05:00
|
|
|
#endif
|
2000-03-03 06:25:10 -05:00
|
|
|
inline int GetOp() const { return m_op; }
|
|
|
|
|
2004-06-09 12:42:34 -04:00
|
|
|
// Draw an outline using the current operation. By default, return false (not drawn)
|
2004-01-08 09:35:36 -05:00
|
|
|
virtual bool OnDrawOutline(wxDC& WXUNUSED(dc), double WXUNUSED(x), double WXUNUSED(y), double WXUNUSED(w), double WXUNUSED(h),
|
2004-06-09 12:42:34 -04:00
|
|
|
double WXUNUSED(oldW), double WXUNUSED(oldH)) { return false; }
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
// Get the perimeter point using this data
|
2004-01-08 09:35:36 -05:00
|
|
|
virtual bool GetPerimeterPoint(double WXUNUSED(x1), double WXUNUSED(y1),
|
|
|
|
double WXUNUSED(x2), double WXUNUSED(y2),
|
|
|
|
double *WXUNUSED(x3), double *WXUNUSED(y3),
|
|
|
|
double WXUNUSED(xOffset), double WXUNUSED(yOffset),
|
|
|
|
int WXUNUSED(attachmentMode))
|
2004-06-09 12:42:34 -04:00
|
|
|
{ return false; }
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_op;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set font, brush, text colour
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2003-07-25 17:20:57 -04:00
|
|
|
class WXDLLIMPEXP_OGL wxOpSetGDI: public wxDrawOp
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode = 0);
|
|
|
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
|
|
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
2002-12-04 09:11:26 -05:00
|
|
|
#if wxUSE_PROLOGIO
|
2000-03-03 06:25:10 -05:00
|
|
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
|
|
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
2002-12-04 09:11:26 -05:00
|
|
|
#endif
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
int m_mode;
|
|
|
|
int m_gdiIndex;
|
|
|
|
wxPseudoMetaFile* m_image;
|
|
|
|
unsigned char m_r;
|
|
|
|
unsigned char m_g;
|
|
|
|
unsigned char m_b;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set/destroy clipping
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2003-07-25 17:20:57 -04:00
|
|
|
class WXDLLIMPEXP_OGL wxOpSetClipping: public wxDrawOp
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2);
|
|
|
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
|
|
|
void Scale(double xScale, double yScale);
|
|
|
|
void Translate(double x, double y);
|
|
|
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
2002-12-04 09:11:26 -05:00
|
|
|
#if wxUSE_PROLOGIO
|
2000-03-03 06:25:10 -05:00
|
|
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
|
|
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
2002-12-04 09:11:26 -05:00
|
|
|
#endif
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
double m_x1;
|
|
|
|
double m_y1;
|
|
|
|
double m_x2;
|
|
|
|
double m_y2;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Draw line, rectangle, rounded rectangle, ellipse, point, arc, text
|
|
|
|
*
|
|
|
|
*/
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2003-07-25 17:20:57 -04:00
|
|
|
class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
|
2004-03-23 17:07:56 -05:00
|
|
|
double radius = 0.0, const wxString& s = wxEmptyString);
|
2000-03-03 06:25:10 -05:00
|
|
|
~wxOpDraw();
|
|
|
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
|
|
|
void Scale(double scaleX, double scaleY);
|
|
|
|
void Translate(double x, double y);
|
|
|
|
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
|
|
|
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
2002-12-04 09:11:26 -05:00
|
|
|
#if wxUSE_PROLOGIO
|
2000-03-03 06:25:10 -05:00
|
|
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
|
|
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
2002-12-04 09:11:26 -05:00
|
|
|
#endif
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
double m_x1;
|
|
|
|
double m_y1;
|
|
|
|
double m_x2;
|
|
|
|
double m_y2;
|
|
|
|
double m_x3;
|
|
|
|
double m_y3;
|
|
|
|
double m_radius;
|
2004-03-23 17:07:56 -05:00
|
|
|
wxString m_textString;
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Draw polyline, spline, polygon
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-07-25 17:20:57 -04:00
|
|
|
class WXDLLIMPEXP_OGL wxOpPolyDraw: public wxDrawOp
|
2000-03-03 06:25:10 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
|
|
|
|
~wxOpPolyDraw();
|
|
|
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
|
|
|
void Scale(double scaleX, double scaleY);
|
|
|
|
void Translate(double x, double y);
|
|
|
|
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
|
|
|
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
2002-12-04 09:11:26 -05:00
|
|
|
#if wxUSE_PROLOGIO
|
2000-03-03 06:25:10 -05:00
|
|
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
|
|
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
2002-12-04 09:11:26 -05:00
|
|
|
#endif
|
2000-03-03 06:25:10 -05:00
|
|
|
|
|
|
|
// Draw an outline using the current operation.
|
|
|
|
virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
|
|
|
|
double oldW, double oldH);
|
|
|
|
|
|
|
|
// Get the perimeter point using this data
|
|
|
|
bool GetPerimeterPoint(double x1, double y1,
|
|
|
|
double x2, double y2,
|
|
|
|
double *x3, double *y3,
|
|
|
|
double xOffset, double yOffset,
|
|
|
|
int attachmentMode);
|
|
|
|
|
|
|
|
public:
|
|
|
|
wxRealPoint* m_points;
|
|
|
|
int m_noPoints;
|
2002-03-15 15:50:40 -05:00
|
|
|
|
2000-03-03 06:25:10 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _OGL_DRAWNP_H_
|
|
|
|
|
|
|
|
|