4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * \author Jürgen Spitzmüller
11 * Full author contact details are available in file CREDITS.
14 #ifndef GUISETBORDER_H
15 #define GUISETBORDER_H
26 class GuiSetBorder : public QWidget
30 GuiSetBorder(QWidget * parent = nullptr, Qt::WindowFlags fl = nullptr);
32 // We need tristate for multi-cell selection
40 BorderState getLeft();
41 BorderState getRight();
43 BorderState getBottom();
44 BorderState getTopLeftTrim();
45 BorderState getTopRightTrim();
46 BorderState getBottomLeftTrim();
47 BorderState getBottomRightTrim();
49 bool leftLineSet() { return getLeft() == LINE_SET; }
50 bool rightLineSet() { return getRight() == LINE_SET; }
51 bool topLineSet() { return getTop() == LINE_SET; }
52 bool bottomLineSet() { return getBottom() == LINE_SET; }
54 bool leftLineUnset() { return getLeft() == LINE_UNSET; }
55 bool rightLineUnset() { return getRight() == LINE_UNSET; }
56 bool topLineUnset() { return getTop() == LINE_UNSET; }
57 bool bottomLineUnset() { return getBottom() == LINE_UNSET; }
59 bool topLineLTSet() { return getTopLeftTrim() == LINE_SET; }
60 bool bottomLineLTSet() { return getBottomLeftTrim() == LINE_SET; }
61 bool topLineRTSet() { return getTopRightTrim() == LINE_SET; }
62 bool bottomLineRTSet() { return getBottomRightTrim() == LINE_SET; }
64 bool topLineLTUnset() { return getTopLeftTrim() == LINE_UNSET; }
65 bool bottomLineLTUnset() { return getBottomLeftTrim() == LINE_UNSET; }
66 bool topLineRTUnset() { return getTopRightTrim() == LINE_UNSET; }
67 bool bottomLineRTUnset() { return getBottomRightTrim() == LINE_UNSET; }
81 void setLeftEnabled(bool);
82 void setRightEnabled(bool);
83 void setTopEnabled(bool);
84 void setBottomEnabled(bool);
85 void setTopLeftTrimEnabled(bool);
86 void setTopRightTrimEnabled(bool);
87 void setBottomLeftTrimEnabled(bool);
88 void setBottomRightTrimEnabled(bool);
89 void setLeft(BorderState);
90 void setRight(BorderState);
91 void setTop(BorderState);
92 void setBottom(BorderState);
93 void setTopLeftTrim(BorderState);
94 void setTopRightTrim(BorderState);
95 void setBottomLeftTrim(BorderState);
96 void setBottomRightTrim(BorderState);
97 void setAll(BorderState);
100 void mousePressEvent(QMouseEvent * e);
101 void paintEvent(QPaintEvent * e);
106 void drawLine(QColor const & col, int x, int y, int x2, int y2);
108 void drawLeft(BorderState);
109 void drawRight(BorderState);
110 void drawTop(BorderState);
111 void undrawWideTopLine(bool const right = false);
112 void drawBottom(BorderState);
113 void undrawWideBottomLine(bool const right = false);
114 void drawTopLeftTrim(BorderState);
115 void drawTopRightTrim(BorderState);
116 void drawBottomLeftTrim(BorderState);
117 void drawBottomRightTrim(BorderState);
121 Border() : set(LINE_SET), enabled(true) {}
131 Border top_trim_left_;
132 Border top_trim_right_;
133 Border bottom_trim_left_;
134 Border bottom_trim_right_;
143 bool bottom_drawn_wide_;
144 bool top_drawn_wide_;
150 #endif // GUISETBORDER_H