Debian Codegraph @

src/Gui/Dialogs/DlgSettingsColorGradientImp.h

raw
1 /***************************************************************************
2 * Copyright (c) 2005 Werner Mayer <wmayer[at]users.sourceforge.net> *
3 * *
4 * This file is part of the FreeCAD CAx development system. *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of the GNU Library General Public *
8 * License as published by the Free Software Foundation; either *
9 * version 2 of the License, or (at your option) any later version. *
10 * *
11 * This library is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU Library General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Library General Public *
17 * License along with this library; see the file COPYING.LIB. If not, *
18 * write to the Free Software Foundation, Inc., 59 Temple Place, *
19 * Suite 330, Boston, MA 02111-1307, USA *
20 * *
21 ***************************************************************************/
22
23
24 #ifndef GUI_DIALOG_DLGSETTINGSCOLORGRADIENT_IMP_H
25 #define GUI_DIALOG_DLGSETTINGSCOLORGRADIENT_IMP_H
26
27 #include <App/ColorModel.h>
28 #include <QDialog>
29 #include <memory>
30
31 class QDoubleValidator;
32
33 namespace Gui
34 {
35 namespace Dialog
36 {
37 class Ui_DlgSettingsColorGradient;
38
39 /**
40 * The DlgSettingsColorGradientImp class implements a preference page to change settings
41 * for the color gradient bar.
42 * @author Werner Mayer
43 */
44 class DlgSettingsColorGradientImp: public QDialog
45 {
46 Q_OBJECT
47
48 public:
49 explicit DlgSettingsColorGradientImp(
50 const App::ColorGradient& cg,
51 QWidget* parent = nullptr,
52 Qt::WindowFlags fl = Qt::WindowFlags()
53 );
54 ~DlgSettingsColorGradientImp() override;
55
56 void accept() override;
57
58 /** @name Color profile */
59 //@{
60 App::ColorGradientProfile getProfile() const;
61 void setProfile(const App::ColorGradientProfile& pro);
62 //@}
63 /** @name Parameter range and scale */
64 //@{
65 void setNumberOfDecimals(int, float fMin, float fMax);
66 int numberOfDecimals() const;
67 //@}
68
69 private:
70 void setupConnections();
71
72 /** @name Color model */
73 //@{
74 void setColorModelNames(const std::vector<std::string>&);
75 void setColorModel(std::size_t tModel);
76 std::size_t colorModel() const;
77 //@}
78 /** @name Color style */
79 //@{
80 void setColorStyle(App::ColorBarStyle tStyle);
81 App::ColorBarStyle colorStyle() const;
82 //@}
83 /** @name Display mode */
84 //@{
85 void setOutGrayed(bool grayed);
86 bool isOutGrayed() const;
87 void setOutInvisible(bool invisible);
88 bool isOutInvisible() const;
89 //@}
90 /** @name Parameter range and scale */
91 //@{
92 void setRange(float fMin, float fMax);
93 void getRange(float& fMin, float& fMax) const;
94 void setNumberOfLabels(int);
95 int numberOfLabels() const;
96 //@}
97
98 Q_SIGNALS:
99 void colorModelChanged();
100
101 private:
102 QDoubleValidator* validator;
103 std::unique_ptr<Ui_DlgSettingsColorGradient> ui;
104 };
105
106 } // namespace Dialog
107 } // namespace Gui
108
109 #endif // GUI_DIALOG_DLGSETTINGSCOLORGRADIENT_IMP_H