wxArt2D
canwidget.cpp
Go to the documentation of this file.
1 /*! \file canvas/src/canwidget.cpp
2  \author Michael Sögtrop
3  \date Created 11/19/2003
4 
5  Copyright: 2003-2004 (c) Michael Sögtrop
6 
7  Licence: wxWidgets Licence
8 
9  RCS-ID: $Id: canwidget.cpp,v 1.62 2009/10/01 19:22:35 titato Exp $
10 */
11 
12 #include "a2dprec.h"
13 
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17 
18 #ifndef WX_PRECOMP
19 #include "wx/wx.h"
20 #endif
21 
22 #include "wx/canvas/canobj.h"
23 
24 #include "wx/canvas/canwidget.h"
25 #include "wx/canvas/drawer.h"
26 #include "wx/canvas/canglob.h"
27 #include "wx/canvas/algos.h"
28 
29 IMPLEMENT_CLASS( a2dWidgetButton, a2dWindowMM )
30 IMPLEMENT_CLASS( a2dWidgetButtonGroup, a2dCanvasObject )
31 IMPLEMENT_CLASS( a2dWidgetButtonCommand, a2dWidgetButton )
32 
33 BEGIN_EVENT_TABLE( a2dWidgetButton, a2dWindowMM )
34  EVT_CANVASOBJECT_MOUSE_EVENT( a2dWidgetButton::OnCanvasObjectMouseEvent )
35  EVT_CANVASOBJECT_ENTER_EVENT( a2dWidgetButton::OnEnterObject )
36  EVT_CANVASOBJECT_LEAVE_EVENT( a2dWidgetButton::OnLeaveObject )
37 END_EVENT_TABLE()
38 
39 a2dWidgetButton::a2dWidgetButton( a2dCanvasObject* parent, int buttonId, double x, double y, double w, double h, WidgetMode mode )
40  : a2dWindowMM( x, y, w, h )
41 {
42  m_parent = parent;
43  m_selectedStroke = *a2dBLACK_STROKE;
44  m_selectedFill = *a2dTRANSPARENT_FILL;
45 
46  m_highLightStroke = *a2dNullSTROKE;
47  m_highLightFill = *a2dNullFILL;
48 
49  SetStroke( *a2dTRANSPARENT_STROKE );
50  SetFill( *a2dTRANSPARENT_FILL );
51  m_buttonId = buttonId;
52  m_mode = mode;
53  m_content = 0;
54  m_contentBorder = 0.0;
55 }
56 
57 a2dWidgetButton::a2dWidgetButton( const a2dWidgetButton& other, CloneOptions options, a2dRefMap* refs )
58  : a2dWindowMM( other, options, refs )
59 {
60  m_parent = other.m_parent;
65  m_buttonId = other.m_buttonId;
66  m_mode = other.m_mode;
67  if ( m_content )
68  m_content = other.m_content;
70 }
71 
73 {
74  return new a2dWidgetButton( *this, options, refs );
75 };
76 
78 {
79 }
80 
81 void a2dWidgetButton::DoWalker( wxObject* parent, a2dWalkerIOHandler& handler )
82 {
83  handler.WalkTask( parent, this, a2dWalker_a2dDerivedCanvasObjectStart );
84  a2dCanvasObject::DoWalker( parent, handler );
85 
86  if ( m_content )
87  m_content->Walker( this, handler );
88 
89  handler.WalkTask( parent, this, a2dWalker_a2dDerivedCanvasObjectEnd );
90 }
91 
93 {
96  else
97  ic.GetDrawer2D()->SetDrawerStroke( GetHabitat()->GetHighLightStroke() );
98 
99  if ( !m_highLightFill.IsNoFill() )
101  else
102  ic.GetDrawer2D()->SetDrawerFill( GetHabitat()->GetHighLightFill() );
103 
104  a2dStroke m_shadowStroke = a2dStroke( *wxBLACK, 0, a2dSTROKE_SOLID );
105  a2dStroke m_lightStroke = a2dStroke( *wxWHITE, 0, a2dSTROKE_SOLID );
106 
107  double x1 = m_bbox.GetMinX();
108  double x2 = m_bbox.GetMaxX();
109  double y1 = m_bbox.GetMinY();
110  double y2 = m_bbox.GetMaxY();
111  ic.GetDrawer2D()->SetDrawerStroke( m_shadowStroke );
112  ic.GetDrawer2D()->DrawLine( x1, y1, x1, y2 );
113  ic.GetDrawer2D()->DrawLine( x1, y2, x2, y2 );
114  ic.GetDrawer2D()->SetDrawerStroke( m_lightStroke );
115  ic.GetDrawer2D()->DrawLine( x2, y1, x2, y2 );
116  ic.GetDrawer2D()->DrawLine( x2, y1, x1, y1 );
117 
118 
119  //ic.GetDrawer2D()->DrawRoundedRectangle( m_bbox.GetMinX(), m_bbox.GetMinY(), m_bbox.GetWidth(), m_bbox.GetHeight() ,0 );
120 
121  //a2dBoundingBox tbbox = DoGetUnTransformedBbox();
122 
123  //ic.GetDrawer2D()->SetTransform( ic.GetTransform() );
124  //ic.GetDrawer2D()->DrawRoundedRectangle( tbbox.GetMinX(), tbbox.GetMinY(), tbbox.GetWidth(), tbbox.GetHeight() ,0 );
125 }
126 
127 
128 void a2dWidgetButton::Render( a2dIterC& ic, OVERLAP clipparent )
129 {
130  // a2dWidgetButton does its own selection drawing, so base class behaviour is not wanted
132  a2dWindowMM::Render( ic, clipparent );
133 }
134 
135 bool a2dWidgetButton::DoUpdate( UpdateMode mode, const a2dBoundingBox& childbox, const a2dBoundingBox& clipbox, const a2dBoundingBox& propbox )
136 {
137  if ( !m_bbox.GetValid() )
138  {
140  switch( m_mode )
141  {
142  case Boundingbox:
144  break;
145 
146  case BoundingboxSize:
147  if ( m_content )
148  {
149  a2dBoundingBox tbbox;
150  tbbox.Expand( m_content->GetCalculatedBoundingBox( INT_MAX ) );
151  double xshift = -tbbox.GetMinX();
152  double yshift = -tbbox.GetMinY();
153  m_contentWorld = a2dAffineMatrix( xshift, yshift );
154  }
155  break;
156 
157  case ScaledContent:
159  if ( m_content )
160  {
161  a2dBoundingBox tbbox;
162  tbbox.Expand( m_content->GetCalculatedBoundingBox( INT_MAX ) );
163 
164  // This code even works, if 1 content dimension is zero (e.g. a line)
165  // In this case, the content is centered
166  double
167  scaleX = tbbox.GetWidth() ? ( m_maxx - m_minx - 2 * m_contentBorder ) / tbbox.GetWidth() : 0,
168  scaleY = tbbox.GetHeight() ? ( m_maxy - m_miny - 2 * m_contentBorder ) / tbbox.GetHeight() : 0;
169 
171  {
172  if( scaleX && fabs( scaleX ) < fabs( scaleY ) )
173  scaleY = scaleX;
174  else if( scaleY && fabs( scaleY ) < fabs( scaleX ) )
175  scaleX = scaleY;
176  }
177 
179  0.5 * ( m_maxx - m_minx ) - 0.5 * scaleX * ( tbbox.GetMinX() + tbbox.GetMaxX() ),
180  0.5 * ( m_maxy - m_miny ) - 0.5 * scaleY * ( tbbox.GetMinY() + tbbox.GetMaxY() ),
181  scaleX,
182  scaleY
183  );
184  }
185 
186  break;
187  default:
188  break;
189  }
191  return true;
192  }
193  return false;
194 }
195 
196 a2dBoundingBox a2dWidgetButton::DoGetUnTransformedBbox( a2dBboxFlags WXUNUSED( flags ) ) const
197 {
198  a2dBoundingBox bbox;
199  switch( m_mode )
200  {
201  case Boundingbox:
202  if ( m_content )
203  {
204  a2dBoundingBox tbbox;
205  tbbox.Expand( m_content->GetCalculatedBoundingBox( INT_MAX ) );
206  bbox.Expand( tbbox );
207  }
208 
209  bbox.Expand( 0, 0 );
210  bbox.Expand( m_maxx - m_minx , m_maxy - m_miny );
211  break;
212 
213  case BoundingboxSize:
214  if ( m_content )
215  {
216  a2dBoundingBox tbbox;
217  tbbox.Expand( m_content->GetCalculatedBoundingBox( INT_MAX ) );
218  double xshift = -tbbox.GetMinX();
219  double yshift = -tbbox.GetMinY();
220 
221  tbbox.Translate( xshift, yshift );
222  bbox.Expand( tbbox );
223  }
224 
225  bbox.Expand( 0, 0 );
226  bbox.Expand( m_maxx - m_minx , m_maxy - m_miny );
227  bbox.Enlarge( m_contentBorder );
228  break;
229 
230  case ScaledContent:
232 
233  bbox.Expand( 0, 0 );
234  bbox.Expand( m_maxx - m_minx , m_maxy - m_miny );
235  break;
236 
237  default:
238  break;
239  }
240  return bbox;
241 }
242 
244 {
245  a2dWindowMM::DoRender( ic, clipparent );
246 
247  if ( m_content )
248  {
249  bool old = m_content->GetChildrenOnSameLayer();
250  a2dAffineMatrix oldMatrix = ic.GetDrawer2D()->GetTransform();
251 
253 
254  a2dIterCU cu( ic, m_contentWorld );
255  m_content->Render( ic, clipparent );
256 
258  ic.GetDrawer2D()->SetTransform( oldMatrix );
259  }
260 
261  if( IsSelected() )
262  {
263  if( !m_selectedFill.IsNoFill() )
267 
268  // This is needed, because the default selected drawing is disabled
270  ic.GetDrawer2D()->DrawRoundedRectangle( bbox.GetMinX(), bbox.GetMinY(), bbox.GetWidth(), bbox.GetHeight(), 0 );
271  }
272 }
273 
275 {
276  m_flags.m_HighLight = true;
277  SetPending( true );
278  event.Skip(); //e.g. for base class object tip
279 }
280 
282 {
283  m_flags.m_HighLight = false;
284  SetPending( true );
285  event.Skip(); //e.g. for base class object tip
286 }
287 
289 {
290  if ( event.GetMouseEvent().Moving() )
291  {
292  event.Skip();
293 // m_root->GetCanvasView()->SetCursor( GetHabitat()->GetCursor( a2dCURSOR_HAND ) );
294  }
295  else if ( event.GetMouseEvent().LeftDown() )
296  {
297  wxCommandEvent commandEvent( wxEVT_COMMAND_BUTTON_CLICKED, m_buttonId );
298  commandEvent.SetEventObject( this );
299  if ( !ProcessEvent( commandEvent ) && m_parent )
300  m_parent->ProcessEvent( commandEvent );
301  }
302  else if ( event.GetMouseEvent().LeftUp() )
303  {
304  }
305  else
306  {
307  event.Skip();
308  }
309 }
310 
312 {
313  if ( m_content )
314  {
315  a2dIterCU cu( ic, m_contentWorld );
316  if ( m_content->IsHitWorld( ic, hitEvent ) != 0 )
317  return true;
318  }
319 
320  double margin = ic.GetTransformedHitMargin();
321 
322  hitEvent.m_how = HitTestRectangle( hitEvent.m_relx, hitEvent.m_rely, m_minx, m_miny, m_maxx, m_maxy, ic.GetTransformedHitMargin() + margin );
323 
324  return hitEvent.m_how.IsHit();
325 }
326 
327 
328 BEGIN_EVENT_TABLE( a2dWidgetButtonGroup, a2dCanvasObject )
329  EVT_BUTTON_ANY( a2dWidgetButtonGroup::OnAnyButton )
330 END_EVENT_TABLE()
331 
332 a2dWidgetButtonGroup::a2dWidgetButtonGroup( a2dCanvasObject* WXUNUSED( parent ), double x, double y, float extra )
333  : a2dCanvasObject( x, y )
334 {
335  m_worldExtend = extra;
336  m_singleSelect = true;
337 }
338 
340 {
341 }
342 
343 void a2dWidgetButtonGroup::DoRender( a2dIterC& ic, OVERLAP WXUNUSED( clipparent ) )
344 {
345  a2dAffineMatrix invlworld = m_lworld;
346  invlworld.Invert();
347 
348  a2dAffineMatrix oldMatrix = ic.GetDrawer2D()->GetTransform();
349  a2dIterCU cu( ic, invlworld );
351  ic.GetDrawer2D()->SetTransform( oldMatrix );
352 }
353 
354 void a2dWidgetButtonGroup::OnAnyButton( wxCommandEvent& event )
355 {
356  a2dCanvasObject* hit = wxStaticCast( event.GetEventObject(), a2dCanvasObject );
357 
358  if( m_singleSelect )
359  {
361  setflags.Start( m_root->GetRootObject(), true );
363  setflags2.SetSkipNotRenderedInDrawing( true );
364  setflags2.Start( m_root->GetRootObject(), false );
365 
366  hit->SetSelected( true );
367  }
368  else
369  {
370  if ( hit->IsSelected() )
371  hit->SetSelected( false );
372  else
373  hit->SetSelected( true );
374  }
375 
376  hit->SetPending( true );
377 
378  if( hit->IsSelected() )
379  {
380  // If hit is a a2dWidgetButton (it usually is), get the button id
381  a2dWidgetButton* hitButton = wxDynamicCast( event.GetEventObject(), a2dWidgetButton );
382  int buttonId = hitButton ? hitButton->GetButtonId() : 0;
383 
384  wxCommandEvent commandEvent( wxEVT_COMMAND_CHOICE_SELECTED, buttonId );
385  commandEvent.SetEventObject( hit );
386  hit->ProcessEvent( commandEvent );
387  }
388 
389  event.Skip();
390 }
391 
392 
393 BEGIN_EVENT_TABLE( a2dWidgetButtonCommand, a2dWidgetButton )
394  EVT_CHOICE_ANY( a2dWidgetButtonCommand::OnAnyChoice )
395 END_EVENT_TABLE()
396 
397 a2dWidgetButtonCommand::a2dWidgetButtonCommand( a2dCanvasObject* parent, int buttonId, double x, double y, double w, double h, WidgetMode mode )
398  : a2dWidgetButton( parent, buttonId, x, y, w, h, mode )
399 {
400  m_docviewCommand = 0;
401  m_event = 0;
402  m_clientData = 0;
403 }
404 
406 {
407  if( m_docviewCommand )
408  delete m_docviewCommand;
409  if( m_event )
410  delete m_event;
411  if( m_clientData )
412  delete m_clientData;
413 }
414 
416 {
417  if( m_docviewCommand )
418  delete m_docviewCommand;
419 
420  m_docviewCommand = command;
421 }
422 
423 void a2dWidgetButtonCommand::SetEvent( wxEvent* event )
424 {
425  if( m_event )
426  delete m_event;
427 
428  m_event = event;
429 }
430 
431 void a2dWidgetButtonCommand::OnAnyChoice( wxCommandEvent& event )
432 {
433  if( event.GetEventObject() == this )
434  {
435  if( m_docviewCommand )
436  {
437  assert( 0 );
438  //!todo, is undo info here needed, e.g. what is the inverse of command/event sent around.?
439  /*
440  a2dDocumentCommandProcessor *cp = a2dDocviewGlobals->GetDocviewCommandProcessor();
441 
442  if( cp )
443  {
444  a2dCentralCanvasCommandProcessor *ccp = wxDynamicCast( cp, a2dCentralCanvasCommandProcessor );
445  if( ccp )
446  {
447  a2dCanvasObjectList objects;
448  ccp->GetParentObject()->CollectObjects( &objects, wxT(""), a2dCANOBJ_SELECTED );
449  ccp->GetParentObject()->CollectObjects( &objects, wxT(""), a2dCANOBJ_Editing );
450  ccp->GetParentObject()->CollectObjects( &objects, wxT(""), a2dCANOBJ_EditingCopy );
451 
452  a2dCanvasDocument* CheckCanvasDocument();
453 
454  forEachIn( a2dCanvasObjectList, &objects )
455  {
456  ccp->SubmitMultiple( m_docviewCommand->CloneAndBind( 0 ), &objects );
457  }
458  }
459  else
460  {
461  cp->Submit( m_docviewCommand->CloneAndBind( 0 ) );
462  }
463  }
464  */
465  }
466 
467  if( m_event )
468  {
469  wxMDIParentFrame* mdiFrame = wxDynamicCast( wxTheApp->GetTopWindow(), wxMDIParentFrame );
470 
471  if ( mdiFrame && mdiFrame->GetActiveChild() )
472  mdiFrame->GetActiveChild()->GetEventHandler()->ProcessEvent( *m_event );
473  else
474  wxTheApp->GetTopWindow()->GetEventHandler()->ProcessEvent( *m_event );
475  }
476  }
477 
478  event.Skip();
479 }
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
Definition: canobj.h:301
double m_relx
(world coordinates) hit point x relative to the canvas object its parent object(s) ...
Definition: canobj.h:289
double GetHeight() const
returns height of the boundingbox
Definition: bbox.cpp:334
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
Definition: canobj.cpp:4712
double m_contentBorder
here a border between the button and the content can be given
Definition: canwidget.h:155
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
virtual void SetTransform(const a2dAffineMatrix &userToWorld)
set user-to-world transform matrix.
Definition: drawer2d.cpp:446
bool IsNoStroke() const
Definition: stylebase.h:510
mouse event sent from a2dCanvasObject to itself
Definition: canglob.h:223
a2dStroke m_selectedStroke
Definition: canwidget.h:137
const a2dStroke * a2dBLACK_STROKE
global a2dStroke stock object for BLACK stroking
Holds several a2dWidgetButton and othere a2dCanvasObject&#39;s.
Definition: canwidget.h:174
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
a2dStroke m_highLightStroke
Definition: canwidget.h:143
a2dDrawing * m_root
root group for rendering and accessing the canvas&#39;s also contains layer settings
Definition: canobj.h:2525
a2dCanvasObject * m_parent
events are sent from the button to this object, if not handled by the button itself.
Definition: canwidget.h:162
a2dCanvasOFlags m_flags
holds flags for objects
Definition: canobj.h:2528
double m_maxx
maximum x of rectangle
Definition: rectangle.h:164
#define EVT_CANVASOBJECT_ENTER_EVENT(func)
static event table macro for a2dCanvasObject mouse enter event
Definition: canglob.h:314
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
Definition: drawing.h:521
int m_buttonId
event id used when sending events
Definition: canwidget.h:149
Ref Counted base object.
Definition: gen.h:1045
a2dWidgetButton(a2dCanvasObject *parent, int buttonId, double x, double y, double w, double h, WidgetMode mode=Boundingbox)
Standard constructor.
Definition: canwidget.cpp:39
void Enlarge(const double Marge)
enlarge with the given amount
Definition: bbox.cpp:162
virtual void Render(a2dIterC &ic, OVERLAP clipparent)
Render this object to the active a2dDrawingPart.
Definition: canwidget.cpp:128
a2dFill m_selectedFill
Definition: canwidget.h:140
bool IsHit() const
true if this is a hit
Definition: polyver.h:107
void SetDrawerStroke(const a2dStroke &stroke)
Used to set the current stroke.
Definition: drawer2d.cpp:565
a2dBoundingBox GetCalculatedBoundingBox(int nChildLevels)
Like GetBbox, but it always calculcates the bounding box from scratch.
Definition: canobj.cpp:5072
UpdateMode
Various mode flags for Update.
Definition: canobj.h:1091
virtual void SetPending(bool pending)
set this object pending for update
Definition: canobj.cpp:2585
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
Definition: bbox.h:24
bool IsNoFill() const
Definition: stylebase.h:273
#define EVT_CHOICE_ANY(func)
wxEvthandler macro
Definition: comevt.h:47
a2dCanvasObjectPtr m_content
the button its graphics, which will be scaled in WidgetMode::ScaleChildren
Definition: canwidget.h:158
void OnEnterObject(a2dCanvasObjectMouseEvent &event)
handler for EVT_CANVASOBJECT_ENTER_EVENT
Definition: canwidget.cpp:274
The base class for all drawable objects in a a2dCanvasDocument.
double GetTransformedHitMargin()
transformed to object its coordinate system
Definition: canobj.cpp:616
virtual void DrawHighLighted(a2dIterC &ic)
called by Render() if m_flags.m_HighLight is set
Definition: canwidget.cpp:92
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: canwidget.cpp:343
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart
id for a2dWalkEvent issued from within a2dWalkerIOHandler
void SetSelected(bool selected)
Set the object selected flag if allowed.
Definition: canobj.h:1620
specialized a2dWidgetButton which processes a given a2dCommand
Definition: canwidget.h:215
double m_minx
minimum x of rectangle
Definition: rectangle.h:158
a2dAffineMatrix m_lworld
used for positioning the object (x,y,ang,scale etc.)
Definition: canobj.h:2559
void SetDrawerFill(const a2dFill &fill)
Used to set the current fill.
Definition: drawer2d.cpp:621
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
widget like objects like buttons and sliders go here.
void OnLeaveObject(a2dCanvasObjectMouseEvent &event)
handler for EVT_CANVASOBJECT_LEAVE_EVENT
Definition: canwidget.cpp:281
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: canwidget.cpp:72
void OnAnyChoice(wxCommandEvent &event)
Definition: canwidget.cpp:431
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
Definition: bbox.cpp:299
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
Definition: bbox.cpp:155
const a2dBoundingBox & Translate(a2dPoint2D &)
translate with given vector
Definition: bbox.cpp:370
double GetMinX() const
get minimum X of the boundingbox
Definition: bbox.cpp:304
virtual void DrawRoundedRectangle(double x, double y, double width, double height, double radius, bool pixelsize=false)
Draw RoundedRectangle in world coordinates.
Definition: drawer2d.cpp:2048
~a2dWidgetButtonCommand()
destructor
Definition: canwidget.cpp:405
void Walker(wxObject *parent, a2dWalkerIOHandler &handler)
This is used to recursively walk through an object tree.
Definition: gen.cpp:1473
wxClientData * m_clientData
Client data (usually used for the event)
Definition: canwidget.h:262
a2dDrawer2D * GetDrawer2D() const
get current a2dDrawer2D
Definition: canobj.cpp:636
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
a2dAffineMatrix m_contentWorld
for scaling/translating the m_content
Definition: canwidget.h:165
#define EVT_CANVASOBJECT_MOUSE_EVENT(func)
static event table macro for a2dCanvasObject mouse event
Definition: canglob.h:312
WidgetMode m_mode
type of button rendering of the m_content object.
Definition: canwidget.h:152
int GetButtonId()
id used for button event.
Definition: canwidget.h:103
virtual void DrawLine(double x1, double y1, double x2, double y2)
Draw line in world coordinates.
Definition: drawer2d.cpp:2167
static const a2dCanvasObjectFlagsMask SELECTED
Definition: candefs.h:180
bool IsSelected() const
Is the object selected flag set.
Definition: canobj.h:1610
void SetCanvasCommand(class a2dCommand *command)
If set this command will be executed when the object is selected.
Definition: canwidget.cpp:415
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
a2dCanvasObject(double x=0, double y=0)
constructor called by derived objects
Definition: canobj.cpp:1391
bool Identity(void)
Make into identity matrix.
Definition: afmatrix.cpp:256
set a2dCanvasObjects flags in a hierarchy of a a2dCanvasDocument
Definition: algos.h:486
void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: rectangle.cpp:756
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
wxMouseEvent & GetMouseEvent()
return the original mouse event that was redirected to the a2dCanvasObject
Definition: canglob.h:243
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
a2dFill m_highLightFill
Definition: canwidget.h:146
double GetMaxX() const
get maximum X of the boundingbox
Definition: bbox.cpp:316
double m_maxy
maximum y of rectangle
Definition: rectangle.h:167
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
virtual a2dBoundingBox DoGetUnTransformedBbox(a2dBboxFlags flags=a2dCANOBJ_BBOX_NON) const
In derived object this should be overriden to calculate the boundingbox of the object without its chi...
Definition: canwidget.cpp:196
a2dWalker based algorithms
void MapBbox(const a2dAffineMatrix &matrix)
Definition: bbox.cpp:445
#define EVT_CANVASOBJECT_LEAVE_EVENT(func)
static event table macro for a2dCanvasObject mouse leave event
Definition: canglob.h:316
void SetChildrenOnSameLayer(bool samelayer)
if set children are rendered on the same layer as this object.
Definition: canobj.h:1429
void SetEvent(wxEvent *event)
If set this event will be triggered when the object is selected.
Definition: canwidget.cpp:423
set pending flag in a drawing
Definition: algos.h:517
~a2dWidgetButtonGroup()
destructor
Definition: canwidget.cpp:339
double GetMaxY() const
get maximum Y of the boundingbox
Definition: bbox.cpp:322
double GetWidth() const
returns width of the boundingbox
Definition: bbox.cpp:328
An object of this class will update a a2dIterC with the required information.
Definition: canobj.h:3123
bool DoIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
Does hit test on the object (exclusif child objects)
Definition: canwidget.cpp:311
const a2dStroke * a2dTRANSPARENT_STROKE
global a2dStroke stock object for TRANSPARENT stroking
double m_miny
minimum of rectangle
Definition: rectangle.h:161
void OnCanvasObjectMouseEvent(a2dCanvasObjectMouseEvent &event)
handler for EVT_CANVASOBJECT_MOUSE_EVENT
Definition: canwidget.cpp:288
a2dCanvasObject * IsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent)
If the position (x,y) is within the object return this.
Definition: canobj.cpp:3415
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
bool GetChildrenOnSameLayer() const
are children rendered on the same layer as this object?
Definition: canobj.h:1432
bool Invert(void)
Invert matrix.
Definition: afmatrix.cpp:197
a2dWidgetButton is a a2dCanvasObject based button in a canvas
Definition: canwidget.h:43
const a2dAffineMatrix & GetTransform() const
get the user-to-world transform matrix.
Definition: drawer2d.h:500
virtual bool WalkTask(wxObject *parent, wxObject *object, a2dWalkEvent event)
called from within a2dObject&#39;s and derived classes
Definition: gen.cpp:5265
double GetMinY() const
get minimum Y of the boundingbox
Definition: bbox.cpp:310
the a2dDrawingPart is a a2dView specially designed for displaying parts of a a2dDrawing. It uses a a2dDrawer2D to actually redraw things from the document, by giving that a2dDrawer2D as drawing context to the document, and telling the document to redraw a certain rectangular area. At that last is what this class is for. It optimizes the areas to be redrawn after object in the document were changed. To do that it combines redraw areas to a minimal set of redrawing areas. All the administration for this and the way things will be redrawn is from this view.
#define EVT_BUTTON_ANY(func)
wxEvtHandler macro
Definition: comevt.h:44
~a2dWidgetButton()
destructor
Definition: canwidget.cpp:77
virtual bool DoUpdate(UpdateMode mode, const a2dBoundingBox &childbox, const a2dBoundingBox &clipbox, const a2dBoundingBox &propbox)
Update derived Object specific things ( mainly boundingbox)
Definition: canwidget.cpp:135
A2DGENERALDLLEXP a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd
id for a2dWalkEvent issued from within a2dWalkerIOHandler
a2dBoundingBox m_bbox
boundingbox in world coordinates
Definition: canobj.h:2539
a2dWindowMM
Definition: rectangle.h:186
virtual void DoRender(a2dIterC &ic, OVERLAP clipparent)
render derived object
Definition: canwidget.cpp:243
class a2dCommand * m_docviewCommand
Definition: canwidget.h:258
void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: canwidget.cpp:81
double m_rely
(world coordinates) hit point y relative to the canvas object its parent object(s) ...
Definition: canobj.h:291
a2dDocumentRenderStyle GetDrawStyle()
get drawstyles used for drawing the document
Definition: canobj.h:3319
CloneOptions
options for cloning
Definition: gen.h:1200
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
virtual void DoWalker(wxObject *parent, a2dWalkerIOHandler &handler)
iterate over this object and its children
Definition: canobj.cpp:5504
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
general canvas module declarations and classes
a base command for the a2dCommandProcessor
Definition: comevt.h:140
canwidget.cpp Source File -- Sun Oct 12 2014 17:04:15 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation