]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/qsetborder.h
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / 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 #include <qcolor.h>
18
19 class QMouseEvent;
20 class QResizeEvent;
21 class QPaintEvent;
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         struct Border {
67                 Border() : set(true), enabled(true) {}
68                 bool set;
69                 bool enabled;
70         };
71
72         Border left_;
73         Border right_;
74         Border top_;
75         Border bottom_;
76
77         int m;
78         int l;
79         int w;
80         int h;
81
82         QPixmap buffer;
83 };
84
85 #endif // QSETBORDER_H