From f9abb45a7776fa158daef508f8287da267de002b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Feb 2012 03:08:42 +0300 Subject: Allow chage gui opacity in settings on the fly. --- src/gui/setup_visual.cpp | 14 ++++++++++++++ src/gui/setup_visual.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp index cc713effa..1cf35e4f2 100644 --- a/src/gui/setup_visual.cpp +++ b/src/gui/setup_visual.cpp @@ -31,6 +31,7 @@ #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" +#include "gui/widgets/slider.h" #include "resources/image.h" @@ -72,3 +73,16 @@ void Setup_Visual::apply() Image::setEnableAlpha(config.getFloatValue("guialpha") != 1.0f); Client::applyGrabMode(); } + +void Setup_Visual::action(const gcn::ActionEvent &event) +{ + if (event.getId() == "guialphaEvent") + { + Slider *slider = static_cast(event.getSource()); + if (slider) + { + config.setValue("guialpha", slider->getValue()); + Image::setEnableAlpha(config.getFloatValue("guialpha") != 1.0f); + } + } +} diff --git a/src/gui/setup_visual.h b/src/gui/setup_visual.h index b8715f409..c76002c06 100644 --- a/src/gui/setup_visual.h +++ b/src/gui/setup_visual.h @@ -36,6 +36,7 @@ class Setup_Visual : public SetupTabScroll void apply(); + void action(const gcn::ActionEvent &event A_UNUSED); }; #endif -- cgit v1.2.3-70-g09d2