]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/canvas/canvas.h
Corrected typo
[wxWidgets.git] / contrib / include / wx / canvas / canvas.h
CommitLineData
6a2c1874
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: canvas.h
3// Author: Robert Roebling
4// Created: XX/XX/XX
5// Copyright: 2000 (c) Robert Roebling
6// Licence: wxWindows Licence
7/////////////////////////////////////////////////////////////////////////////
8
9#ifndef __WXCANVAS_H__
10#define __WXCANVAS_H__
11
12#ifdef __GNUG__
13 #pragma interface "canvas.cpp"
14#endif
15
16#ifndef WX_PRECOMP
17 #include "wx/wx.h"
18#endif
19
20#include "wx/image.h"
21#include "wx/txtstrm.h"
22
23class wxCanvas;
24
25// WDR: class declarations
26
27//----------------------------------------------------------------------------
28// wxCanvasObject
29//----------------------------------------------------------------------------
30
31class wxCanvasObject: public wxEvtHandler
32{
33public:
34 wxCanvasObject( int x, int y, int width, int height );
35
36 virtual void Move( int x, int y );
37 virtual void Render( int clip_x, int clip_y, int clip_width, int clip_height );
38 virtual void WriteSVG( wxTextOutputStream &stream );
39
40 wxCanvas *GetOwner() { return m_owner; }
41 void SetOwner( wxCanvas *owner ) { m_owner = owner; }
42
43 bool IsControl() { return m_isControl; }
44 bool IsVector() { return m_isVector; }
45 bool IsImage() { return m_isImage; }
46 inline int GetX() { return m_area.x; }
47 inline int GetY() { return m_area.y; }
48 inline int GetWidth() { return m_area.width; }
49 inline int GetHeight() { return m_area.height; }
50
51protected:
52 wxCanvas *m_owner;
53 bool m_isControl;
54 bool m_isVector;
55 bool m_isImage;
56 wxRect m_area;
57
58 friend class wxCanvas;
59};
60
61//----------------------------------------------------------------------------
62// wxCanvasImage
63//----------------------------------------------------------------------------
64
65class wxCanvasImage: public wxCanvasObject
66{
67public:
68 wxCanvasImage( const wxImage &image, int x, int y );
69
70 virtual void Render( int clip_x, int clip_y, int clip_width, int clip_height );
71 virtual void WriteSVG( wxTextOutputStream &stream );
72
73private:
74 wxImage m_image;
75};
76
3b111dbe
RR
77//----------------------------------------------------------------------------
78// wxCanvasControl
79//----------------------------------------------------------------------------
80
81class wxCanvasControl: public wxCanvasObject
82{
83public:
84 wxCanvasControl( wxWindow *control );
85 ~wxCanvasControl();
86
87 virtual void Move( int x, int y );
88 void UpdateSize();
89
90private:
91 wxWindow *m_control;
92};
93
d1f9b206
RR
94//----------------------------------------------------------------------------
95// wxCanvasText
96//----------------------------------------------------------------------------
97
98class wxCanvasText: public wxCanvasObject
99{
100public:
cb281cfc 101 wxCanvasText( const wxString &text, int x, int y, const wxString &foneFile, int size );
d1f9b206
RR
102 ~wxCanvasText();
103
104 virtual void Render( int clip_x, int clip_y, int clip_width, int clip_height );
105 virtual void WriteSVG( wxTextOutputStream &stream );
106
107 void CreateBuffer();
108 void SetRGB( unsigned char red, unsigned char green, unsigned char blue );
109 void SetFlag( int flag );
110
111private:
112 wxString m_text;
113 unsigned char *m_alpha;
114 void *m_faceData;
115 int m_flag;
116 int m_red;
117 int m_green;
118 int m_blue;
cb281cfc
RR
119 wxString m_fontFileName;
120 int m_size;
d1f9b206
RR
121};
122
6a2c1874
RR
123//----------------------------------------------------------------------------
124// wxCanvas
125//----------------------------------------------------------------------------
126
127class wxCanvas: public wxScrolledWindow
128{
129public:
130 // constructors and destructors
131 wxCanvas( wxWindow *parent, wxWindowID id = -1,
132 const wxPoint& pos = wxDefaultPosition,
133 const wxSize& size = wxDefaultSize,
134 long style = wxScrolledWindowStyle );
135 virtual ~wxCanvas();
136
137 virtual void SetArea( int width, int height );
cb281cfc 138 virtual void SetColour( unsigned char red, unsigned char green, unsigned char blue );
6a2c1874
RR
139 virtual void Update( int x, int y, int width, int height );
140 virtual void UpdateNow();
141
142 virtual void Prepend( wxCanvasObject* obj );
143 virtual void Append( wxCanvasObject* obj );
144 virtual void Insert( size_t before, wxCanvasObject* obj );
145 virtual void Remove( wxCanvasObject* obj );
146
147 wxImage *GetBuffer() { return &m_buffer; }
148 bool NeedUpdate() { return m_needUpdate; }
149
3b111dbe
RR
150 void BlitBuffer( wxDC &dc );
151
6a2c1874 152private:
cb281cfc
RR
153 wxImage m_buffer;
154 bool m_needUpdate;
155 wxList m_updateRects;
156 wxList m_objects;
157 unsigned char m_green,m_red,m_blue;
6a2c1874
RR
158
159 friend class wxCanvasObject;
160
161private:
162 void OnChar( wxKeyEvent &event );
163 void OnPaint( wxPaintEvent &event );
164 void OnMouse( wxMouseEvent &event );
165 void OnSize( wxSizeEvent &event );
166 void OnIdle( wxIdleEvent &event );
167 void OnSetFocus( wxFocusEvent &event );
168 void OnKillFocus( wxFocusEvent &event );
169
170private:
171 DECLARE_CLASS(wxCanvas)
172 DECLARE_EVENT_TABLE()
173};
174
175
176#endif
177 // WXCANVAS
178