Added an append() method to append content to a container.
#endif
}
-Container::Container(const Hash& attrs, Widget& content): Widget(attrs) {
+Container::Container(const Hash& attrs, Widget* content): Widget(attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(attrs = {" /* TODO << attrs */
#endif
}
-Container::Container(Widget& content, const Hash& attrs): Widget(attrs) {
+Container::Container(Widget* content, const Hash& attrs): Widget(attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
cerr << "In Container::Container(content = {" /* TODO << content */
string Container::renderContent(HIT& hit) {
stringstream out;
for (Content::iterator i = content.begin(); i != content.end(); i++) {
- out << i->render(hit);
+ out << (*i)->render(hit);
}
return out.str();
}
+
+void Container::append(Widget* widget) {
+ content.push_back(widget);
+}
class Container: public Widget {
// Typedefs
protected:
- typedef std::vector<Widget> Content;
+ typedef std::vector<Widget*> Content;
// Attributes.
protected:
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Container(const Hash&, Widget&);
+ Container(const Hash&, Widget*);
/**
* Constructor.
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Container(Widget&, const Hash&);
+ Container(Widget*, const Hash&);
/**
* Destructor.
* @return Rendered widget.
*/
virtual string renderContent(HIT&);
+
+ /**
+ * Appends a widget to the container.
+ *
+ * @param widget Widget to append.
+ */
+ virtual void append(Widget*);
};
}
#endif
}
-Fallback::Fallback(const string& name, const Hash& attrs, Widget& content):
+Fallback::Fallback(const string& name, const Hash& attrs, Widget* content):
Container(attrs, content), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
#endif
}
-Fallback::Fallback(const string& name, Widget& content, const Hash& attrs):
+Fallback::Fallback(const string& name, Widget* content, const Hash& attrs):
Container(content, attrs), name(name) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Fallback(const string&, const Hash&, Widget&);
+ Fallback(const string&, const Hash&, Widget*);
/**
* Constructor.
* @param name Name of the widget.
* @param content Content of the widget.
*/
- Fallback(const string&, Widget&);
+ Fallback(const string&, Widget*);
/**
* Constructor.
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Fallback(const string&, Widget&, const Hash&);
+ Fallback(const string&, Widget*, const Hash&);
/**
* Destructor.
#endif
}
-Translate::Translate(const string& name, const Hash& attrs, Widget& content):
+Translate::Translate(const string& name, const Hash& attrs, Widget* content):
Fallback(name, attrs, content) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
#endif
}
-Translate::Translate(const string& name, Widget& content, const Hash& attrs):
+Translate::Translate(const string& name, Widget* content, const Hash& attrs):
Fallback(name, content, attrs) {
// FIXME - this->content.push_back(content);
#ifdef DEBUG
* @param attrs Widget attributes.
* @param content Content of the widget.
*/
- Translate(const string&, const Hash&, Widget&);
+ Translate(const string&, const Hash&, Widget*);
/**
* Constructor.
* @param name Name of the widget.
* @param content Content of the widget.
*/
- Translate(const string&, Widget&);
+ Translate(const string&, Widget*);
/**
* Constructor.
* @param content Content of the widget.
* @param attrs Widget attributes.
*/
- Translate(const string&, Widget&, const Hash&);
+ Translate(const string&, Widget*, const Hash&);
/**
* Destructor.