]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/logic.cpp
Adapt to Collection API changes
[libs/gltk.git] / source / logic.cpp
index 16444892a591b752aa7eff5e95b0f1bf67bfc07e..db382fe6074f14aebea7293d61808f1ff0e5c100 100644 (file)
@@ -1,10 +1,4 @@
-/* $Id$
-
-This file is part of libmspgltk
-Copyright © 2007  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <msp/core/maputils.h>
 #include "logic.h"
 
 using namespace std;
@@ -21,16 +15,13 @@ Logic::Loader::Loader(Logic &l, const map<string, Widget *> &w):
 
 void Logic::Loader::bind(const string &wdg, const string &data)
 {
-       map<string, Widget *>::const_iterator i=widgets.find(wdg);
-       if(i==widgets.end())
-               throw KeyError("Unknown widget", wdg);
-
-       string::size_type colon=data.find(':');
        WidgetBinding act;
-       act.wdg=i->second;
-       act.type=data.substr(0, colon);
+       act.wdg = get_item(widgets, wdg);
+
+       string::size_type colon = data.find(':');
+       act.type = data.substr(0, colon);
        if(colon!=string::npos)
-               act.data=data.substr(colon+1);
+               act.data = data.substr(colon+1);
        logic.bindings.push_back(act);
 }