Salome HOME
Merge remote-tracking branch 'origin/cbr/export_to_geom_via_xao'
[modules/shaper.git] / src / XGUI / XGUI_ColorDialog.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef XGUI_ColorDialog_H
22 #define XGUI_ColorDialog_H
23
24 #include "XGUI.h"
25
26 #include <QDialog>
27
28 class QButtonGroup;
29 class QtxColorButton;
30
31 /**
32 * \ingroup GUI
33 * A class of dialog to chose a color. The color can be set in two ways: use a random value or
34 * a certain color. There is a radio button to provide this choice. The color button is 
35 * visualized to select a certain color.
36 */ 
37 class XGUI_ColorDialog : public QDialog
38 {
39   Q_OBJECT
40 public:
41   /// Constructor
42   /// \param theParent a parent widget for the dialog
43   XGUI_EXPORT XGUI_ColorDialog(QWidget* theParent);
44
45   XGUI_EXPORT virtual ~XGUI_ColorDialog() {};
46
47   /// Returns whether the random state of color is chosen
48   /// \return a boolean value
49   bool isRandomColor() const;
50
51   /// Initializes the dialog with the given value. Set choice on certain value and fill it by.
52   /// \param theValue an RGB components value
53   void setColor(const std::vector<int>& theValue);
54
55   /// Returns a container with the current color value.
56   /// These are tree int values for RGB definition.
57   /// These value is depend on the random choice and eighter
58   /// a next random color or a certain color.
59   /// \return a vector of values
60   std::vector<int> getColor() const;
61
62   /// Returns a container with the current color value.
63   /// These are tree int values for RGB definition.
64   /// It returns the next random color.
65   /// \return a vector of values
66   std::vector<int> getRandomColor() const;
67
68 private:
69   QButtonGroup* myButtonGroup; /// a group, contained random and certain color radio button choice
70   QtxColorButton* myColorButton; /// a control to select a color
71 };
72
73 #endif