src/colorSelector.h

changeset 655
b376645315ab
child 794
c254ddc6618b
equal deleted inserted replaced
654:a74f2ff353b8 655:b376645315ab
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 #pragma once
20 #include <QDialog>
21 #include "main.h"
22
23 class LDColor;
24 class Ui_ColorSelUI;
25 class QGraphicsScene;
26
27 class ColorSelector : public QDialog
28 {
29 Q_OBJECT
30 PROPERTY (private, LDColor*, selection, setSelection, STOCK_WRITE)
31
32 public:
33 explicit ColorSelector (int defval = -1, QWidget* parent = null);
34 virtual ~ColorSelector();
35 static bool selectColor (int& val, int defval = -1, QWidget* parent = null);
36
37 protected:
38 void mousePressEvent (QMouseEvent* event);
39 void resizeEvent (QResizeEvent* ev);
40
41 private:
42 Ui_ColorSelUI* ui;
43 QGraphicsScene* m_scene;
44 bool m_firstResize;
45
46 int numRows() const;
47 int viewportWidth() const;
48 void drawScene();
49 void drawColorInfo();
50 };

mercurial