Use the canonical file name also for the "already open" check
[GPXSee.git] / src / GUI / axisitem.h
blobe6c985df620bb8088bc80a1fb08ec86e9c37547c
1 #ifndef AXISITEM_H
2 #define AXISITEM_H
4 #include <QGraphicsItem>
5 #include <QVector>
6 #include <QLocale>
7 #include <QFont>
8 #include "common/range.h"
10 class AxisItem : public QGraphicsItem
12 public:
13 enum Type {X, Y};
15 AxisItem(Type type, QGraphicsItem *parent = 0);
17 /* Note: The items position is at the 0 point of the axis line, not at the
18 top-left point of the bounding rect as usual */
19 QRectF boundingRect() const {return _boundingRect;}
20 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
21 QWidget *widget);
23 void setRange(const RangeF &range);
24 void setSize(qreal size);
25 void setZoom(qreal zoom) {_zoom = zoom;}
27 QSizeF margin() const;
28 QList<qreal> ticks() const;
30 private:
31 struct Tick {
32 double value;
33 QRect boundingBox;
36 void updateBoundingRect();
38 Type _type;
39 RangeF _range;
40 qreal _size;
41 QVector<Tick> _ticks;
42 QRectF _boundingRect;
43 QFont _font;
44 QLocale _locale;
45 qreal _zoom;
48 #endif // AXISITEM_H