X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fuserinterface.h;h=04a9ccfd10b6cd815f1618f9a217fd3db59f39ff;hb=c1faa54a3218b53757b8b55de0ff8aa64412253b;hp=58eb5186698db462a7747d17c27ba275deea06ea;hpb=8352d5f2590cfcb09e92854be211399105408c4d;p=libs%2Fgltk.git diff --git a/source/userinterface.h b/source/userinterface.h index 58eb518..04a9ccf 100644 --- a/source/userinterface.h +++ b/source/userinterface.h @@ -1,6 +1,7 @@ #ifndef MSP_GLTK_USERINTERFACE_H_ #define MSP_GLTK_USERINTERFACE_H_ +#include #include "logic.h" #include "root.h" @@ -41,15 +42,7 @@ public: template W &get_widget(const std::string &n) const { - WidgetMap::const_iterator i = widgets.find(n); - if(i==widgets.end()) - throw KeyError("Unknown widget", n); - - W *w = dynamic_cast(i->second); - if(!w) - throw Exception("Widget type mismatch"); - - return *w; + return dynamic_cast(*get_item(widgets, n)); } template