summaryrefslogtreecommitdiff
path: root/project2/basics/views/viewGroup.cpp
blob: e6e84d0ba2a0e6e288d1c9ba5312855cbdfde2f1 (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
#include "view.h"
#include <boost/foreach.hpp>
#include "presenter.h"

class ViewGroup : public View {
	public:
		ViewGroup(ScriptNodePtr s) :
			SourceObject(s),
			View(s)
		{
			s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&subViews));
		}

		void execute(const MultiRowSetPresenter * presenter, ExecContext * ec) const
		{
			presenter->addNewRowSet(name);
			BOOST_FOREACH(const SubViews::value_type & sq, subViews) {
				sq->execute(presenter, ec);
			}
			presenter->finishRowSet();
		}

		typedef ANONORDEREDSTORAGEOF(View) SubViews;
		SubViews subViews;
};

DECLARE_LOADER("viewgroup", ViewGroup);