|
1 /* |
|
2 * LDForge: LDraw parts authoring CAD |
|
3 * Copyright (C) 2013, 2014 Santeri Piippo |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #ifndef LDFORGE_COLORSELECTOR_H |
|
20 #define LDFORGE_COLORSELECTOR_H |
|
21 |
|
22 #include <QDialog> |
|
23 #include "Main.h" |
|
24 |
|
25 class LDColor; |
|
26 class Ui_ColorSelUI; |
|
27 class QGraphicsScene; |
|
28 |
|
29 class ColorSelector : public QDialog |
|
30 { |
|
31 Q_OBJECT |
|
32 PROPERTY (private, LDColor*, Selection, NO_OPS, STOCK_WRITE) |
|
33 |
|
34 public: |
|
35 explicit ColorSelector (int defval = -1, QWidget* parent = null); |
|
36 virtual ~ColorSelector(); |
|
37 static bool selectColor (int& val, int defval = -1, QWidget* parent = null); |
|
38 |
|
39 protected: |
|
40 void mousePressEvent (QMouseEvent* event); |
|
41 void resizeEvent (QResizeEvent* ev); |
|
42 |
|
43 private: |
|
44 Ui_ColorSelUI* ui; |
|
45 QGraphicsScene* m_scene; |
|
46 bool m_firstResize; |
|
47 |
|
48 int numRows() const; |
|
49 int viewportWidth() const; |
|
50 void drawScene(); |
|
51 void drawColorInfo(); |
|
52 }; |
|
53 |
|
54 #endif // LDFORGE_COLORSELECTOR_H |