1 #ifndef FORM_HPP 2 #define FORM_HPP 3 4 #include <CtrlLib/CtrlLib.h> 5 #include <GridCtrl/GridCtrl.h> 6 using namespace Upp; 7 8 #include "Container.hpp" 9 #include "FormLayout.hpp" 10 11 class Form : public TopWindow 12 { 13 typedef Form CLASSNAME; 14 15 public: 16 Form(); 17 ~Form(); 18 19 bool Load(const String& file); 20 bool Layout(const String& layout, Font font = StdFont()); 21 bool Generate(Font font = StdFont()); 22 23 bool Exit(const String& action); 24 bool Acceptor(const String& action); 25 bool Rejector(const String& action); 26 27 Ctrl* GetCtrl(const String& var); 28 Value GetData(const String& var); 29 30 String ExecuteForm(); 31 32 String Script; 33 Callback3<const String&, const String&, const String& > SignalHandler; 34 GetCtrls()35 ArrayMap<String, Ctrl>& GetCtrls() { return _Ctrls; } GetCtrls() const36 const ArrayMap<String, Ctrl>& GetCtrls() const { return _Ctrls; } 37 38 void Clear(bool all = true); 39 IsLayout()40 bool IsLayout() { return _Current != -1; } 41 int HasLayout(const String& layout); 42 Xmlize(XmlIO xml)43 void Xmlize(XmlIO xml) { xml("layouts", _Layouts); } 44 GetLayouts()45 Vector<FormLayout>& GetLayouts() { return _Layouts; } GetLayouts() const46 const Vector<FormLayout>& GetLayouts() const { return _Layouts; } 47 48 protected: 49 void OnAction(const String& action); 50 bool SetCallback(const String& action, Callback c); 51 52 Vector<String> _Acceptors; 53 Vector<String> _Rejectors; 54 Vector<FormLayout> _Layouts; 55 ArrayMap<String, Ctrl> _Ctrls; 56 57 private: 58 int _Current; 59 String _File; 60 }; 61 62 #endif // .. FORM_HPP 63