wxArt2D
canvas.h
Go to the documentation of this file.
1 /*! \file wx/canvas/canvas.h
2  \brief a2dCanvas uses a2dCanvasView for displaying a view on a a2dCanvasDocument.
3 
4  a2dCanvas is doing no more then displaying the view in a window, and taking care that
5  the view is correctly set when scrolling the view, or when resizing the window.
6  When receiving a paint event on the window, it tells the view to redisplay the
7  damaged parts. The view then takes those parts from its drawing buffer or if there is not one,
8  start redrawing the document where needed.
9 
10  \author Robert Roebling and Klaas Holwerda
11 
12  Copyright: 2000-2004 (c) Robert Roebling
13 
14  Licence: wxWidgets Licence
15 
16  RCS-ID: $Id: canvas.h,v 1.17 2008/09/02 19:42:00 titato Exp $
17 */
18 
19 #ifndef __A2DCANVAS_H__
20 #define __A2DCANVAS_H__
21 
22 #ifndef WX_PRECOMP
23 #include "wx/wx.h"
24 #endif
25 
26 #include "wx/image.h"
27 #include "wx/geometry.h"
28 #include "wx/canvas/candefs.h"
29 #include "wx/canvas/canobj.h"
30 #include "wx/artbase/bbox.h"
31 #include "wx/canvas/drawer.h"
32 
33 //! a2dCanvas is used to display one of the a2dCanvasObjects which are part of a a2dCanvasDocument object and all that is nested in that choosen object.
34 /*!
35 This is a canvas that defines the viewport in world coordinates.
36 The area of the a2dCanvasDocument drawing in world coordinates that is visible on the canvas
37 can be set, which is called mapping.
38 Parts of this area can be zoomed into resulting in scroll bars
39 to be displayed.
40 
41 Most functions here just redirect the calls to the member a2dCanvasView.
42 They are available for convenience, but all of them can be accessed through the GetCanvasView()
43 member function also.
44 
45 \sa a2dCanvasView for more documentation.
46 
47 The main thing done is to have the result of the a2dCanvasView rendering, blitted to the screen.
48 The scrolling bars adjust the a2dCanvasView mapping to have the right mapping again after a scroll.
49 It is optimized to miminize redrawing.
50 
51 An update of the damaged parts will blitted from the a2dCanvasView buffer to the screen.
52 This is done in Idle time, but can also be forced.
53 
54 Settings like background drawing and grid drawing is done through the a2dCanvasView member.
55 
56 The area of the drawing in world coordinates that is visible on the canvas
57 can be set.
58 Parts of this area can be zoomed into resulting in scroll bars
59 to be displayed.
60 
61 \sa a2dCanvasView
62 \sa a2dMemDcDrawer
63 \sa a2dCanvasDocument
64 \sa a2dCanvasObject
65 
66  \ingroup drawer docview
67 */
68 class A2DCANVASDLLEXP a2dCanvas: public wxWindow
69 {
70 public:
71 
72  //!constructor
73  /*!
74  construct a canvas window.
75 
76  Internal a a2dDrawingPart and a2dDrawing are created
77  to render all objects stored in the a2dDrawing into this a2dCanvas window.
78 
79  The document and view or deleted in the destructor.
80 
81  \remark used for standalone a2dCanvas windows.
82 
83  \param parent parent window (use wxNO_FULL_REPAINT_ON_RESIZE on parent wxFrame)
84  \param id window id
85  \param pos position of window
86  \param size size of window
87  \param style type of window (wxHSCROLL|wxVSCROLL)
88  \param drawer2D the drawer to be used to render to the window ( construct with zero size, it will be set to the canvas size )
89  If 0 the default is a2dMemDcDrawer()
90  */
91  a2dCanvas( wxWindow* parent, wxWindowID id = -1,
92  const wxPoint& pos = wxDefaultPosition,
93  const wxSize& size = wxDefaultSize,
94  long style = wxScrolledWindowStyle, a2dDrawer2D* drawer2D = 0 );
95 
96  //!constructor
97  /*!
98  construct a canvas window, normally created by a a2dCanvasView/wxView.
99 
100  \remark used when using a2dDocumentCommandProcessor classes.
101 
102  \param view a2dCanvasView object used to render into this window.
103  \param parent parent window (use wxNO_FULL_REPAINT_ON_RESIZE on parent wxFrame)
104  \param id window id
105  \param pos position of window
106  \param size size of window
107  \param style type of window (wxHSCROLL|wxVSCROLL)
108  */
109  a2dCanvas( a2dDrawingPart* drawingPart, wxWindow* parent, wxWindowID id = -1,
110  const wxPoint& pos = wxDefaultPosition,
111  const wxSize& size = wxDefaultSize,
112  long style = wxScrolledWindowStyle );
113 
114  //!destructor
115  /*!when a tool controller was set is will be deleted also.
116  */
117  virtual ~a2dCanvas();
118 
119  a2dDrawingPart* GetDrawingPart() { return m_drawingPart; }
120 
121  void SetDrawingPart( a2dDrawingPart* drawpart );
122 
123  a2dDrawing* GetDrawing() const;
124 
125  void SetDrawing( a2dDrawing* drawing );
126 
127  //! Get the drawer of the view
128  a2dDrawer2D* GetDrawer2D() const { return m_drawingPart->GetDrawer2D(); }
129 
130  //! Clears the canvas (like wxWindow::ClearBackground)
131  /*!
132  * Calls internally a2dCanvas::ClearBackground()
133  * Clear() was renamed in wxWin 2.5 to ClearBackground()
134  *
135  * \todo
136  * Remove this method after wxWin 2.6 release.
137  */
138  void ClearBackground();
139 
140  //! Refresh window
141  /*!
142  Next to base class, makes sure all pending objects are processed, and scrolling is set right.
143  */
144  virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL );
145 
146  //!background fill for the canvas
147  void SetBackgroundFill( const a2dFill& backgroundfill );
148 
149  //!Set grid setting for drawing grid in front or back
150  void SetGridAtFront( bool gridatfront ) { m_drawingPart->SetGridAtFront( gridatfront ); }
151 
152  //!Get grid setting for drawing grid in front or back
153  bool GetGridAtFront() { return m_drawingPart->GetGridAtFront(); }
154 
155  //!set stroke used for grid drawing
156  void SetGridStroke( const a2dStroke& gridstroke ) { m_drawingPart->SetGridStroke( gridstroke ); }
157 
158  //!set size of grid circle
159  void SetGridSize( wxUint16 gridsize ) { m_drawingPart->SetGridSize( gridsize ); }
160 
161  //!set brush used for grid drawing
162  void SetGridFill( const a2dFill& gridfill ) { m_drawingPart->SetGridFill( gridfill ); }
163 
164  //!Get grid distance in X
165  double GetGridX() { return m_drawingPart->GetGridX(); }
166 
167  //!Set grid distance in X
168  void SetGridX( double gridx ) { m_drawingPart->SetGridX( gridx ); }
169 
170  //!Get grid distance in Y
171  double GetGridY() { return m_drawingPart->GetGridY(); }
172 
173  //!Set grid distance in Y
174  void SetGridY( double gridy ) { m_drawingPart->SetGridY( gridy ); }
175 
176  //!Set grid on/off
177  void SetGrid( bool grid ) { m_drawingPart->SetGrid( grid ); }
178 
179  //!Get grid setting on/off
180  bool GetGrid() { return m_drawingPart->GetGrid(); }
181 
182  //!Get grid setting for line drawing
183  /*!Note: SetGridSize must be 0, if gridlines=false */
184  void SetGridLines( bool gridlines ) { m_drawingPart->SetGridLines( gridlines ); }
185 
186  //!set grid to draw lines instead of points
187  bool GetGridLines() { return m_drawingPart->GetGridLines(); }
188 
189  //!Set showorigin on/off
190  void SetShowOrigin( bool show ) { m_drawingPart->SetShowOrigin( show ); }
191 
192  //!set if the Yaxis goes up or down
193  void SetYaxis( bool up );
194 
195  //!get currently used Yaxis setting
196  bool GetYaxis() const;
197 
198  //!set if the drawing should be resclaed on a window resize
199  /*!
200  When set, each resize of the window, result in scaling the visible draing up or down.
201  The center of the window in world coordinates is kept the same.
202  The drawing itself is scaled to the smallest of the width or height.
203 
204  When m_ContinuesSizeUpdate is set each resize will scale the drawing, else
205  only after a double buffer enlargement.
206  */
207  void SetScaleOnResize( bool val ) { m_scaleonresize = val; }
208 
209  //!get current setting for ScaleOnResize
210  bool GetScaleOnResize() { return m_scaleonresize; }
211 
212  //!set if the drawing should be rescaled on a window resize
213  void SetContinuesSizeUpdate( bool val ) { m_ContinuesSizeUpdate = val; }
214 
215  //!get current setting for ContinuesSizeUpdate flag
216  bool GetContinuesSizeUpdate() { return m_ContinuesSizeUpdate; }
217 
218  //!append an eventhandler to the list, this event handler will be called if the other skipped the event to process.
219  void AppendEventHandler( wxEvtHandler* handler );
220 
221  //!remove last event handler in the list
222  wxEvtHandler* RemoveLastEventHandler( bool deleteHandler );
223 
224  //!Returns if canvas is frozen.
225  bool IsFrozen() { return m_frozen; }
226 
227  //!prevent changing the a2dCanvasView buffer and blitting it to the window
228  /*! To make sure the contents displayed into the a2dCanvasView buffer does not change.
229  Pending objects inside a root will be added to the update list of the a2dCanvasView,
230  but not redrawn into the buffer until Thaw.
231  */
232  void Freeze();
233 
234  //!allow a2dCanvasView buffer to be changed and blitting it to the window
235  /*! Enable updating of the a2dCanvasView buffer contents.
236  */
237  void Thaw();
238 
239  //!Give the virtual size to be displayed, the mappingmatrix will be calculated.
240  /*!
241  The current window size in pixels is used to calculate the mapping such that
242  at least it will display all of the area given.
243 
244  Setting virtual area to boundingbox of a drawing (currently visible ShowObject()
245  \code
246  m_worldcanvas->SetMappingWidthHeight(m_worldcanvas->GetShowObject()->GetXMin(),
247  m_worldcanvas->GetShowObject()->GetYMin(),
248  m_worldcanvas->GetShowObject()->GetWidth(),
249  m_worldcanvas->GetShowObject()->GetHeight())
250  \endcode
251 
252  \remark do not use during start up since window size is not well defined in that case resulting in
253  \remark bad settings for the mapping.
254 
255  \param vx1 minimum world x coordinate
256  \param vy1 minimum world y coordiante ( either Lower or Upper Left corner depending on SetYaxis() )
257  \param width minimum width in world coordinates which we want to display on this window
258  \param height minimum height in world coordinates which we want to display on this window
259  \param scrollbars: The scroll region are set to display this also.
260  */
261  void SetMappingWidthHeight( double vx1, double vy1, double width, double height, bool scrollbars );
262 
263  //! use the boundingbox of the ShowObject to set the mapping such that it will be displayed completely.
264  /*!
265  \param centre if true centre on window, else to (0,0) of device
266  */
267  void SetMappingShowAll( bool centre = true );
268 
269  //! zoom out from the center by a factor n (zoomin if <1 )
270  void ZoomOut( double n );
271 
272  //! zoom out from position x,y by a factor n (zoomin if <1 )
273  void ZoomOutAtXy( int x, int y, double n );
274 
275  //!Give the virtual size to be displayed, the mappingmatrix will be calculated.
276  /*!
277  To display all of a drawing, set this here to the boundingbox of the show object
278  of the canvas.
279  So vx1 and vx2 to the miminum x and y of the boundingbox.
280  Calculate xpp and ypp in such a manner that it will show the whole drawing.
281 
282  Setting virtual area to boundingbox of a drawing (currently visible group)
283 
284  \code
285  int dx2,dy2;
286  m_canvas->GetClientSize(&dx2,&dy2);
287  double xupp=(m_canvas->GetShowObject()->GetWidth())/dx2;
288  double yupp=(m_canvas->GetShowObject()->GetHeight())/dy2;
289  if (yupp > xupp)
290  xupp=yupp;
291  m_worldcanvas->SetMappingUpp(m_worldcanvas->GetShowObject->GetXMin(),
292  m_worldcanvas->GetShowObject->GetYMin(),xupp,xupp);
293  \endcode
294 
295  If a scrollable area is set, it will be called also to adjust it.
296  \param vx1 minimum world x coordinate
297  \param vy1 minimum world y coordiante ( either Lower or Upper Left corner depending on SetYaxis() )
298  \param xpp: Number of world units per pixel in x
299  \param ypp: Number of world units per pixel in y
300  */
301  void SetMappingUpp( double vx1, double vy1, double xpp, double ypp );
302 
303  //! set scrollbars
304  /*!
305  \param pixelsPerUnitX the number of pixels per world unit in X
306  \param pixelsPerUnitY the number of pixels per world unit in Y
307  \param noUnitsX number of scroll units in X
308  \param noUnitsY number of scroll units in Y
309  \param xPos position of thumb in X
310  \param yPos position of thumb in Y
311  */
312  void SetScrollbars( double pixelsPerUnitX, double pixelsPerUnitY,
313  double noUnitsX, double noUnitsY,
314  double xPos = 0, double yPos = 0 );
315 
316  //!get Minimal X of the visible part in world coordinates
317  double GetVisibleMinX() const;
318  //!get Minimal X of the visible part in world coordinates
319  double GetVisibleMinY() const;
320  //!get Maximum X of the visible part in world coordinates
321  double GetVisibleMaxX() const;
322  //!get Maximum Y of the visible part in world coordinates
323  double GetVisibleMaxY() const;
324  //!get Width of visible part in world coordinates
325  double GetVisibleWidth() const;
326  //!get Height of visible part in world coordinates
327  double GetVisibleHeight() const;
328 
329  //!\return xpp Number of world units per pixel in x
330  double GetUppX() const;
331 
332  //!\return ypp Number of world units per pixel in y
333  double GetUppY() const;
334 
335  //!scroll the window in world coordinates
336  /*!
337  In case of FixScrollMaximum it will be done
338  if it fits within the scrollmaximum else best possible.
339  \return true if succesfull.
340  */
341  bool ScrollWindowConstrained( double dx, double dy );
342 
343  //!to set the total area in world coordinates that can be scrolled to.
344  /*!To be able to scroll the whole of a drawing, set this here to the boundingbox
345  of the root group of the canvas.
346  If the current Virtual display area does not fit inside the scrollable area,
347  and the FixScrollMaximum is not set, the scroll area will be adjusted to have it fit.
348  else scrollbars are disabled and return value is false.
349  */
350  bool SetScrollMaximum( double vx1, double vy1, double vx2, double vy2 );
351 
352  //! Set horizontal scrollbar position in world coordinates
353  void SetMinX( double vxmin );
354  //! Set vertical scrollbar position in world coordinates
355  void SetMinY( double vymin );
356 
357  //!get the minimum scroll X in world coordinates that can be scrolled to
358  double GetScrollMinX() const { return m_virtm_minX; }
359  //!get the minimum scroll Y in world coordinates that can be scrolled to
360  double GetScrollMinY() const { return m_virtm_minY; }
361  //!get the maximum scroll X in world coordinates that can be scrolled to
362  double GetScrollMaxX() const { return m_virtm_maxX; }
363  //!get the maximum scroll Y in world coordinates that can be scrolled to
364  double GetScrollMaxY() const { return m_virtm_maxY; }
365 
366  //!set granularity (step size) for scrolling in world units for Horizontal Scrollbar
367  /*!
368  Scrolling is done when receiving wxEVT_SCROLLWIN_LINEUP wxEVT_SCROLLWIN_LINEDOWN.
369  This is function is also internaly used to redraw the scrollbar
370  */
371  void SetScrollStepX( double x );
372 
373  //!set granularity (step size) for scrolling in world units for Vertical Scrollbar
374  /*!
375  Scrolling is done when receiving wxEVT_SCROLLWIN_LINEUP wxEVT_SCROLLWIN_LINEDOWN.
376  This is function is also internaly used to redraw the scrollbar
377  */
378  void SetScrollStepY( double y );
379 
380  //!at all times the virtual displayed area will stay within the maximum scrollable area
381  void FixScrollMaximum( bool fixed ) { m_scrollmaxfixed = fixed; }
382 
383  //! show scrollbars if set true.
384  void SetScrollBarsVisible( bool onoff );
385 
386  //! if set, when dragging scrollbar handles, do a redraw, esle only at release.
387  void SetScrollTrackDraw( bool scrollTrackDraw ) { m_scrollTrackDraw = scrollTrackDraw; }
388 
389  //! if set, when dragging scrollbar handles, do a redraw, esle only at release.
390  bool GetScrollTrackDraw() const { return m_scrollTrackDraw; }
391 
392  //! when scrolling outside the maximum scroll region and
393  /*!
394  m_scrollmaxfixed is true, do clip virtual area if this is true
395  */
396  void ClipToScrollMaximum( bool clip ) { m_clipToScrollMax = clip; }
397 
398  //!check if the given scroll in worldcoordinates (X and Y) will stay within ScrollMaximum.
399  /*!
400  \remark ONLY if m_scrollmaxfixed is set, else it return true in all cases.
401  */
402  bool CheckInsideScrollMaximum( double worldminx, double worldminy );
403 
404  //!set object available in the a2dCanvasDocument to be shown on the canvas
405  /*!
406  \param name: name of top object
407  \return pointer to the object found else NULL
408  */
409  a2dCanvasObject* SetShowObject( const wxString& name );
410 
411  //!set top object available in the a2dCanvasDocument to be shown on the canvas
412  /*!
413  \param obj: pointer to object to show
414  */
415  bool SetShowObject( a2dCanvasObject* obj );
416 
417  //!return pointer of then currently shown object on the canvas.
418  /*!
419  \return pointer to the current object that is shown.
420  */
421  a2dCanvasObject* GetShowObject() const { return m_drawingPart->GetShowObject(); }
422 
423  //!do a hittest on the canvas at coordinates x,y
424  /*!
425  \param x: x of point to do hittest
426  \param y: y of point to do hittest
427  \param layer only if object is on this layer or if set to wxLAYER_ALL ignore layer id.
428  \param how in which way the object was hit (stroke, fill, ...)
429  \return the top object that was hit (e.g.in case of groups)
430  \remark hit margin is defined in a2dCanvasDocument containing the root group
431  */
432  a2dCanvasObject* IsHitWorld(
433  double x, double y,
434  int layer = wxLAYER_ALL,
436  );
437 
438  //! \see a2dCanvasView::SetMouseEvents()
439  void SetMouseEvents( bool onoff );
440 
441  //! \see a2dCanvasView::GetMouseEvents()
442  bool GetMouseEvents();
443 
444  //! write what you see to an SVG( scalable vector graphics file )
445  bool WriteSVG( const wxString& filename, double Width, double Height, wxString unit );
446 
447  bool ProcessEvent( wxEvent& event );
448 
449 protected:
450 
451  //! adjust either the maximum scrollable area to contain the current visible area or
452  //! if fixed, change the visible area to stay within.
453  bool MakeVirtualMaxFitVisibleArea();
454 
455  //! same as normal client size, but when dx or dy is zero, it will be set to 1000.
456  /*!
457  This is to prevent an irational mapping and/or divide by zero problems.
458  */
459  void GetSaveClientSize( int* dvx, int* dvy ) const;
460 
461  //!virtual coordinates of total scrollable area for the drawing, used to set scrollbars
462  double m_virtm_minX, m_virtm_minY, m_virtm_maxX, m_virtm_maxY;
463 
464  void OnActivate( wxActivateEvent& event );
465 
466  //! repaint damaged araes, taking into acount non updated araes in a2dCanvasView.
467  void OnPaint( wxPaintEvent& event );
468 
469  //! resize, adjusting buffer of a2dCanvasView if needed.
470  void OnSize( wxSizeEvent& event );
471 
472  //! mouse wheel handler
473  void OnWheel( wxMouseEvent& event );
474 
475  //! Not yet implemented
476  void OnEraseBackground( wxEraseEvent& event );
477 
478  //!what to do while scrollling
479  void OnScroll( wxScrollWinEvent& event );
480 
481  //!what to do for characters received
482  void OnChar( wxKeyEvent& event );
483 
484  //! remove all pending update areas in a2dCanvasView
485  void DeleteAllPendingAreas();
486 
487  //!are scroll bars active?
489 
490  //! set true by wxWindow style parameter wxVSCROLL | wxHSCROLL
492 
493  //! when because resizing or setting maximum scrollable area, it becomes smaller then the visible area,
494  /*! we can adjust it or adjust units per pixel to make it fit again.
495  */
497 
498  //!check if the given scroll in pixels (X and Y) will be oke to stay within ScrollMaximum.
499  /*!
500  \remark ONLY if m_scrollmaxfixed is set, else it return true in all cases.
501  \param dy > contents of window moves up
502  \param dx > contents of window moves right
503  */
504  bool CheckInsideScrollMaximum( int dx, int dy );
505 
506  void Init( int dvx, int dvy );
507 
508  //! Total range of X scroll bar, which gets always adjusted by the m_scrollstepx
509  /*!
510  \remark used intenal
511  */
513 
514  //! Total range of Y scroll bar, which gets always adjusted by the m_scrollstepy
515  /*!
516  \remark used internal
517  */
519 
520  //!current thumbsize of X scrollbar which gets always adjusted by the m_scrollstepx
521  /*!
522  \remark used internal
523  */
524  int m_thumbx;
525 
526  //!current thumbsize of Y scrollbar which gets always adjusted by the m_scrollstepy
527  /*!
528  \remark used internal
529  */
530  int m_thumby;
531 
532  //!step for X line up and down in world coordinates
534 
535  //!step for Y line up and down in world coordinates
537 
538  //!are scroll bars active?
540 
541  //!a flag for ignoring size events when scrollbars change
543 
544  //!a flag for ignoring size events when scrollbars change
546 
547  //!flag if there is a horizontal scrollbar
549 
550  //!flag if there is a vertical scrollbar
552 
553  //!stay within maximum scrollable area
555 
556  //! see ClipToScrollMaximum()
558 
559  //! redraw at drag fo scrollbars
561 
562  //!to optimize onsize events
563  int m_oldw, m_oldh, m_prevh, m_prevw, m_prevClientW, m_prevClientH;
564 
565  //!oversize of buffer compared to screen width and height
566  int m_delta;
567 
568  //!prevent updating activity if true
569  bool m_frozen;
570 
571  //!in future the offset from window to drawer in X
573 
574  //!in future the offset from window to drawer in Y
576 
577  a2dSmrtPtr<a2dDrawingPart> m_drawingPart;
578 
579  //! prevent SetScrollMaximum beeing called recursively
581 
582  //! at small resize also update the buffer directly.
583  /*!
584  When false, updates only happen when a new buffersize is allocated.
585  */
587 
588  //! used to normalize scroll thumb and range
590 
591  //! set if the canvas own the drawing
593 
594  DECLARE_CLASS( a2dCanvas )
595  DECLARE_EVENT_TABLE()
596 
597 };
598 
599 #endif /* __A2DCANVAS_H__ */
600 
601 
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
double GetScrollMinX() const
get the minimum scroll X in world coordinates that can be scrolled to
Definition: canvas.h:358
void SetShowOrigin(bool show)
Set showorigin on/off.
Definition: canvas.h:190
int m_oldw
to optimize onsize events
Definition: canvas.h:563
int m_normalize
used to normalize scroll thumb and range
Definition: canvas.h:589
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
void SetGridSize(wxUint16 gridsize)
set size of grid circle
Definition: canvas.h:159
bool m_aboveScrolledFixedAdjustUpp
when because resizing or setting maximum scrollable area, it becomes smaller then the visible area...
Definition: canvas.h:496
bool GetGrid()
Get grid setting on/off.
Definition: canvas.h:180
bool m_ContinuesSizeUpdate
at small resize also update the buffer directly.
Definition: canvas.h:586
bool m_has_x_scroll
flag if there is a horizontal scrollbar
Definition: canvas.h:548
bool GetContinuesSizeUpdate()
get current setting for ContinuesSizeUpdate flag
Definition: canvas.h:216
int m_delta
oversize of buffer compared to screen width and height
Definition: canvas.h:566
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the canvas.
Definition: canvas.h:421
double GetScrollMaxX() const
get the maximum scroll X in world coordinates that can be scrolled to
Definition: canvas.h:362
The base class for all drawable objects in a a2dCanvasDocument.
int m_thumbx
current thumbsize of X scrollbar which gets always adjusted by the m_scrollstepx
Definition: canvas.h:524
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
int m_oversizeX
in future the offset from window to drawer in X
Definition: canvas.h:572
bool m_scrolled
are scroll bars active?
Definition: canvas.h:539
defenitions an no more
void FixScrollMaximum(bool fixed)
at all times the virtual displayed area will stay within the maximum scrollable area ...
Definition: canvas.h:381
bool m_frozen
prevent updating activity if true
Definition: canvas.h:569
int m_oversizeY
in future the offset from window to drawer in Y
Definition: canvas.h:575
bool m_yscroll_changed
a flag for ignoring size events when scrollbars change
Definition: canvas.h:545
void SetGridY(double gridy)
Set grid distance in Y.
Definition: canvas.h:174
bool m_xscroll_changed
a flag for ignoring size events when scrollbars change
Definition: canvas.h:542
void SetGridFill(const a2dFill &gridfill)
set brush used for grid drawing
Definition: canvas.h:162
bool GetScaleOnResize()
get current setting for ScaleOnResize
Definition: canvas.h:210
void SetGridX(double gridx)
Set grid distance in X.
Definition: canvas.h:168
a2dHitOption
Enum for hit test options.
Definition: canobj.h:76
bounding class for optimizing drawing speed.
Drawing context abstraction.
Definition: drawer2d.h:177
void SetScrollTrackDraw(bool scrollTrackDraw)
if set, when dragging scrollbar handles, do a redraw, esle only at release.
Definition: canvas.h:387
double GetScrollMaxY() const
get the maximum scroll Y in world coordinates that can be scrolled to
Definition: canvas.h:364
void SetGrid(bool grid)
Set grid on/off.
Definition: canvas.h:177
double GetGridX()
Get grid distance in X.
Definition: canvas.h:165
double m_virtm_minX
virtual coordinates of total scrollable area for the drawing, used to set scrollbars ...
Definition: canvas.h:462
int m_thumby
current thumbsize of Y scrollbar which gets always adjusted by the m_scrollstepy
Definition: canvas.h:530
void SetContinuesSizeUpdate(bool val)
set if the drawing should be rescaled on a window resize
Definition: canvas.h:213
if set, respect layer order, hit testing is done per layer from the top.
Definition: canobj.h:82
bool m_wantScroll
set true by wxWindow style parameter wxVSCROLL | wxHSCROLL
Definition: canvas.h:491
void SetScaleOnResize(bool val)
set if the drawing should be resclaed on a window resize
Definition: canvas.h:207
bool GetScrollTrackDraw() const
if set, when dragging scrollbar handles, do a redraw, esle only at release.
Definition: canvas.h:390
void SetGridAtFront(bool gridatfront)
Set grid setting for drawing grid in front or back.
Definition: canvas.h:150
bool m_scrollTrackDraw
redraw at drag fo scrollbars
Definition: canvas.h:560
double m_scrollstepy
step for Y line up and down in world coordinates
Definition: canvas.h:536
bool m_clipToScrollMax
see ClipToScrollMaximum()
Definition: canvas.h:557
void SetGridStroke(const a2dStroke &gridstroke)
set stroke used for grid drawing
Definition: canvas.h:156
double GetGridY()
Get grid distance in Y.
Definition: canvas.h:171
if set, don&#39;t hit test the root object or object for which IsHitWorld is called
Definition: canobj.h:87
a2dCanvas is used to display one of the a2dCanvasObjects which are part of a a2dCanvasDocument object...
Definition: canvas.h:68
double GetScrollMinY() const
get the minimum scroll Y in world coordinates that can be scrolled to
Definition: canvas.h:360
bool GetGridAtFront()
Get grid setting for drawing grid in front or back.
Definition: canvas.h:153
int m_scrollrangex
Total range of X scroll bar, which gets always adjusted by the m_scrollstepx.
Definition: canvas.h:512
bool IsFrozen()
Returns if canvas is frozen.
Definition: canvas.h:225
bool GetGridLines()
set grid to draw lines instead of points
Definition: canvas.h:187
a2dDrawingPtr m_drawing
set if the canvas own the drawing
Definition: canvas.h:592
void ClipToScrollMaximum(bool clip)
when scrolling outside the maximum scroll region and
Definition: canvas.h:396
bool m_has_y_scroll
flag if there is a vertical scrollbar
Definition: canvas.h:551
bool m_inSetScrollMaximum
prevent SetScrollMaximum beeing called recursively
Definition: canvas.h:580
a2dDrawer2D * GetDrawer2D() const
Get the drawer of the view.
Definition: canvas.h:128
int m_scrollrangey
Total range of Y scroll bar, which gets always adjusted by the m_scrollstepy.
Definition: canvas.h:518
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.
bool m_scrollmaxfixed
stay within maximum scrollable area
Definition: canvas.h:554
double m_scrollstepx
step for X line up and down in world coordinates
Definition: canvas.h:533
void SetGridLines(bool gridlines)
Get grid setting for line drawing.
Definition: canvas.h:184
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
bool m_scaleonresize
are scroll bars active?
Definition: canvas.h:488
canvas.h Source File -- Sun Oct 12 2014 17:04:14 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation