1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDrawnShape
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "drawn.h"
21 class wxPseudoMetaFile
: public wxObject
23 DECLARE_DYNAMIC_CLASS(wxPseudoMetaFile
)
26 wxPseudoMetaFile(wxPseudoMetaFile
& mf
);
29 void Draw(wxDC
& dc
, float xoffset
, float yoffset
);
32 void WritePrologAttributes(wxExpr
*clause
);
33 void ReadPrologAttributes(wxExpr
*clause
);
38 void Copy(wxPseudoMetaFile
& copy
);
40 void Scale(float sx
, float sy
);
41 void ScaleTo(float w
, float h
); // Scale to fit size
42 void Translate(float x
, float y
);
44 // Rotate about the given axis by theta radians from the x axis.
45 void Rotate(float x
, float y
, float theta
);
47 bool LoadFromMetaFile(char *filename
, float *width
, float *height
);
49 void GetBounds(float *minX
, float *minY
, float *maxX
, float *maxY
);
51 inline wxList
& GetOutlineColours() const { return (wxList
&) m_outlineColours
; }
52 inline wxList
& GetFillColours() const { return (wxList
&) m_fillColours
; }
53 inline void SetRotateable(bool rot
) { m_rotateable
= rot
; }
54 inline bool GetRotateable() const { return m_rotateable
; }
60 wxList m_ops
; // List of drawing operations (see drawnp.h)
61 wxList m_gdiObjects
; // List of pens, brushes and fonts for this object.
63 // Pen/brush specifying outline/fill colours
64 // to override operations.
67 wxList m_outlineColours
; // List of the GDI operations that comprise the outline
68 wxList m_fillColours
; // List of the GDI operations that fill the shape
69 float m_currentRotation
;
72 class wxDrawnShape
: public wxRectangleShape
74 DECLARE_DYNAMIC_CLASS(wxDrawnShape
)
79 void OnDraw(wxDC
& dc
);
82 // Prolog database stuff
84 void WritePrologAttributes(wxExpr
*clause
);
85 void ReadPrologAttributes(wxExpr
*clause
);
88 // Does the copying for this object
89 void Copy(wxShape
& copy
);
91 void Scale(float sx
, float sy
);
92 void Translate(float x
, float y
);
93 // Rotate about the given axis by theta radians from the x axis.
94 void Rotate(float x
, float y
, float theta
);
96 // Get current rotation
97 inline float GetRotation() const { return m_rotation
; }
99 void SetSize(float w
, float h
, bool recursive
= TRUE
);
100 bool LoadFromMetaFile(char *filename
);
102 inline void SetSaveToFile(bool save
) { m_saveToFile
= save
; }
103 inline wxPseudoMetaFile
& GetMetaFile() const { return (wxPseudoMetaFile
&) m_metafile
; }
106 wxPseudoMetaFile m_metafile
;
108 // Don't save all wxDrawnShape metafiles to file: sometimes
109 // we take the metafile data from a symbol library.