SeExpr

ExprColorSwatch.h
Go to the documentation of this file.
1 #ifndef _ExprColorSwatch_h_
2 #define _ExprColorSwatch_h_
3
4 #include <vector>
5 #include <QObject>
6 #include <QFrame>
7 #include <QWidget>
8 #include <SeExpr2/Vec.h>
9
10 class QGridLayout;
11
12 class ExprColorFrame : public QFrame {
13 Q_OBJECT
14 public:
15 ExprColorFrame(SeExpr2::Vec3d value, QWidget *parent = 0);
16 ~ExprColorFrame() {}
17
18 void setValue(const SeExpr2::Vec3d &value);
19 SeExpr2::Vec3d getValue() const;
20 bool selected() {
21 return _selected;
22 };
23
24 protected:
25 virtual void paintEvent(QPaintEvent *event);
26 virtual void mouseReleaseEvent(QMouseEvent *event);
27
28 private
29 slots:
30 void deleteSwatchMenu(const QPoint &pos);
31
32 signals:
33 void selValChangedSignal(SeExpr2::Vec3d value);
34 void swatchChanged(QColor color);
35 void deleteSwatch(ExprColorFrame *swatch);
36
37 private:
38 SeExpr2::Vec3d _value;
39 QColor _color;
40 bool _selected;
41 };
42
43 // Simple color widget with or without index label
44 class ExprColorWidget : public QWidget {
45 Q_OBJECT
46 public:
47 ExprColorWidget(SeExpr2::Vec3d value, int index, bool indexLabel, QWidget *parent);
48 ExprColorFrame *getColorFrame();
49
50 private:
51 ExprColorFrame *_colorFrame;
52 };
53
54 class ExprColorSwatchWidget : public QWidget {
55 Q_OBJECT
56
57 public:
58 ExprColorSwatchWidget(bool indexLabel, QWidget *parent = 0);
59 ~ExprColorSwatchWidget() {}
60
61 // Convenience Functions
62 void addSwatch(SeExpr2::Vec3d &val, int index = -1);
63 void setSwatchColor(int index, QColor color);
64 QColor getSwatchColor(int index);
65
66 private
67 slots:
68 void addNewColor();
69 void removeSwatch(ExprColorFrame *);
70 void internalSwatchChanged(QColor color);
71
72 signals:
73 void selValChangedSignal(SeExpr2::Vec3d val);
74 void swatchChanged(int index, SeExpr2::Vec3d val);
75 void swatchAdded(int index, SeExpr2::Vec3d val);
76 void swatchRemoved(int index);
77
78 private:
79 QGridLayout *_gridLayout;
80 int _columns;
81 bool _indexLabel;
82 };
83 #endif
ExprColorSwatchWidget::_columns
int _columns
Definition: ExprColorSwatch.h:80
ExprColorFrame::_selected
bool _selected
Definition: ExprColorSwatch.h:40
index
The result is computed int int< br >< div style="margin-left: 40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed). &nbsp
SeExpr2::swatch
double swatch(int n, double *params)
Definition: ExprBuiltins.cpp:1202
SeExpr2::Vec< double, 3, false >
ExprColorWidget::ExprColorWidget
ExprColorWidget(SeExpr2::Vec3d value, int index, bool indexLabel, QWidget *parent)
Definition: ExprColorSwatch.cpp:81
ExprColorSwatchWidget::internalSwatchChanged
void internalSwatchChanged(QColor color)
Definition: ExprColorSwatch.cpp:157
ExprColorFrame::swatchChanged
void swatchChanged(QColor color)
ExprColorFrame
Definition: ExprColorSwatch.h:12
ExprColorWidget::getColorFrame
ExprColorFrame * getColorFrame()
Definition: ExprColorSwatch.cpp:102
ExprColorSwatchWidget::addNewColor
void addNewColor()
Definition: ExprColorSwatch.cpp:142
ExprColorSwatchWidget::getSwatchColor
QColor getSwatchColor(int index)
Definition: ExprColorSwatch.cpp:190
ExprColorFrame::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *event)
Definition: ExprColorSwatch.cpp:49
ExprColorSwatchWidget::setSwatchColor
void setSwatchColor(int index, QColor color)
Definition: ExprColorSwatch.cpp:178
ExprColorFrame::deleteSwatch
void deleteSwatch(ExprColorFrame *swatch)
ExprColorFrame::deleteSwatchMenu
void deleteSwatchMenu(const QPoint &pos)
Definition: ExprColorSwatch.cpp:72
ExprColorSwatchWidget::swatchChanged
void swatchChanged(int index, SeExpr2::Vec3d val)
ExprColorSwatchWidget::removeSwatch
void removeSwatch(ExprColorFrame *)
Definition: ExprColorSwatch.cpp:165
ExprColorFrame::~ExprColorFrame
~ExprColorFrame()
Definition: ExprColorSwatch.h:16
ExprColorFrame::_color
QColor _color
Definition: ExprColorSwatch.h:39
ExprColorSwatchWidget
Definition: ExprColorSwatch.h:54
ExprColorSwatchWidget::_gridLayout
QGridLayout * _gridLayout
Definition: ExprColorSwatch.h:79
ExprColorSwatchWidget::swatchAdded
void swatchAdded(int index, SeExpr2::Vec3d val)
Vec.h
ExprColorWidget::_colorFrame
ExprColorFrame * _colorFrame
Definition: ExprColorSwatch.h:51
ExprColorSwatchWidget::selValChangedSignal
void selValChangedSignal(SeExpr2::Vec3d val)
ExprColorFrame::selected
bool selected()
Definition: ExprColorSwatch.h:20
ExprColorFrame::selValChangedSignal
void selValChangedSignal(SeExpr2::Vec3d value)
ExprColorFrame::_value
SeExpr2::Vec3d _value
Definition: ExprColorSwatch.h:38
value
For any rgb or hsl value(except for negative s values)
ExprColorFrame::getValue
SeExpr2::Vec3d getValue() const
Definition: ExprColorSwatch.cpp:41
ExprColorSwatchWidget::_indexLabel
bool _indexLabel
Definition: ExprColorSwatch.h:81
ExprColorSwatchWidget::addSwatch
void addSwatch(SeExpr2::Vec3d &val, int index=-1)
Definition: ExprColorSwatch.cpp:147
ExprColorWidget
Definition: ExprColorSwatch.h:44
ExprColorFrame::setValue
void setValue(const SeExpr2::Vec3d &value)
Definition: ExprColorSwatch.cpp:35
ExprColorSwatchWidget::swatchRemoved
void swatchRemoved(int index)
ExprColorFrame::ExprColorFrame
ExprColorFrame(SeExpr2::Vec3d value, QWidget *parent=0)
Definition: ExprColorSwatch.cpp:26
ExprColorSwatchWidget::ExprColorSwatchWidget
ExprColorSwatchWidget(bool indexLabel, QWidget *parent=0)
Definition: ExprColorSwatch.cpp:105
ExprColorFrame::paintEvent
virtual void paintEvent(QPaintEvent *event)
Definition: ExprColorSwatch.cpp:43
ExprColorSwatchWidget::~ExprColorSwatchWidget
~ExprColorSwatchWidget()
Definition: ExprColorSwatch.h:59