Tulip  4.1.0
Better Visualization Through Research
 All Classes 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 <QtGui/QPushButton>
25 #include <tulip/tulipconf.h>
26 #include <tulip/Color.h>
27 #include <tulip/TulipMetaTypes.h>
28 
29 namespace tlp {
30 
31 class TLP_QT_SCOPE ColorButton : public QPushButton {
32  Q_OBJECT
33  Q_PROPERTY(QColor color READ color WRITE setColor)
34  Q_PROPERTY(Color tulipColor READ tulipColor WRITE setTulipColor)
35 
36  QColor _color;
37  QWidget* _dialogParent;
38 public:
39  explicit ColorButton(QWidget *parent = NULL);
40 
41  QColor color() const;
42  Color tulipColor() const;
43 
44  void setDialogParent(QWidget* w);
45 
46 protected:
47  void paintEvent(QPaintEvent *);
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 }
62 
63 #endif // COLORBUTTON_H
64 ///@endcond