X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdialog.cpp;h=5f63dcf75ed519fbf52c65e723422304fe395234;hb=9f38197854e699a6093a906ab43f4238f3cd2388;hp=2342e8483786b6ce5eba91f1a6c497290a70f7da;hpb=b30edd979e6e9c7acfaaf3a90903814a7e62a71e;p=libs%2Fgltk.git diff --git a/source/dialog.cpp b/source/dialog.cpp index 2342e84..5f63dcf 100644 --- a/source/dialog.cpp +++ b/source/dialog.cpp @@ -6,28 +6,42 @@ using namespace std; namespace Msp { namespace GLtk { -Dialog::Dialog(): - stale(false) -{ } - void Dialog::add_button(Button &button, int code) { add(button); button.signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &Dialog::response), code)); } +void Dialog::set_modal(bool m) +{ + if(m) + { + set_focus(); + if(state&FOCUS) + signal_grab_pointer.emit(); + } + else + signal_ungrab_pointer.emit(); +} + void Dialog::button_release(int x, int y, unsigned button) { Panel::button_release(x, y, button); - if(stale) - delete this; + check_stale(); } -void Dialog::key_release(unsigned key, unsigned mod) +bool Dialog::key_release(unsigned key, unsigned mod) { - Panel::key_release(key, mod); - if(stale) - delete this; + bool result = Panel::key_release(key, mod); + check_stale(); + return result; +} + +bool Dialog::navigate(Navigation nav) +{ + bool result = Panel::navigate(nav); + check_stale(); + return result; } void Dialog::response(int code) @@ -37,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)