~ubuntu-branches/ubuntu/raring/calligra/raring-proposed

« back to all changes in this revision

Viewing changes to 3rdparty/kdgantt/kdganttabstractgrid.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-01-15 17:26:10 UTC
  • mfrom: (1.1.17)
  • Revision ID: package-import@ubuntu.com-20130115172610-b193s9546hyssmym
Tags: 1:2.5.94-0ubuntu1
New upstream RC release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 ** Copyright (C) 2001-2006 Klarälvdalens Datakonsult AB.  All rights reserved.
 
3
 **
 
4
 ** This file is part of the KD Gantt library.
 
5
 **
 
6
 ** This file may be used under the terms of the GNU General Public
 
7
 ** License versions 2.0 or 3.0 as published by the Free Software
 
8
 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
 
9
 ** included in the packaging of this file.  Alternatively you may (at
 
10
 ** your option) use any later version of the GNU General Public
 
11
 ** License if such license has been publicly approved by
 
12
 ** Klarälvdalens Datakonsult AB (or its successors, if any).
 
13
 ** 
 
14
 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
 
15
 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
 
16
 ** A PARTICULAR PURPOSE. Klarälvdalens Datakonsult AB reserves all rights
 
17
 ** not expressly granted herein.
 
18
 ** 
 
19
 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
20
 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
21
 **
 
22
 **********************************************************************/
 
23
#ifndef KDGANTTABSTRACTGRID_H
 
24
#define KDGANTTABSTRACTGRID_H
 
25
 
 
26
#include "kdganttglobal.h"
 
27
#include "kdganttconstraint.h"
 
28
 
 
29
class QPainter;
 
30
class QRectF;
 
31
class QAbstractItemModel;
 
32
class QModelIndex;
 
33
 
 
34
namespace KDGantt {
 
35
    class AbstractRowController;
 
36
    class Span;
 
37
 
 
38
    class KDGANTT_EXPORT AbstractGrid : public QObject {
 
39
        Q_OBJECT
 
40
        KDGANTT_DECLARE_PRIVATE_BASE_POLYMORPHIC( AbstractGrid )
 
41
        friend class GraphicsScene;
 
42
    public:
 
43
        AbstractGrid(QObject* parent = 0);
 
44
        virtual ~AbstractGrid();
 
45
 
 
46
        QAbstractItemModel* model() const;
 
47
        QModelIndex rootIndex() const;
 
48
 
 
49
        virtual Span mapToChart( const QModelIndex& idx ) const = 0;
 
50
        virtual bool mapFromChart( const Span& span, const QModelIndex& idx,
 
51
                                   const QList<Constraint>& constraints=QList<Constraint>() ) const = 0;
 
52
        virtual qreal mapToChart( const QVariant &value ) const;
 
53
        virtual QVariant mapFromChart( qreal x ) const;
 
54
        
 
55
        bool isSatisfiedConstraint( const Constraint& c ) const;
 
56
 
 
57
        virtual void paintGrid( QPainter* painter, const QRectF& sceneRect, const QRectF& exposedRect,
 
58
                                AbstractRowController* rowController = 0, QWidget* widget=0 ) = 0;
 
59
        virtual void paintHeader( QPainter* painter, const QRectF& headerRect, const QRectF& exposedRect,
 
60
                                  qreal offset, QWidget* widget=0 ) = 0;
 
61
        
 
62
        virtual void render( QPainter* /*painter*/,  const QRectF & /*target*/, const QRectF&  /*headerRect*/, const QRectF& /*exposedRect*/, QWidget* /*widget*/, Qt::AspectRatioMode /*aspectRatioMode*/ = Qt::KeepAspectRatio ) {}
 
63
        
 
64
    public Q_SLOTS:
 
65
        /*internal*/ virtual void setModel( QAbstractItemModel* model );
 
66
        /*internal*/ virtual void setRootIndex( const QModelIndex& idx );
 
67
    Q_SIGNALS:
 
68
        void gridChanged();
 
69
    };
 
70
}
 
71
 
 
72
#endif /* KDGANTTABSTRACTGRID_H */
 
73