]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dialog.cpp
Support loading dialog action buttons
[libs/gltk.git] / source / dialog.cpp
index cc4c1bf6a51f67cd1b00ecd46a9fc3cb2fda0c90..dba276d32d7aa05de119fa2cdf48407cbdcf4fe9 100644 (file)
@@ -1,6 +1,8 @@
 #include "button.h"
 #include "dialog.h"
 
+using namespace std;
+
 namespace Msp {
 namespace GLtk {
 
@@ -35,5 +37,20 @@ void Dialog::response(int code)
        stale = true;
 }
 
+
+Dialog::Loader::Loader(Dialog &d, WidgetMap &wm):
+       DerivedObjectLoader<Dialog, Panel::Loader>(d, wm)
+{
+       add("action_button", &Loader::action_button);
+}
+
+void Dialog::Loader::action_button(const string &n, int c)
+{
+       RefPtr<Button> btn = new Button();
+       load_sub(*btn);
+       obj.add_button(*btn.get(), c);
+       wdg_map[n] = btn.release();
+}
+
 } // namespace GLtk
 } // namespace Msp