14 * |
14 * |
15 * You should have received a copy of the GNU General Public License |
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/>. |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 */ |
17 */ |
18 |
18 |
19 #ifndef COLORSELECTOR_H |
19 #ifndef LDFORGE_COLORSELECTOR_H |
20 #define COLORSELECTOR_H |
20 #define LDFORGE_COLORSELECTOR_H |
21 |
21 |
22 #include <QDialog> |
22 #include <QDialog> |
23 #include "common.h" |
23 #include "common.h" |
24 |
24 |
25 class LDColor; |
25 class LDColor; |
26 class Ui_ColorSelUI; |
26 class Ui_ColorSelUI; |
27 class QGraphicsScene; |
27 class QGraphicsScene; |
28 |
28 |
29 class ColorSelector : public QDialog { |
29 class ColorSelector : public QDialog |
30 Q_OBJECT |
30 { Q_OBJECT |
31 READ_PROPERTY (LDColor*, sel, setSelection) |
31 READ_PROPERTY (LDColor*, sel, setSelection) |
32 |
32 |
33 public: |
33 public: |
34 explicit ColorSelector (short defval = -1, QWidget* parent = null); |
34 explicit ColorSelector (short defval = -1, QWidget* parent = null); |
35 virtual ~ColorSelector(); |
35 virtual ~ColorSelector(); |
36 static bool getColor (short& val, short defval = -1, QWidget* parent = null); |
36 static bool getColor (short& val, short defval = -1, QWidget* parent = null); |
37 |
37 |
38 protected: |
38 protected: |
39 void mousePressEvent (QMouseEvent* event); |
39 void mousePressEvent (QMouseEvent* event); |
40 void resizeEvent (QResizeEvent* ev); |
40 void resizeEvent (QResizeEvent* ev); |
41 |
41 |
42 private: |
42 private: |
43 Ui_ColorSelUI* ui; |
43 Ui_ColorSelUI* ui; |
44 QGraphicsScene* m_scene; |
44 QGraphicsScene* m_scene; |
45 bool m_firstResize; |
45 bool m_firstResize; |
46 |
46 |
47 int numRows() const; |
47 int numRows() const; |
48 int viewportWidth() const; |
48 int viewportWidth() const; |
49 void drawScene(); |
49 void drawScene(); |
50 void drawColorInfo(); |
50 void drawColorInfo(); |
51 }; |
51 }; |
52 |
52 |
53 #endif // COLORSELECTOR_H |
53 #endif // COLORSELECTOR_H |