diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index 2bbdcd8cd..1060c4ac4 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -25,6 +25,8 @@ #include "rtimage.h" #include "rtscalable.h" #include "multilangmgr.h" +#include "adjuster.h" +#include "toolpanel.h" #include @@ -77,6 +79,34 @@ void IdleRegister::destroy() mutex.unlock(); } +BlockAdjusterEvents::BlockAdjusterEvents(Adjuster* adjuster) : adj(adjuster) +{ + if (adj) { + adj->block(true); + } +} + +BlockAdjusterEvents::~BlockAdjusterEvents() +{ + if (adj) { + adj->block(false); + } +} + +DisableListener::DisableListener(ToolPanel* panelToDisable) : panel(panelToDisable) +{ + if (panel) { + panel->disableListener(); + } +} + +DisableListener::~DisableListener() +{ + if (panel) { + panel->enableListener(); + } +} + Glib::ustring escapeHtmlChars(const Glib::ustring &src) { diff --git a/rtgui/guiutils.h b/rtgui/guiutils.h index 169d0ae11..aae2989a0 100644 --- a/rtgui/guiutils.h +++ b/rtgui/guiutils.h @@ -45,7 +45,9 @@ struct CropParams; } +class Adjuster; class RTImage; +class ToolPanel; Glib::ustring escapeHtmlChars(const Glib::ustring &src); bool removeIfThere (Gtk::Container* cont, Gtk::Widget* w, bool increference = true); @@ -161,6 +163,26 @@ private: bool wasBlocked; }; +class BlockAdjusterEvents +{ +public: + explicit BlockAdjusterEvents(Adjuster* adjuster); + ~BlockAdjusterEvents(); + +private: + Adjuster* adj; +}; + +class DisableListener +{ +public: + explicit DisableListener(ToolPanel* panelToDisable); + ~DisableListener(); + +private: + ToolPanel* panel; +}; + /** * @brief Glue box to control visibility of the MyExpender's content ; also handle the frame around it */