]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/canvas.h
b821ebef0c92b2e0ef1291cfe76d044cd6cf8b80
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
);
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
;
121 //----------------------------------------------------------------------------
123 //----------------------------------------------------------------------------
125 class wxCanvas
: public wxScrolledWindow
128 // constructors and destructors
129 wxCanvas( wxWindow
*parent
, wxWindowID id
= -1,
130 const wxPoint
& pos
= wxDefaultPosition
,
131 const wxSize
& size
= wxDefaultSize
,
132 long style
= wxScrolledWindowStyle
);
135 virtual void SetArea( int width
, int height
);
136 virtual void Update( int x
, int y
, int width
, int height
);
137 virtual void UpdateNow();
139 virtual void Prepend( wxCanvasObject
* obj
);
140 virtual void Append( wxCanvasObject
* obj
);
141 virtual void Insert( size_t before
, wxCanvasObject
* obj
);
142 virtual void Remove( wxCanvasObject
* obj
);
144 wxImage
*GetBuffer() { return &m_buffer
; }
145 bool NeedUpdate() { return m_needUpdate
; }
147 void BlitBuffer( wxDC
&dc
);
152 wxList m_updateRects
;
155 friend class wxCanvasObject
;
158 void OnChar( wxKeyEvent
&event
);
159 void OnPaint( wxPaintEvent
&event
);
160 void OnMouse( wxMouseEvent
&event
);
161 void OnSize( wxSizeEvent
&event
);
162 void OnIdle( wxIdleEvent
&event
);
163 void OnSetFocus( wxFocusEvent
&event
);
164 void OnKillFocus( wxFocusEvent
&event
);
167 DECLARE_CLASS(wxCanvas
)
168 DECLARE_EVENT_TABLE()