]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/dialog.cpp
Improve Dialog staleness checks
[libs/gltk.git] / source / dialog.cpp
index 0b22e9874a8d1578266fe6b98a95ddca84cf3cc5..a264fbe87ce753de12b4b7c89ba76d5a849f2fa9 100644 (file)
@@ -31,15 +31,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 +55,12 @@ void Dialog::response(int code)
        stale = true;
 }
 
+void Dialog::check_stale()
+{
+       if(stale)
+               delete this;
+}
+
 
 Dialog::Loader::Loader(Dialog &d, WidgetMap &wm):
        DerivedObjectLoader<Dialog, Panel::Loader>(d, wm)