SeExpr
ExprControlCollection.h
Go to the documentation of this file.
1 /*
2 * Copyright Disney Enterprises, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License
6 * and the following modification to it: Section 6 Trademarks.
7 * deleted and replaced with:
8 *
9 * 6. Trademarks. This License does not grant permission to use the
10 * trade names, trademarks, service marks, or product names of the
11 * Licensor and its affiliates, except as required for reproducing
12 * the content of the NOTICE file.
13 *
14 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * @file ExprControlCollection.h
18 * @brief Manages/creates a bunch of ExprControls by using expression text
19 * @author aselle
20 */
21 #ifndef _ExprControlCollection_h
22 #define _ExprControlCollection_h
23 #include <vector>
24 
25 #include <QtGui/QTextBrowser>
26 #include <QtGui/QPlainTextEdit>
27 #include <QtGui/QDialog>
28 #include <QtCore/QTimer>
29 #include <QtCore/QRegExp>
30 #include <QtGui/QLineEdit>
31 #include <QtGui/QCheckBox>
32 #include <QtGui/QSlider>
33 #include "ExprControl.h"
34 
35 class QVBoxLayout;
36 class QRadioButton;
37 class EditableExpression;
38 
40 class ExprAddDialog:public QDialog
41 {
42  Q_OBJECT;
43 public:
44  QLineEdit *variableName;
45  QTabWidget *tabWidget;
46  QLineEdit *intDefault;
47  QLineEdit *intMin;
48  QLineEdit *intMax;
49  QLineEdit *floatDefault;
50  QLineEdit *floatMin;
51  QLineEdit *floatMax;
52  QLineEdit *vectorDefault0;
53  QLineEdit *vectorDefault1;
54  QLineEdit *vectorDefault2;
55  QLineEdit *vectorMin;
56  QLineEdit *vectorMax;
57  QLineEdit *curveLookup;
58  QLineEdit *colorCurveLookup;
59  QLineEdit *animCurveLookup;
60  QLineEdit *animCurveLink;
61  QLineEdit *swatchLookup;
62  QLineEdit *deepWaterLookup;
63  QRadioButton *rainbowPaletteBtn;
64  QRadioButton *grayPaletteBtn;
65  QColor color;
66  QPushButton* colorWidget;
67  QComboBox* stringTypeWidget;
68  QLineEdit* stringDefaultWidget;
69  QLineEdit* stringNameWidget;
70 
71  ExprAddDialog(int& count,QWidget* parent=0);
72  const char * initSwatch();
73 private slots:
74  void colorChooseClicked();
75 
76 };
77 
81 class ExprControlCollection:public QWidget
82 {
83  Q_OBJECT;
84 
85  int _linkedId;
86  int count;
88 
89  // holds a representation factored into the controls
91 public:
92  ExprControlCollection(QWidget* parent=0,bool showAddButton=true);
94 
95 private:
96  // TODO: put back
97  std::vector<ExprControl*> _controls;
98  QVBoxLayout* controlLayout;
99 public:
101  void updateText(const int id,QString& text);
103  bool rebuildControls(const QString& expressionText,std::vector<QString>& variables);
104 
106  int numControls() { return _controls.size(); }
107 
108  void showEditor(int idx);
109 
113  }
114 
115 private slots:
117  void addControlDialog();
119  void singleControlChanged(int id);
121  void linkColorLink(int id);
123  void linkColorEdited(int id,QColor color);
124 signals:
126  void controlChanged(int id);
128  void linkColorOutput(QColor color);
131  void insertString(const std::string& controlString);
132 public slots:
135  void linkColorInput(QColor color);
136 
137 };
138 
139 #endif
140 
141 
QTabWidget * tabWidget
QLineEdit * deepWaterLookup
void controlChanged(int id)
Notification that a specific control was changed.
void singleControlChanged(int id)
Notification when by a control whenever it is edited.
QRadioButton * grayPaletteBtn
static void setAnimCurveCallback(AnimCurveControl::AnimCurveCallback callback)
Anim curve callback.
QLineEdit * vectorDefault2
QLineEdit * stringDefaultWidget
ExprAddDialog(int &count, QWidget *parent=0)
void linkColorInput(QColor color)
int numControls()
Number of controls.
QLineEdit * intDefault
void addControlDialog()
When a user clicks &quot;Add Widget&quot; button.
QPushButton * colorWidget
QLineEdit * animCurveLink
const char * initSwatch()
QLineEdit * vectorDefault0
void(* AnimCurveCallback)(const std::string &, animlib::AnimCurve &curve)
Definition: ExprControl.h:275
</pre > Once we have this we need an instance to store our variable and provide a reference to that We make it because it may be useful to use the same ExprVarRef from multiple expressions!For if you have expressions that all have access to the same variables
Definition: tutorial.txt:128
QLineEdit * variableName
void linkColorLink(int id)
Notification by a control that a new color link is desired.
ExprControlCollection(QWidget *parent=0, bool showAddButton=true)
QLineEdit * vectorDefault1
QLineEdit * animCurveLookup
QComboBox * stringTypeWidget
std::vector< ExprControl * > _controls
EditableExpression * editableExpression
static void setAnimCurveCallback(AnimCurveCallback callback)
Factors a SeExpr into an editable expression with controls (i.e. value boxes, curve boxes) ...
bool rebuildControls(const QString &expressionText, std::vector< QString > &variables)
Rebuild the controls given the new expressionText. Return any local variables found.
QLineEdit * floatDefault
QLineEdit * swatchLookup
void updateText(const int id, QString &text)
Request new text, given taking into account control id&#39;s new values.
QRadioButton * rainbowPaletteBtn
QLineEdit * curveLookup
void insertString(const std::string &controlString)
This class is the UI for adding widgets.
QLineEdit * stringNameWidget
QLineEdit * colorCurveLookup
void linkColorOutput(QColor color)
Gives information about when a link color was changed.
void linkColorEdited(int id, QColor color)
Notification by a control that a color is edited (when it is linked)