81092892a7f519e44a7c40227abe5c9d2e3f7327
[scilab.git] / scilab / modules / renderer / src / cpp / DrawingBridge.cpp
1 /*------------------------------------------------------------------------*/
2 /* file: DrawingBridge.cpp                                                */
3 /* Copyright INRIA 2007                                                   */
4 /* Authors : Jean-Baptiste Silvy                                          */
5 /* desc : Functions to create and access a drawer of graphic handles      */
6 /*------------------------------------------------------------------------*/
7
8 #include "DrawingBridge.h"
9 #include "getHandleDrawer.h"
10 #include "DrawableObjectFactory.h"
11
12 extern "C"
13 {
14 #include "../../../graphics/includes/GetProperty.h"
15 }
16
17 using namespace sciGraphics ;
18
19 /*------------------------------------------------------------------------------------------*/
20 void destroyHandleDrawer( sciPointObj * pObj )
21 {
22   /* don't call getHandleDrawer for the test, otherwise a drawer will be created */
23   if ( pObj->pDrawer != NULL )
24   {
25     delete getHandleDrawer( pObj ) ;
26     delete (DrawableObjectWrapper *)pObj->pDrawer ;
27     pObj->pDrawer = NULL ;
28   }
29 }
30 /*------------------------------------------------------------------------------------------*/
31 void sciDrawObj( sciPointObj * pObj )
32 {
33   /* force total redraw */
34   /* we need to recreate a new one */
35   DrawableObjectFactory updater ;
36   updater.setGraphicObj( pObj ) ;
37   updater.update() ;
38   getHandleDrawer(pObj)->hasChanged() ;
39   /* redisplay everything, including this handle */
40   getHandleDrawer( sciGetParentFigure( pObj ) )->display() ;
41 }
42 /*------------------------------------------------------------------------------------------*/
43 void displayChildren( sciPointObj * pObj )
44 {
45   getHandleDrawer( pObj )->displayChildren() ;
46 }
47 /*------------------------------------------------------------------------------------------*/
48 void redrawHierarchy( sciPointObj * pObj )
49 {
50   getHandleDrawer(pObj)->familyHasChanged();
51   getHandleDrawer(pObj)->display();
52 }
53 /*------------------------------------------------------------------------------------------*/