Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
ColorButton.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef COLORBUTTON_H
22 #define COLORBUTTON_H
23 
24 #include <QPushButton>
25 
26 #include <tulip/tulipconf.h>
27 #include <tulip/Color.h>
28 #include <tulip/TulipMetaTypes.h>
29 
30 namespace tlp {
31 
32 class TLP_QT_SCOPE ChooseColorButton : public QPushButton {
33  Q_OBJECT
34  Q_PROPERTY(QColor color READ color WRITE setColor)
35  Q_PROPERTY(Color tulipColor READ tulipColor WRITE setTulipColor)
36 
37 public:
38  explicit ChooseColorButton(QWidget *parent = NULL);
39 
40  QColor color() const;
41  Color tulipColor() const;
42 
43  void setDialogParent(QWidget* w);
44 
45 protected:
46  QColor _color;
47  QWidget* _dialogParent;
48 
49 signals:
50  void colorChanged(QColor);
51  void tulipColorChanged(Color);
52 
53 public slots:
54  void setColor(const QColor&);
55  void setTulipColor(const Color&);
56 
57 protected slots:
58  void chooseColor();
59 };
60 
61 class TLP_QT_SCOPE ColorButton : public ChooseColorButton {
62  Q_OBJECT
63 
64 public:
65  explicit ColorButton(QWidget *parent = NULL): ChooseColorButton(parent) {}
66 protected:
67  void paintEvent(QPaintEvent *);
68 };
69 
70 }
71 
72 #endif // COLORBUTTON_H
73 ///@endcond