UBAbstractDrawRuler.h 2.62 KB
Newer Older
Claudio Valerio's avatar
Claudio Valerio committed
1
/*
2
 * Copyright (C) 2012 Webdoc SA
Claudio Valerio's avatar
Claudio Valerio committed
3
 *
4 5 6 7 8 9 10 11 12 13
 * This file is part of Open-Sankoré.
 *
 * Open-Sankoré is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation, version 2,
 * with a specific linking exception for the OpenSSL project's
 * "OpenSSL" library (or with modified versions of it that use the
 * same license as the "OpenSSL" library).
 *
 * Open-Sankoré is distributed in the hope that it will be useful,
Claudio Valerio's avatar
Claudio Valerio committed
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
Claudio Valerio's avatar
Claudio Valerio committed
17
 *
18 19 20
 * You should have received a copy of the GNU Library General Public
 * License along with Open-Sankoré; if not, see
 * <http://www.gnu.org/licenses/>.
Claudio Valerio's avatar
Claudio Valerio committed
21
 */
22 23


24 25 26 27
#ifndef UB_ABSTRACTDRAWRULER_H_
#define UB_ABSTRACTDRAWRULER_H_

#include <QtGui>
28 29
#include "frameworks/UBGeometryUtils.h"

30
class UBGraphicsScene;
31
class QGraphicsSvgItem;
32 33 34

class UBAbstractDrawRuler : public QObject
{
35
    Q_OBJECT
36

37 38 39
public:
    UBAbstractDrawRuler();
    ~UBAbstractDrawRuler();
40

41
    void create(QGraphicsItem& item);
42

43 44 45
    virtual void StartLine(const QPointF& position, qreal width);
    virtual void DrawLine(const QPointF& position, qreal width);
    virtual void EndLine();
46

unknown's avatar
unknown committed
47 48 49
    signals:
        void hidden();

50
protected:
51

52
    void paint();
53

54
    virtual UBGraphicsScene* scene() const = 0;
55

unknown's avatar
unknown committed
56
    virtual void rotateAroundCenter(qreal angle) = 0;
57

unknown's avatar
unknown committed
58
    virtual QPointF rotationCenter() const = 0;
59 60
    virtual QRectF closeButtonRect() const = 0;
    virtual void paintGraduations(QPainter *painter) = 0;
61

62 63 64
    bool mShowButtons;
    QGraphicsSvgItem* mCloseSvgItem;
    qreal mAntiScaleRatio;
65

66
    QPointF startDrawPosition;
67

68 69 70 71
    QCursor moveCursor() const;
    QCursor rotateCursor() const;
    QCursor closeCursor() const;
    QCursor drawRulerLineCursor() const;
72

73 74 75 76
    QColor  drawColor() const;
    QColor  middleFillColor() const;
    QColor  edgeFillColor() const;
    QFont   font() const;
77

78 79 80 81 82 83 84
    static const QColor sLightBackgroundEdgeFillColor;
    static const QColor sLightBackgroundMiddleFillColor;
    static const QColor sLightBackgroundDrawColor;
    static const QColor sDarkBackgroundEdgeFillColor;
    static const QColor sDarkBackgroundMiddleFillColor;
    static const QColor sDarkBackgroundDrawColor;

Anatoly Mihalchenko's avatar
Anatoly Mihalchenko committed
85 86 87 88 89 90 91
    static const int sLeftEdgeMargin;
    static const int sDegreeToQtAngleUnit;
    static const int sRotationRadius;
    static const int sFillTransparency;
    static const int sDrawTransparency;
    static const int sRoundingRadius;
    int sPixelsPerMillimeter;
92 93
};

94
#endif