0.3.1
[qanava.git] / src / qanGrid.h
blob2d7d19f646cb95ffa37b563ce6b083ba41cb267a
1 /*
2 Qanava - Graph drawing library for QT
3 Copyright (C) 2006 Benoit AUTHEMAN
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; 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 laGrid.h
24 // \author Benoit Autheman (benoit@libqanava.org)
25 // \date 2004 December 05
26 //-----------------------------------------------------------------------------
29 #ifndef qanGrid_h
30 #define qanGrid_h
33 // QT headers
34 #include <QLineF>
35 #include <QRectF>
36 #include <QSizeF>
37 #include <QColor>
40 //-----------------------------------------------------------------------------
41 namespace qan { // ::qan
43 //! Defines the necessary methods to build a grid on a virtual canvas (draw lines, text, manage resizing, etc.).
44 /*!
45 Grid geometry is added dynamically using virtual methods addLine(), addRectangle() and addText() implemented
46 in a concrete grid for a particular graphic subsystem (for exemple QT GraphView and GridCheckBoardItem).
48 \sa GridCheckBoardItem
49 \nosubgrouping
51 class Grid
53 /*! \name Grid Constructor and Destructor *///-------------------------
54 //@{
55 public:
57 //! Grid constructor with eventual layout initialization.
58 Grid( ) { }
60 //! Grid destructor.
61 virtual ~Grid( ) { }
63 private:
65 Grid( const Grid& g );
66 //@}
67 //---------------------------------------------------------------------
71 /*! \name Layout and Size Management *///-----------------------------
72 //@{
73 public:
75 //! Resize the grid (ie, take care of resizing the specified horizontal and vertical lines, and notify the grid layout of the resize).
76 virtual void resize( QSizeF s ) { }
77 //@}
78 //---------------------------------------------------------------------
82 /*! \name Grid Construction Management *///---------------------------
83 //@{
84 public:
86 //! Add a grid line on the canvas with specific line settings.
87 virtual void addLine( QLineF l, float w = 1, bool dash = false, bool dot = false ) = 0;
89 //! Add a grid rectangle on the canvas with specific size and color settings.
90 virtual void addRectangle( QRectF r, QColor c ) = 0;
92 //! Add a grid text label on the canvas.
93 virtual void addText( const QString& text, QPointF p, bool bold = false ) = 0;
95 //! Add an horizontal line to the grid canvas (horizontal lines are automatically resized when the grid canvas is resized).
96 virtual void addHorizontalLine( QLineF l, int w = 1, bool dash = false, bool dot = false ) = 0;
98 //! Add a vertical line to the grid canvas (vertical lines are automatically resized when the grid canvas is resized).
99 virtual void addVerticalLine( QLineF l, int w = 1, bool dash = false, bool dot = false ) = 0;
100 //@}
101 //---------------------------------------------------------------------
103 } // ::qan
104 //-----------------------------------------------------------------------------
107 #endif // qanGrid_h