1 /* -*- c++ -*- */
2 
3 #ifndef krulertest_h
4 #define krulertest_h
5 
6 #include <QCheckBox>
7 #include <QFrame>
8 #include <QRadioButton>
9 
10 class KRuler;
11 class QWidget;
12 class QGridLayout;
13 class QGroupBox;
14 class QLabel;
15 class QSpinBox;
16 class QDoubleSpinBox;
17 
18 class MouseWidget : public QFrame
19 {
20     Q_OBJECT
21 public:
22     MouseWidget(QWidget *parent = nullptr);
23 
24 Q_SIGNALS:
25     void newXPos(int);
26     void newYPos(int);
27     void newWidth(int);
28     void newHeight(int);
29 
30 protected:
31     void mousePressEvent(QMouseEvent *) override;
32     void mouseReleaseEvent(QMouseEvent *) override;
33     void mouseMoveEvent(QMouseEvent *) override;
34     void resizeEvent(QResizeEvent *) override;
35 
36 private:
37     bool mouseButtonDown;
38 };
39 
40 class KRulerTest : public QWidget
41 {
42     Q_OBJECT
43 public:
44     KRulerTest();
45     ~KRulerTest() override;
46 
47 private Q_SLOTS:
48     void slotNewWidth(int);
49     void slotNewHeight(int);
50 
51     void slotSetTinyMarks(bool);
52     void slotSetLittleMarks(bool);
53     void slotSetMediumMarks(bool);
54     void slotSetBigMarks(bool);
55     void slotSetEndMarks(bool);
56     void slotSetRulerPointer(bool);
57 
58     void slotSetRulerLength(int);
59     void slotFixRulerLength(bool);
60     void slotSetMStyle(int);
61     void slotUpdateShowMarks();
62     void slotCheckLength(bool);
63 
64     void slotSetRotate(double);
65     void slotSetXTrans(double);
66     void slotSetYTrans(double);
67 
68 private:
69     KRuler *hruler, *vruler;
70     QGridLayout *layout;
71     QFrame *mainframe = nullptr;
72     MouseWidget *bigwidget = nullptr;
73     QFrame *miniwidget = nullptr;
74 
75     QLabel *mouse_message;
76     QGroupBox *showMarks, *lineEdit, *vertrot;
77     QCheckBox *showTM, *showLM, *showMM, *showBM, *showEM, *showPT, *fixLen;
78     QSpinBox *beginMark, *endMark, *lengthInput;
79     QDoubleSpinBox *transX, *transY, *rotV;
80     QGroupBox *metricstyle;
81     QRadioButton *pixelmetric, *inchmetric, *mmmetric, *cmmetric, *mmetric;
82 };
83 #endif
84