]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/canvas.h
cdcb441b0d9069c00ac87767389773a5aba32d41
1 /////////////////////////////////////////////////////////////////////////////
3 // Author: Robert Roebling
5 // Copyright: 2000 (c) Robert Roebling
6 // Licence: wxWindows Licence
7 /////////////////////////////////////////////////////////////////////////////
10 #define __WXCANVAS_H__
13 #pragma interface "canvas.cpp"
21 #include "wx/txtstrm.h"
25 // WDR: class declarations
27 //----------------------------------------------------------------------------
29 //----------------------------------------------------------------------------
31 class wxCanvasObject
: public wxEvtHandler
34 wxCanvasObject( int x
, int y
, int width
, int height
);
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
);
40 wxCanvas
*GetOwner() { return m_owner
; }
41 void SetOwner( wxCanvas
*owner
) { m_owner
= owner
; }
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
; }
58 friend class wxCanvas
;
61 //----------------------------------------------------------------------------
63 //----------------------------------------------------------------------------
65 class wxCanvasRect
: public wxCanvasObject
68 wxCanvasRect( int x
, int y
, int w
, int h
, unsigned char red
, unsigned char green
, unsigned char blue
);
70 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
71 virtual void WriteSVG( wxTextOutputStream
&stream
);
75 unsigned char m_green
;
79 //----------------------------------------------------------------------------
81 //----------------------------------------------------------------------------
83 class wxCanvasImage
: public wxCanvasObject
86 wxCanvasImage( const wxImage
&image
, int x
, int y
);
88 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
89 virtual void WriteSVG( wxTextOutputStream
&stream
);
95 //----------------------------------------------------------------------------
97 //----------------------------------------------------------------------------
99 class wxCanvasControl
: public wxCanvasObject
102 wxCanvasControl( wxWindow
*control
);
105 virtual void Move( int x
, int y
);
112 //----------------------------------------------------------------------------
114 //----------------------------------------------------------------------------
116 class wxCanvasText
: public wxCanvasObject
119 wxCanvasText( const wxString
&text
, int x
, int y
, const wxString
&foneFile
, int size
);
122 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
123 virtual void WriteSVG( wxTextOutputStream
&stream
);
126 void SetRGB( unsigned char red
, unsigned char green
, unsigned char blue
);
127 void SetFlag( int flag
);
131 unsigned char *m_alpha
;
137 wxString m_fontFileName
;
141 //----------------------------------------------------------------------------
143 //----------------------------------------------------------------------------
145 class wxCanvas
: public wxScrolledWindow
148 // constructors and destructors
149 wxCanvas( wxWindow
*parent
, wxWindowID id
= -1,
150 const wxPoint
& pos
= wxDefaultPosition
,
151 const wxSize
& size
= wxDefaultSize
,
152 long style
= wxScrolledWindowStyle
);
155 virtual void SetArea( int width
, int height
);
156 virtual void SetColour( unsigned char red
, unsigned char green
, unsigned char blue
);
157 virtual void Update( int x
, int y
, int width
, int height
);
158 virtual void UpdateNow();
160 virtual void Prepend( wxCanvasObject
* obj
);
161 virtual void Append( wxCanvasObject
* obj
);
162 virtual void Insert( size_t before
, wxCanvasObject
* obj
);
163 virtual void Remove( wxCanvasObject
* obj
);
165 wxImage
*GetBuffer() { return &m_buffer
; }
166 bool NeedUpdate() { return m_needUpdate
; }
168 void BlitBuffer( wxDC
&dc
);
173 wxList m_updateRects
;
175 unsigned char m_green
,m_red
,m_blue
;
177 friend class wxCanvasObject
;
180 void OnChar( wxKeyEvent
&event
);
181 void OnPaint( wxPaintEvent
&event
);
182 void OnMouse( wxMouseEvent
&event
);
183 void OnSize( wxSizeEvent
&event
);
184 void OnIdle( wxIdleEvent
&event
);
185 void OnSetFocus( wxFocusEvent
&event
);
186 void OnKillFocus( wxFocusEvent
&event
);
189 DECLARE_CLASS(wxCanvas
)
190 DECLARE_EVENT_TABLE()