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 <QTimer>
26#include <QRegExp>
27#include <QTextBrowser>
28#include <QPlainTextEdit>
29#include <QDialog>
30#include <QLineEdit>
31#include <QCheckBox>
32#include <QSlider>
33#include "ExprControl.h"
34
35class QVBoxLayout;
36class QRadioButton;
38
40class ExprAddDialog : public QDialog {
41 Q_OBJECT;
42
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;
69 QLineEdit *stringNameWidget;
70
71 ExprAddDialog(int &count, QWidget *parent = 0);
72 const char *initSwatch();
73 private
74slots:
75 void colorChooseClicked();
76};
77
81class ExprControlCollection : public QWidget {
82 Q_OBJECT;
83
85 int count;
87
88 // holds a representation factored into the controls
90
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
100 public:
102 void updateText(const int id, QString &text);
104 bool rebuildControls(const QString &expressionText, std::vector<QString> &variables);
105
107 int numControls() { return _controls.size(); }
108
109 void showEditor(int idx);
110
114 }
115
116 private
117slots:
119 void addControlDialog();
121 void singleControlChanged(int id);
123 void linkColorLink(int id);
125 void linkColorEdited(int id, QColor color);
126signals:
128 void controlChanged(int id);
130 void linkColorOutput(QColor color);
133 void insertString(const std::string &controlString);
134 public
135slots:
138 void linkColorInput(QColor color);
139};
140
141#endif
static void setAnimCurveCallback(AnimCurveCallback callback)
void(* AnimCurveCallback)(const std::string &, animlib::AnimCurve &curve)
Definition: ExprControl.h:291
Factors a SeExpr into an editable expression with controls (i.e. value boxes, curve boxes)
This class is the UI for adding widgets.
QLineEdit * animCurveLookup
QLineEdit * vectorDefault0
QLineEdit * animCurveLink
QRadioButton * grayPaletteBtn
QTabWidget * tabWidget
QLineEdit * vectorDefault1
QLineEdit * variableName
QLineEdit * floatDefault
QRadioButton * rainbowPaletteBtn
QLineEdit * stringDefaultWidget
ExprAddDialog(int &count, QWidget *parent=0)
QLineEdit * intDefault
QLineEdit * stringNameWidget
QLineEdit * deepWaterLookup
QComboBox * stringTypeWidget
QLineEdit * colorCurveLookup
QLineEdit * vectorDefault2
QLineEdit * swatchLookup
QLineEdit * curveLookup
QPushButton * colorWidget
const char * initSwatch()
void controlChanged(int id)
Notification that a specific control was changed.
bool rebuildControls(const QString &expressionText, std::vector< QString > &variables)
Rebuild the controls given the new expressionText. Return any local variables found.
ExprControlCollection(QWidget *parent=0, bool showAddButton=true)
void insertString(const std::string &controlString)
void singleControlChanged(int id)
Notification when by a control whenever it is edited.
void linkColorOutput(QColor color)
Gives information about when a link color was changed.
void addControlDialog()
When a user clicks "Add Widget" button.
std::vector< ExprControl * > _controls
void linkColorLink(int id)
Notification by a control that a new color link is desired.
int numControls()
Number of controls.
void linkColorEdited(int id, QColor color)
Notification by a control that a color is edited (when it is linked)
EditableExpression * editableExpression
void updateText(const int id, QString &text)
Request new text, given taking into account control id's new values.
void linkColorInput(QColor color)
static void setAnimCurveCallback(AnimCurveControl::AnimCurveCallback callback)
Anim curve callback.
</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:129