]> git.lyx.org Git - lyx.git/blob - src/frontends/qt3/qsetborder.h
Extracted from r14281
[lyx.git] / src / frontends / qt3 / qsetborder.h
1 // -*- C++ -*-
2 /**
3  * \file qsetborder.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12 #ifndef QSETBORDER_H
13 #define QSETBORDER_H
14
15 #include <qwidget.h>
16 #include <qpixmap.h>
17
18 class QColor;
19 class QMouseEvent;
20 class QPaintEvent;
21 class QResizeEvent;
22
23 class QSetBorder : public QWidget
24 {
25         Q_OBJECT
26 public:
27         QSetBorder(QWidget * parent = 0, char const * name = 0, WFlags fl = 0);
28
29         bool getLeft();
30         bool getRight();
31         bool getTop();
32         bool getBottom();
33
34 signals:
35         void rightSet(bool);
36         void leftSet(bool);
37         void topSet(bool);
38         void bottomSet(bool);
39         void clicked();
40
41 public slots:
42         void setLeftEnabled(bool);
43         void setRightEnabled(bool);
44         void setTopEnabled(bool);
45         void setBottomEnabled(bool);
46         void setLeft(bool);
47         void setRight(bool);
48         void setTop(bool);
49         void setBottom(bool);
50         void setAll(bool);
51
52 protected:
53         void mousePressEvent(QMouseEvent * e);
54         void paintEvent(QPaintEvent * e);
55
56 private:
57         void init();
58
59         void drawLine(QColor const & col, int x, int y, int x2, int y2);
60
61         void drawLeft(bool);
62         void drawRight(bool);
63         void drawTop(bool);
64         void drawBottom(bool);
65
66         class Border {
67         public:
68                 Border() : set(true), enabled(true) {}
69                 bool set;
70                 bool enabled;
71         };
72
73         Border left_;
74         Border right_;
75         Border top_;
76         Border bottom_;
77
78         int m;
79         int l;
80         int w;
81         int h;
82
83         QPixmap buffer;
84 };
85
86 #endif // QSETBORDER_H