]> git.saurik.com Git - wxWidgets.git/blob - utils/ogl/src/drawn.h
OGL fixes; documentation fixes; dialog editor updates
[wxWidgets.git] / utils / ogl / src / drawn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: drawn.h
3 // Purpose: wxDrawnShape
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 12/07/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _OGL_DRAWN_H_
13 #define _OGL_DRAWN_H_
14
15 #ifdef __GNUG__
16 #pragma interface "drawn.h"
17 #endif
18
19 #include "basic.h"
20
21 class wxPseudoMetaFile: public wxObject
22 {
23 DECLARE_DYNAMIC_CLASS(wxPseudoMetaFile)
24 public:
25 wxPseudoMetaFile();
26 wxPseudoMetaFile(wxPseudoMetaFile& mf);
27 ~wxPseudoMetaFile();
28
29 void Draw(wxDC& dc, float xoffset, float yoffset);
30
31 #ifdef PROLOGIO
32 void WritePrologAttributes(wxExpr *clause);
33 void ReadPrologAttributes(wxExpr *clause);
34 #endif
35
36 void Clear();
37
38 void Copy(wxPseudoMetaFile& copy);
39
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);
43
44 // Rotate about the given axis by theta radians from the x axis.
45 void Rotate(float x, float y, float theta);
46
47 bool LoadFromMetaFile(char *filename, float *width, float *height);
48
49 void GetBounds(float *minX, float *minY, float *maxX, float *maxY);
50
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; }
55
56 public:
57 bool m_rotateable;
58 float m_width;
59 float m_height;
60 wxList m_ops; // List of drawing operations (see drawnp.h)
61 wxList m_gdiObjects; // List of pens, brushes and fonts for this object.
62
63 // Pen/brush specifying outline/fill colours
64 // to override operations.
65 wxPen* m_outlinePen;
66 wxBrush* m_fillBrush;
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;
70 };
71
72 class wxDrawnShape: public wxRectangleShape
73 {
74 DECLARE_DYNAMIC_CLASS(wxDrawnShape)
75 public:
76 wxDrawnShape();
77 ~wxDrawnShape();
78
79 void OnDraw(wxDC& dc);
80
81 #ifdef PROLOGIO
82 // Prolog database stuff
83 char *GetFunctor();
84 void WritePrologAttributes(wxExpr *clause);
85 void ReadPrologAttributes(wxExpr *clause);
86 #endif
87
88 // Does the copying for this object
89 void Copy(wxShape& copy);
90
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);
95
96 // Get current rotation
97 inline float GetRotation() const { return m_rotation; }
98
99 void SetSize(float w, float h, bool recursive = TRUE);
100 bool LoadFromMetaFile(char *filename);
101
102 inline void SetSaveToFile(bool save) { m_saveToFile = save; }
103 inline wxPseudoMetaFile& GetMetaFile() const { return (wxPseudoMetaFile&) m_metafile; }
104
105 private:
106 wxPseudoMetaFile m_metafile;
107
108 // Don't save all wxDrawnShape metafiles to file: sometimes
109 // we take the metafile data from a symbol library.
110 bool m_saveToFile;
111
112 };
113
114 #endif
115 // _DRAWN_H_
116