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