]> git.tdb.fi Git - libs/gltk.git/blob - source/logic.cpp
Rework how widget ownership works in Container
[libs/gltk.git] / source / logic.cpp
1 #include <msp/core/maputils.h>
2 #include "logic.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace GLtk {
8
9 Logic::Loader::Loader(Logic &l, const map<string, Widget *> &w):
10         DataFile::ObjectLoader<Logic>(l),
11         widgets(w)
12 {
13         add("bind", &Loader::bind);
14 }
15
16 void Logic::Loader::bind(const string &wdg, const string &data)
17 {
18         WidgetBinding act;
19         act.wdg = get_item(widgets, wdg);
20
21         string::size_type colon = data.find(':');
22         act.type = data.substr(0, colon);
23         if(colon!=string::npos)
24                 act.data = data.substr(colon+1);
25         obj.bindings.push_back(act);
26 }
27
28 } // namespace GLtk
29 } // namespace Msp