]>
git.saurik.com Git - wxWidgets.git/blob - contrib/include/wx/canvas/canvas.h
4c2e43bf801ec7bede479d72121a1bddc509104b
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 wxCanvas
: public wxScrolledWindow
84 // constructors and destructors
85 wxCanvas( wxWindow
*parent
, wxWindowID id
= -1,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
88 long style
= wxScrolledWindowStyle
);
91 virtual void SetArea( int width
, int height
);
92 virtual void Update( int x
, int y
, int width
, int height
);
93 virtual void UpdateNow();
95 virtual void Prepend( wxCanvasObject
* obj
);
96 virtual void Append( wxCanvasObject
* obj
);
97 virtual void Insert( size_t before
, wxCanvasObject
* obj
);
98 virtual void Remove( wxCanvasObject
* obj
);
100 wxImage
*GetBuffer() { return &m_buffer
; }
101 bool NeedUpdate() { return m_needUpdate
; }
106 wxList m_updateRects
;
109 friend class wxCanvasObject
;
112 void OnChar( wxKeyEvent
&event
);
113 void OnPaint( wxPaintEvent
&event
);
114 void OnMouse( wxMouseEvent
&event
);
115 void OnSize( wxSizeEvent
&event
);
116 void OnIdle( wxIdleEvent
&event
);
117 void OnSetFocus( wxFocusEvent
&event
);
118 void OnKillFocus( wxFocusEvent
&event
);
121 DECLARE_CLASS(wxCanvas
)
122 DECLARE_EVENT_TABLE()