2 Qanava - Graph drawing library for QT
3 Copyright (C) 2005 Benoit AUTHEMAN
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 //-----------------------------------------------------------------------------
21 // This file is a part of the Qanava software.
23 // \file canItemImpl.h
24 // \author Benoit Autheman (benoit@faktiss.net)
25 // \date 2003 August 05
26 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
38 namespace qan
{ // ::qan
39 namespace can
{ // ::qan::can
41 //! Model a concrete element on a canvas, implemented as QCanvasItem subclasse.
43 <p>The concrete QCanvasItem class type is given as this class parameter (either QCanvasPolygon or
44 QCanvasRectangle for example). This class connect the abstract Qanava can::Item classe to a
45 concrete QCanvasItem graphical object.</p>
47 <p>Coherency between the QT interface (methods from QCanvasItem) and the can::Item one is
48 maintained by ItemImpl, and the two interfaces can be used simultaneously to move the item or
54 template < class CanvasItem
>
55 class ItemImpl
: public Item
, public CanvasItem
57 /*! \name Item Constructor/Destructor *///-----------------
62 ItemImpl( ID id
, Canvas
& canvas
);
64 //! Item virtual destructor.
65 virtual ~ItemImpl( ) { }
67 //-----------------------------------------------------------------
71 /*! \name Sub items management *///-------------------------------
75 //! Resize the canvas of this item to ensure that the canvas is large enought to contain the item bounding rectangle.
76 void refreshCanvasSize( );
79 virtual void hideItem( );
81 //! Show an item that has previously been hidden.
82 virtual void showItem( );
84 //! Move this item (but not the hierarcy of sub items).
85 virtual void moveItem( double x
, double y
);
87 //! Move this item and its hierarchy of sub item by a position delta.
88 virtual void moveItemBy( double dx
, double dy
);
90 //! Get this item hierarchy bounding rectangle.
91 QRect
getBoundingRect( ) const;
93 //! Move this item but not its sub items.
94 virtual void move( double x
, double y
);
96 //! Move this item of delta[x/y] and its sub items.
97 virtual void moveBy( double dx
, double dy
);
99 //! Update the node according to the given style.
100 virtual void updateStyle( const AdvStyle
& ) { }
104 //! Get the item canvas.
105 Canvas
& getCanvas( ) { return _canvas
; }
112 //-----------------------------------------------------------------
115 #include "canItemImpl.hpp"
119 //-----------------------------------------------------------------------------