blob: 06d4b0bc40b8d4bddb44a6edb80bb1ef856e012d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
#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. Furthermore,
* this class implements dw::core::ui::ButtonResource::ClickedReceiver and
* dw::core::ui::Resource::ActivateReceiver.
*/
class Form: public dw::core::ui::ButtonResource::ClickedReceiver,
public dw::core::ui::Resource::ActivateReceiver
{
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);
void activate (dw::core::ui::Resource *resource);
};
} // namespace form
#endif // __FORM_HH__
|