X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdialog.cpp;h=9f9fc20d15388f69ece201db0105265ddae7c74e;hb=394e5c9969a30b604bfaf78fc05a8c2d5c98ab5b;hp=0b22e9874a8d1578266fe6b98a95ddca84cf3cc5;hpb=9ef9547b31544637aca600ac65107d5b8028c39a;p=libs%2Fgltk.git diff --git a/source/dialog.cpp b/source/dialog.cpp index 0b22e98..9f9fc20 100644 --- a/source/dialog.cpp +++ b/source/dialog.cpp @@ -6,10 +6,6 @@ using namespace std; namespace Msp { namespace GLtk { -Dialog::Dialog(): - stale(false) -{ } - void Dialog::add_button(Button &button, int code) { add(button); @@ -31,15 +27,20 @@ void Dialog::set_modal(bool m) void Dialog::button_release(int x, int y, unsigned button) { Panel::button_release(x, y, button); - if(stale) - delete this; + check_stale(); } bool Dialog::key_release(unsigned key, unsigned mod) { bool result = Panel::key_release(key, mod); - if(stale) - delete this; + check_stale(); + return result; +} + +bool Dialog::navigate(Navigation nav) +{ + bool result = Panel::navigate(nav); + check_stale(); return result; } @@ -50,6 +51,12 @@ void Dialog::response(int code) stale = true; } +void Dialog::check_stale() +{ + if(stale) + delete this; +} + Dialog::Loader::Loader(Dialog &d, WidgetMap &wm): DerivedObjectLoader(d, wm) @@ -59,7 +66,7 @@ Dialog::Loader::Loader(Dialog &d, WidgetMap &wm): void Dialog::Loader::action_button(const string &n, int c) { - RefPtr