]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/canvas.h
4015e9d3dd1f8826c8f1c9f7466ad8d3764c6b43
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 wxCanvasImage
: public wxCanvasObject
68 wxCanvasImage( const wxImage
&image
, int x
, int y
);
70 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
71 virtual void WriteSVG( wxTextOutputStream
&stream
);
77 //----------------------------------------------------------------------------
79 //----------------------------------------------------------------------------
81 class wxCanvasControl
: public wxCanvasObject
84 wxCanvasControl( wxWindow
*control
);
87 virtual void Move( int x
, int y
);
94 //----------------------------------------------------------------------------
96 //----------------------------------------------------------------------------
98 class wxCanvasText
: public wxCanvasObject
101 wxCanvasText( const wxString
&text
, int x
, int y
, const wxString
&foneFile
, int size
);
104 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
105 virtual void WriteSVG( wxTextOutputStream
&stream
);
108 void SetRGB( unsigned char red
, unsigned char green
, unsigned char blue
);
109 void SetFlag( int flag
);
113 unsigned char *m_alpha
;
119 wxString m_fontFileName
;
123 //----------------------------------------------------------------------------
125 //----------------------------------------------------------------------------
127 class wxCanvas
: public wxScrolledWindow
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
);
137 virtual void SetArea( int width
, int height
);
138 virtual void SetColour( unsigned char red
, unsigned char green
, unsigned char blue
);
139 virtual void Update( int x
, int y
, int width
, int height
);
140 virtual void UpdateNow();
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
);
147 wxImage
*GetBuffer() { return &m_buffer
; }
148 bool NeedUpdate() { return m_needUpdate
; }
150 void BlitBuffer( wxDC
&dc
);
155 wxList m_updateRects
;
157 unsigned char m_green
,m_red
,m_blue
;
159 friend class wxCanvasObject
;
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
);
171 DECLARE_CLASS(wxCanvas
)
172 DECLARE_EVENT_TABLE()