]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/userinterface.h
Add getter for Panel::layout
[libs/gltk.git] / source / userinterface.h
index 58eb5186698db462a7747d17c27ba275deea06ea..04a9ccfd10b6cd815f1618f9a217fd3db59f39ff 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef MSP_GLTK_USERINTERFACE_H_
 #define MSP_GLTK_USERINTERFACE_H_
 
+#include <msp/core/maputils.h>
 #include "logic.h"
 #include "root.h"
 
@@ -41,15 +42,7 @@ public:
        template<typename W>
        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<W *>(i->second);
-               if(!w)
-                       throw Exception("Widget type mismatch");
-
-               return *w;
+               return dynamic_cast<W &>(*get_item(widgets, n));
        }
 
        template<typename W>