00001 /* 00002 * (c) Disney Enterprises, Inc. All rights reserved. 00003 * 00004 * This file is licensed under the terms of the Microsoft Public License (MS-PL) 00005 * as defined at: http://opensource.org/licenses/MS-PL. 00006 * 00007 * A complete copy of this license is included in this distribution as the file 00008 * LICENSE. 00009 * 00010 * @file SeExprEdControlCollection.h 00011 * @brief Manages/creates a bunch of SeExprEdControls by using expression text 00012 * @author aselle 00013 */ 00014 #ifndef _SeExprEdControlCollection_ 00015 #define _SeExprEdControlCollection_ 00016 #include <vector> 00017 00018 #include <QtGui/QTextBrowser> 00019 #include <QtGui/QPlainTextEdit> 00020 #include <QtGui/QDialog> 00021 #include <QtCore/QTimer> 00022 #include <QtCore/QRegExp> 00023 #include <QtGui/QLineEdit> 00024 #include <QtGui/QCheckBox> 00025 #include <QtGui/QSlider> 00026 #include "SeExprEdControl.h" 00027 00028 class QVBoxLayout; 00029 class SeExprEdEditableExpression; 00030 00032 class SeExprEdAddDialog:public QDialog 00033 { 00034 Q_OBJECT; 00035 public: 00036 QLineEdit *variableName; 00037 QTabWidget *tabWidget; 00038 QLineEdit *intDefault; 00039 QLineEdit *intMin; 00040 QLineEdit *intMax; 00041 QLineEdit *floatDefault; 00042 QLineEdit *floatMin; 00043 QLineEdit *floatMax; 00044 QLineEdit *vectorDefault0; 00045 QLineEdit *vectorDefault1; 00046 QLineEdit *vectorDefault2; 00047 QLineEdit *vectorMin; 00048 QLineEdit *vectorMax; 00049 QLineEdit *curveLookup; 00050 QLineEdit *colorCurveLookup; 00051 QLineEdit *animCurveLookup; 00052 QLineEdit *animCurveLink; 00053 QColor color; 00054 QPushButton* colorWidget; 00055 QComboBox* stringTypeWidget; 00056 QLineEdit* stringDefaultWidget; 00057 QLineEdit* stringNameWidget; 00058 00059 SeExprEdAddDialog(int& count,QWidget* parent=0); 00060 private slots: 00061 void colorChooseClicked(); 00062 00063 }; 00064 00068 class SeExprEdControlCollection:public QWidget 00069 { 00070 Q_OBJECT; 00071 00072 int _linkedId; 00073 int count; 00074 bool showAddButton; 00075 00076 // holds a representation factored into the controls 00077 SeExprEdEditableExpression* editableExpression; 00078 public: 00079 SeExprEdControlCollection(QWidget* parent=0,bool showAddButton=true); 00080 ~SeExprEdControlCollection(); 00081 00082 private: 00083 // TODO: put back 00084 std::vector<SeExprEdControl*> _controls; 00085 QVBoxLayout* controlLayout; 00086 public: 00088 void updateText(const int id,QString& text); 00090 bool rebuildControls(const QString& expressionText,std::vector<QString>& variables); 00091 00093 int numControls() { return _controls.size(); } 00094 00095 void showEditor(int idx); 00096 00098 static void setAnimCurveCallback(SeExprEdAnimCurveControl::AnimCurveCallback callback){ 00099 SeExprEdAnimCurveControl::setAnimCurveCallback(callback); 00100 } 00101 00102 private slots: 00104 void addControlDialog(); 00106 void singleControlChanged(int id); 00108 void linkColorLink(int id); 00110 void linkColorEdited(int id,QColor color); 00111 signals: 00113 void controlChanged(int id); 00115 void linkColorOutput(QColor color); 00118 void insertString(const std::string& controlString); 00119 public slots: 00122 void linkColorInput(QColor color); 00123 00124 }; 00125 00126 #endif 00127 00128