]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/canvas.h
6c3747eed2a5c907cbcc0828f9cf1a874ccb96fd
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 bool IsHit( int x
, int y
, int margin
= 0 );
39 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
40 virtual void WriteSVG( wxTextOutputStream
&stream
);
42 wxCanvas
*GetOwner() { return m_owner
; }
43 void SetOwner( wxCanvas
*owner
) { m_owner
= owner
; }
45 bool IsControl() { return m_isControl
; }
46 bool IsVector() { return m_isVector
; }
47 bool IsImage() { return m_isImage
; }
48 inline int GetX() { return m_area
.x
; }
49 inline int GetY() { return m_area
.y
; }
50 inline int GetWidth() { return m_area
.width
; }
51 inline int GetHeight() { return m_area
.height
; }
60 friend class wxCanvas
;
63 //----------------------------------------------------------------------------
65 //----------------------------------------------------------------------------
67 class wxCanvasRect
: public wxCanvasObject
70 wxCanvasRect( int x
, int y
, int w
, int h
, unsigned char red
, unsigned char green
, unsigned char blue
);
72 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
73 virtual void WriteSVG( wxTextOutputStream
&stream
);
77 unsigned char m_green
;
81 //----------------------------------------------------------------------------
83 //----------------------------------------------------------------------------
85 class wxCanvasLine
: public wxCanvasObject
88 wxCanvasLine( int x
, int y
, int w
, int h
, unsigned char red
, unsigned char green
, unsigned char blue
);
90 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
91 virtual void WriteSVG( wxTextOutputStream
&stream
);
95 unsigned char m_green
;
99 //----------------------------------------------------------------------------
101 //----------------------------------------------------------------------------
103 class wxCanvasImage
: public wxCanvasObject
106 wxCanvasImage( const wxImage
&image
, int x
, int y
);
108 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
109 virtual void WriteSVG( wxTextOutputStream
&stream
);
115 //----------------------------------------------------------------------------
117 //----------------------------------------------------------------------------
119 class wxCanvasControl
: public wxCanvasObject
122 wxCanvasControl( wxWindow
*control
);
125 virtual void Move( int x
, int y
);
132 //----------------------------------------------------------------------------
134 //----------------------------------------------------------------------------
136 class wxCanvasText
: public wxCanvasObject
139 wxCanvasText( const wxString
&text
, int x
, int y
, const wxString
&foneFile
, int size
);
142 virtual void Render( int clip_x
, int clip_y
, int clip_width
, int clip_height
);
143 virtual void WriteSVG( wxTextOutputStream
&stream
);
146 void SetRGB( unsigned char red
, unsigned char green
, unsigned char blue
);
147 void SetFlag( int flag
);
148 int GetFlag() { return m_flag
; }
152 unsigned char *m_alpha
;
158 wxString m_fontFileName
;
162 //----------------------------------------------------------------------------
164 //----------------------------------------------------------------------------
166 class wxCanvas
: public wxScrolledWindow
169 // constructors and destructors
170 wxCanvas( wxWindow
*parent
, wxWindowID id
= -1,
171 const wxPoint
& pos
= wxDefaultPosition
,
172 const wxSize
& size
= wxDefaultSize
,
173 long style
= wxScrolledWindowStyle
);
176 virtual void SetArea( int width
, int height
);
177 virtual void SetColour( unsigned char red
, unsigned char green
, unsigned char blue
);
178 virtual void Update( int x
, int y
, int width
, int height
);
179 virtual void UpdateNow();
181 virtual void Freeze();
184 virtual void Prepend( wxCanvasObject
* obj
);
185 virtual void Append( wxCanvasObject
* obj
);
186 virtual void Insert( size_t before
, wxCanvasObject
* obj
);
187 virtual void Remove( wxCanvasObject
* obj
);
189 wxImage
*GetBuffer() { return &m_buffer
; }
190 bool NeedUpdate() { return m_needUpdate
; }
192 void BlitBuffer( wxDC
&dc
);
197 wxList m_updateRects
;
199 unsigned char m_green
,m_red
,m_blue
;
201 wxCanvasObject
*m_lastMouse
;
204 friend class wxCanvasObject
;
207 void OnChar( wxKeyEvent
&event
);
208 void OnPaint( wxPaintEvent
&event
);
209 void OnMouse( wxMouseEvent
&event
);
210 void OnSize( wxSizeEvent
&event
);
211 void OnIdle( wxIdleEvent
&event
);
212 void OnSetFocus( wxFocusEvent
&event
);
213 void OnKillFocus( wxFocusEvent
&event
);
216 DECLARE_CLASS(wxCanvas
)
217 DECLARE_EVENT_TABLE()