wxArt2D
recurdoc.h
1 /*! \file wx/canvas/recur.h
2  \brief special a2dCanvasObject which are used to create hierarchy different from
3  the standard a2dCanvasObject child list.
4 
5  Hierarchy is normally created by adding child a2dCanvasObject's to the root object of the document,
6  and next to those a2dCanvasObject's again add child objects.
7  But the object here create different types of hierarchy.
8 
9  a2dCanvasObjectReference refrences another a2dCanvasObject which might be stored as a child of
10  another one already. This way you can display the same object at several places.
11 
12  a2dCanvasObjectArrayReference is simular, but here the referenced object is displayed in
13  a grid of n by M objects.
14 
15  \author Klaas Holwerda
16 
17  Copyright: 2000-2004 (c) Klaas Holwerda
18 
19  Licence: wxWidgets Licence
20 
21  RCS-ID: $Id: recur.h,v 1.17 2009/09/26 20:40:32 titato Exp $
22 */
23 
24 #ifndef __WXDOCRECUR_H__
25 #define __WXDOCRECUR_H__
26 
27 #ifndef WX_PRECOMP
28 #include "wx/wx.h"
29 #endif
30 
31 #include "wx/editor/candoc.h"
32 #include "wx/canvas/canprim.h"
33 #include "wx/canvas/canimage.h"
34 #include "wx/canvas/cantext.h"
35 
36 #define __USE_EVENTS 1
37 
38 #define newline wxString("\n")
39 
40 //! to display a2dCanvasObject references
41 /*!
42  \ingroup canvasobject
43 */
44 class A2DCANVASDLLEXP a2dCanvasDocumentReference: public a2dLibraryReference
45 {
46 public:
47 
48 
49  a2dCanvasDocumentReference( double x = 0, double y = 0, a2dCanvasDocument* doc = 0, double totalheight = 100,
50  const a2dFont& font = *a2dDEFAULT_CANVASFONT,
51  int imagew = 100, int imageh = 100, a2dCanvasObject* symbol = 0 );
52 
53  a2dCanvasDocumentReference( double x, double y, double totalheight, const wxFileName& filename,
54  const a2dFont& font = *a2dDEFAULT_CANVASFONT,
55  int imagew = 100, int imageh = 100, a2dCanvasObject* symbol = 0 );
56 
58 
60 
61  void SetDocumentReference( a2dCanvasDocument* doc ) { m_doc = doc; }
62 
63  a2dCanvasDocument* GetDocumentReference() const { return m_doc; }
64 
65 protected:
66  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
67 
68  void DependencyPending( a2dWalkerIOHandler* WXUNUSED( handler ) );
69 
71 
72  DECLARE_DYNAMIC_CLASS( a2dCanvasDocumentReference )
73 };
74 
75 //! to display a2dCanvasObject references
76 /*!
77  \ingroup canvasobject
78 */
79 class A2DCANVASDLLEXP a2dCanvasDocumentReference2: public a2dCanvasObject
80 {
81 public:
82  DECLARE_EVENT_TABLE()
83  DECLARE_DYNAMIC_CLASS( a2dCanvasDocumentReference2 )
84 
85  a2dCanvasDocumentReference2( double x = 0, double y = 0, a2dCanvasDocument* doc = 0 );
86 
87  a2dCanvasDocumentReference2( double x, double y, const wxFileName& filename );
88 
90 
92 
93  void SetDocumentReference( a2dCanvasDocument* doc ) { m_doc = doc; }
94 
95  a2dCanvasDocument* GetDocumentReference() const { return m_doc; }
96 
97  wxFileName& GetFileName() { return m_fileName; }
98 
99 protected:
100  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
101 
103 
104  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
105 
106 #if wxART2D_USE_CVGIO
107  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
108 
109  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
110 #endif //wxART2D_USE_CVGIO
111 
113 
114  wxFileName m_fileName;
115 };
116 
117 
118 //! to display a2dCanvasObject references
119 /*!
120  \ingroup canvasobject
121 */
122 class A2DCANVASDLLEXP a2dCanvasDocumentReferenceAsText: public a2dText
123 {
124 public:
125  DECLARE_EVENT_TABLE()
126  DECLARE_DYNAMIC_CLASS( a2dCanvasDocumentReference2 )
127 
128  a2dCanvasDocumentReferenceAsText( a2dCanvasDocument* doc = 0, double x = 0, double y = 0, const a2dFont& font = *a2dDEFAULT_CANVASFONT, double angle = 0.0,
129  bool up = false, int alignment = a2dDEFAULT_ALIGNMENT );
130 
131  a2dCanvasDocumentReferenceAsText( const wxFileName& filename, double x, double y, const a2dFont& font = *a2dDEFAULT_CANVASFONT, double angle = 0.0,
132  bool up = false, int alignment = a2dDEFAULT_ALIGNMENT );
133 
135 
137 
138  void SetDocumentReference( a2dCanvasDocument* doc ) { m_doc = doc; }
139 
140  a2dCanvasDocument* GetDocumentReference() const { return m_doc; }
141 
142  wxFileName& GetFileName() { return m_fileName; }
143 
144  void SetDisplayShort( bool val ) { m_displayShort = val; }
145  void SetDisplayExt( bool val ) { m_displayExt = val; }
146  bool GetDisplayShort() { return m_displayShort; }
147  bool GetDisplayExt() { return m_displayExt; }
148 
149 protected:
150  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
151 
152  bool DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox );
153 
154  bool DoStartEdit( wxUint16 editmode, wxEditStyle editstyle );
155 
156  void DoEndEdit();
157 
158  void OnCanvasObjectMouseEvent( a2dCanvasObjectMouseEvent& event );
159 
160  bool DoIsHitWorld( a2dIterC& ic, a2dHitEvent& hitEvent );
161 
162 #if wxART2D_USE_CVGIO
163  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
164 
165  void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
166 #endif //wxART2D_USE_CVGIO
167 
169 
170  wxFileName m_fileName;
171 
172  bool m_displayShort;
173  bool m_displayExt;
174 
175 };
176 
177 #endif
178 
bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: cantext.cpp:822
a2dText derived from a2dCanvasObject, holds multiline text
all basic primitives derived from a2dCanvasObject
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: canobj.cpp:3713
mouse event sent from a2dCanvasObject to itself
Definition: canglob.h:223
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: canobj.cpp:1426
void OnCanvasObjectMouseEvent(a2dCanvasObjectMouseEvent &event)
default handler for mouse events, sent to the object from the a2dDrawingPart.
Definition: canobj.cpp:2391
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
Ref Counted base object.
Definition: gen.h:1045
void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
Load object specific CVG data.
Definition: cantext.cpp:536
virtual void DependencyPending(a2dWalkerIOHandler *handler)
called by to check if this object becomes pending as a result of other objects
Definition: canobj.cpp:4680
to display a2dCanvasObject references
Definition: recurdoc.h:44
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Definition: stylebase.h:779
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
virtual bool DoStartEdit(wxUint16 editmode, wxEditStyle editstyle)
only used for editable objects and under control of a editing tool.
Definition: cantext.cpp:937
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
Definition: canobj.cpp:5728
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: recur.cpp:580
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
a2dText is an abstract base class.
Definition: cantext.h:93
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
Definition: canobj.cpp:5569
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
virtual bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: cantext.cpp:597
to display a2dCanvasObject references
Definition: recurdoc.h:79
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: cantext.cpp:169
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
Write object specific CVG data.
Definition: cantext.cpp:568
Each a2dCanvasView needs to have a a2dCanvasDocument set in order to render data. ...
Definition: candoc.h:374
to display a2dCanvasObject references
Definition: recurdoc.h:122
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
a2dLibraryReference is a symbol object, it holds a reference
Definition: recur.h:215
list of a2dObject's
Definition: gen.h:3157
CloneOptions
options for cloning
Definition: gen.h:1200
virtual void DoEndEdit()
only used for editable objects and under control of a editing tool.
Definition: cantext.cpp:1026
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
wxEditStyle
Definition: canobj.h:109
recurdoc.h Source File -- Sun Oct 12 2014 17:04:23 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation