diff options
-rw-r--r-- | vncviewer/OptionsDialog.cxx | 19 | ||||
-rw-r--r-- | vncviewer/OptionsDialog.h | 9 |
2 files changed, 28 insertions, 0 deletions
diff --git a/vncviewer/OptionsDialog.cxx b/vncviewer/OptionsDialog.cxx index f69a2998..8fe7eecf 100644 --- a/vncviewer/OptionsDialog.cxx +++ b/vncviewer/OptionsDialog.cxx @@ -42,6 +42,8 @@ using namespace std; using namespace rdr; using namespace rfb; +std::map<OptionsCallback*, void*> OptionsDialog::callbacks; + OptionsDialog::OptionsDialog() : Fl_Window(450, 450, _("VNC Viewer: Connection Options")) { @@ -101,6 +103,18 @@ void OptionsDialog::showDialog(void) } +void OptionsDialog::addCallback(OptionsCallback *cb, void *data) +{ + callbacks[cb] = data; +} + + +void OptionsDialog::removeCallback(OptionsCallback *cb) +{ + callbacks.erase(cb); +} + + void OptionsDialog::show(void) { loadOptions(); @@ -333,6 +347,11 @@ void OptionsDialog::storeOptions(void) fullScreen.setParam(fullScreenCheckbox->value()); useLocalCursor.setParam(localCursorCheckbox->value()); dotWhenNoCursor.setParam(dotCursorCheckbox->value()); + + std::map<OptionsCallback*, void*>::const_iterator iter; + + for (iter = callbacks.begin();iter != callbacks.end();++iter) + iter->first(iter->second); } diff --git a/vncviewer/OptionsDialog.h b/vncviewer/OptionsDialog.h index cb18bcd5..ea958595 100644 --- a/vncviewer/OptionsDialog.h +++ b/vncviewer/OptionsDialog.h @@ -19,12 +19,16 @@ #ifndef __OPTIONSDIALOG_H__ #define __OPTIONSDIALOG_H__ +#include <map> + #include <FL/Fl_Window.H> #include <FL/Fl_Group.H> #include <FL/Fl_Check_Button.H> #include <FL/Fl_Round_Button.H> #include <FL/Fl_Int_Input.H> +typedef void (OptionsCallback)(void*); + class OptionsDialog : public Fl_Window { protected: OptionsDialog(); @@ -33,6 +37,9 @@ protected: public: static void showDialog(void); + static void addCallback(OptionsCallback *cb, void *data = NULL); + static void removeCallback(OptionsCallback *cb); + void show(void); protected: @@ -55,6 +62,8 @@ protected: static void handleOK(Fl_Widget *widget, void *data); protected: + static std::map<OptionsCallback*, void*> callbacks; + /* Compression */ Fl_Check_Button *autoselectCheckbox; |