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(wxDrawnShape
& copy
);
91 // Returns a new instance, and does the copy for this class. Define for each class.
92 wxShape
*PrivateCopy();
94 void Scale(float sx
, float sy
);
95 void Translate(float x
, float y
);
96 // Rotate about the given axis by theta radians from the x axis.
97 void Rotate(float x
, float y
, float theta
);
99 // Get current rotation
100 inline float GetRotation() const { return m_rotation
; }
102 void SetSize(float w
, float h
, bool recursive
= TRUE
);
103 bool LoadFromMetaFile(char *filename
);
105 inline void SetSaveToFile(bool save
) { m_saveToFile
= save
; }
106 inline wxPseudoMetaFile
& GetMetaFile() const { return (wxPseudoMetaFile
&) m_metafile
; }
109 wxPseudoMetaFile m_metafile
;
111 // Don't save all wxDrawnShape metafiles to file: sometimes
112 // we take the metafile data from a symbol library.