1 #ifndef ADM_qtScript_Dialog 2 #define ADM_qtScript_Dialog 3 4 #include <vector> 5 6 #include <QtScript/QScriptable> 7 #include <QtScript/QScriptContext> 8 #include <QtScript/QScriptEngine> 9 #include <QtScript/QScriptValue> 10 11 #include "Control.h" 12 13 namespace ADM_qtScript 14 { 15 /** \brief The Dialog %class represents a dialog window with an OK and Cancel button. 16 */ 17 class Dialog : public QObject, protected QScriptable 18 { 19 Q_OBJECT 20 21 private: 22 QString _title; 23 std::vector<Control*> _controls; 24 25 QScriptValue getControls(void); 26 27 public: 28 /** \cond */ 29 static QScriptValue constructor(QScriptContext *context, QScriptEngine *engine); 30 /** \endcond */ 31 32 /** \brief Constructs a dialog window with the given title. 33 */ 34 Dialog(const QString& /*% String %*/ title); 35 36 /** \brief Provides access to the dialog window's controls. 37 */ 38 Q_PROPERTY(QScriptValue /*% ControlCollection %*/ controls READ getControls); 39 40 /** \brief Shows the dialog window and its controls. 41 * 42 * \returns Returns true if OK was clicked; otherwise false. 43 */ 44 Q_INVOKABLE QScriptValue /*% Boolean %*/ show(void); 45 }; 46 } 47 48 #endif