diff options
author | jcid <devnull@localhost> | 2007-10-07 00:36:34 +0200 |
---|---|---|
committer | jcid <devnull@localhost> | 2007-10-07 00:36:34 +0200 |
commit | 93715c46a99c96d6c866968312691ec9ab0f6a03 (patch) | |
tree | 573f19ec6aa740844f53a7c0eb7114f04096bf64 /src/form.hh |
Initial revision
Diffstat (limited to 'src/form.hh')
-rw-r--r-- | src/form.hh | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/form.hh b/src/form.hh new file mode 100644 index 00000000..9ea47bb0 --- /dev/null +++ b/src/form.hh @@ -0,0 +1,87 @@ +#ifndef __FORM_HH__ +#define __FORM_HH__ + +#include "dw/core.hh" +#include "dw/ui.hh" + +namespace form { + +/** + * \brief Handles HTML form data. + * + * Add resources by calling the respective add...Resource method. Furtermore, + * this class impelements dw::core::ui::ButtonResource::ClickedReceiver, the + * form data is printed to stdout, when the "clicked" signal is received. + */ +class Form: public dw::core::ui::ButtonResource::ClickedReceiver +{ +private: + /** + * \brief Decorates instances of dw::core::ui::Resource. + * + * This is the abstract base class, sub classes have to be defined to + * decorate specific sub interfaces of dw::core::ui::Resource. + */ + class ResourceDecorator: public object::Object + { + private: + const char *name; + + protected: + ResourceDecorator (const char *name); + ~ResourceDecorator (); + + public: + inline const char *getName () { return name; } + virtual const char *getValue () = 0; + }; + + /** + * \brief Decorates instances of dw::core::ui::TextResource. + */ + class TextResourceDecorator: public ResourceDecorator + { + private: + dw::core::ui::TextResource *resource; + + public: + TextResourceDecorator (const char *name, + dw::core::ui::TextResource *resource); + const char *getValue (); + }; + + /** + * \brief Decorates instances of dw::core::ui::RadioButtonResource. + * + * This class has to be instanciated only once for a group of radio + * buttons. + */ + class RadioButtonResourceDecorator: public ResourceDecorator + { + private: + dw::core::ui::RadioButtonResource *resource; + const char **values; + + public: + RadioButtonResourceDecorator (const char *name, + dw::core::ui::RadioButtonResource + *resource, + const char **values); + ~RadioButtonResourceDecorator (); + const char *getValue (); + }; + + container::typed::List <ResourceDecorator> *resources; + + void *ext_data; // external data pointer + +public: + Form (void *p); + ~Form (); + void clicked (dw::core::ui::ButtonResource *resource, int buttonNo); + +}; + +} // namespace form + +#endif // __FORM_HH__ |