]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiSetBorder.h
Avoid extra space in tooltips
[lyx.git] / src / frontends / qt4 / GuiSetBorder.h
index 2da560cc2785a02083aa7691b857977108319439..7230e4d11b9f0212cb4550827a9089c96c379316 100644 (file)
@@ -9,8 +9,9 @@
  *
  * Full author contact details are available in file CREDITS.
  */
-#ifndef QSETBORDER_H
-#define QSETBORDER_H
+
+#ifndef GUISETBORDER_H
+#define GUISETBORDER_H
 
 #include <QWidget>
 #include <QPixmap>
@@ -25,18 +26,36 @@ class GuiSetBorder : public QWidget
 {
        Q_OBJECT
 public:
-       GuiSetBorder(QWidget * parent = 0, Qt::WFlags fl = 0);
+       GuiSetBorder(QWidget * parent = 0, Qt::WindowFlags fl = 0);
+
+       // We need tristate for multi-cell selection
+       enum BorderState {
+               LINE_UNSET,
+               LINE_SET,
+               LINE_UNDECIDED,
+               LINE_UNDEF
+       };
+
+       BorderState getLeft();
+       BorderState getRight();
+       BorderState getTop();
+       BorderState getBottom();
+
+       bool leftLineSet() { return getLeft() ==  LINE_SET; }
+       bool rightLineSet() { return getRight() ==  LINE_SET; }
+       bool topLineSet() { return getTop() ==  LINE_SET; }
+       bool bottomLineSet() { return getBottom() ==  LINE_SET; }
 
-       bool getLeft();
-       bool getRight();
-       bool getTop();
-       bool getBottom();
+       bool leftLineUnset() { return getLeft() ==  LINE_UNSET; }
+       bool rightLineUnset() { return getRight() ==  LINE_UNSET; }
+       bool topLineUnset() { return getTop() ==  LINE_UNSET; }
+       bool bottomLineUnset() { return getBottom() ==  LINE_UNSET; }
 
 Q_SIGNALS:
-       void rightSet(bool);
-       void leftSet(bool);
-       void topSet(bool);
-       void bottomSet(bool);
+       void rightSet();
+       void leftSet();
+       void topSet();
+       void bottomSet();
        void clicked();
 
 public Q_SLOTS:
@@ -44,11 +63,11 @@ public Q_SLOTS:
        void setRightEnabled(bool);
        void setTopEnabled(bool);
        void setBottomEnabled(bool);
-       void setLeft(bool);
-       void setRight(bool);
-       void setTop(bool);
-       void setBottom(bool);
-       void setAll(bool);
+       void setLeft(BorderState);
+       void setRight(BorderState);
+       void setTop(BorderState);
+       void setBottom(BorderState);
+       void setAll(BorderState);
 
 protected:
        void mousePressEvent(QMouseEvent * e);
@@ -59,15 +78,15 @@ private:
 
        void drawLine(QColor const & col, int x, int y, int x2, int y2);
 
-       void drawLeft(bool);
-       void drawRight(bool);
-       void drawTop(bool);
-       void drawBottom(bool);
+       void drawLeft(BorderState);
+       void drawRight(BorderState);
+       void drawTop(BorderState);
+       void drawBottom(BorderState);
 
        class Border {
        public:
-               Border() : set(true), enabled(true) {}
-               bool set;
+               Border() : set(LINE_SET), enabled(true) {}
+               BorderState set;
                bool enabled;
        };
 
@@ -87,4 +106,4 @@ private:
 
 //} // namespace lyx
 
-#endif // QSETBORDER_H
+#endif // GUISETBORDER_H