diff --git a/src/guiengine/event_handler.cpp b/src/guiengine/event_handler.cpp index 999e73ab9..cf21b957c 100644 --- a/src/guiengine/event_handler.cpp +++ b/src/guiengine/event_handler.cpp @@ -821,7 +821,10 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event) return EVENT_BLOCK; } - w->onClick(); + EventPropagation result = w->onClick(); + + if (result == EVENT_BLOCK) + return result; // These events are only triggered by mouse (or so I hope) // The player that owns the mouser receives "game master" priviledges diff --git a/src/guiengine/widget.hpp b/src/guiengine/widget.hpp index badb8a2ac..5247d3c34 100644 --- a/src/guiengine/widget.hpp +++ b/src/guiengine/widget.hpp @@ -674,7 +674,7 @@ namespace GUIEngine bool ok() const { return (m_magic_number == 0xCAFEC001); } /** Gets called when the widget is active and got clicked. (Only works for button widgets for now.) */ - virtual void onClick() { } + virtual EventPropagation onClick() { return EVENT_LET; } virtual irr::core::dimension2di getDimension() const { return irr::core::dimension2di(m_w, m_h); } }; diff --git a/src/guiengine/widgets/rating_bar_widget.cpp b/src/guiengine/widgets/rating_bar_widget.cpp index 1625b852b..18d40c0f5 100644 --- a/src/guiengine/widgets/rating_bar_widget.cpp +++ b/src/guiengine/widgets/rating_bar_widget.cpp @@ -112,10 +112,12 @@ void RatingBarWidget::setStepValuesByMouse(const core::position2di & mouse_posit } } -void RatingBarWidget::onClick() +EventPropagation RatingBarWidget::onClick() { if(m_allow_voting) m_rating = m_hover_rating; + + return EVENT_LET; } diff --git a/src/guiengine/widgets/rating_bar_widget.hpp b/src/guiengine/widgets/rating_bar_widget.hpp index 592f5bfd8..5f7338d6b 100644 --- a/src/guiengine/widgets/rating_bar_widget.hpp +++ b/src/guiengine/widgets/rating_bar_widget.hpp @@ -73,7 +73,7 @@ namespace GUIEngine void setStepValuesByMouse(const core::position2di & mouse_position, const core::recti & stars_rect); - virtual void onClick(); + virtual EventPropagation onClick(); void allowVoting() { m_allow_voting = true; } }; diff --git a/src/guiengine/widgets/ribbon_widget.cpp b/src/guiengine/widgets/ribbon_widget.cpp index 2392925b3..25f73f161 100644 --- a/src/guiengine/widgets/ribbon_widget.cpp +++ b/src/guiengine/widgets/ribbon_widget.cpp @@ -779,6 +779,14 @@ EventPropagation RibbonWidget::mouseHovered(Widget* child, return EVENT_BLOCK; } // mouseHovered +EventPropagation RibbonWidget::onClick() +{ + if (m_ribbon_type == RIBBON_TOOLBAR) + return EVENT_BLOCK; + + return EVENT_LET; +} + // ---------------------------------------------------------------------------- const std::string& RibbonWidget::getSelectionIDString(const int playerID) { diff --git a/src/guiengine/widgets/ribbon_widget.hpp b/src/guiengine/widgets/ribbon_widget.hpp index 39a9afcaf..48c819e1a 100644 --- a/src/guiengine/widgets/ribbon_widget.hpp +++ b/src/guiengine/widgets/ribbon_widget.hpp @@ -92,6 +92,8 @@ namespace GUIEngine virtual EventPropagation focused(const int playerID) OVERRIDE; virtual void unfocused(const int playerID, Widget* new_focus) OVERRIDE; + virtual EventPropagation onClick() OVERRIDE; + PtrVector m_labels; IRibbonListener* m_listener; diff --git a/src/guiengine/widgets/spinner_widget.cpp b/src/guiengine/widgets/spinner_widget.cpp index 4aa7e5726..f7b9b1416 100644 --- a/src/guiengine/widgets/spinner_widget.cpp +++ b/src/guiengine/widgets/spinner_widget.cpp @@ -457,13 +457,13 @@ void SpinnerWidget::setCustomText(const core::stringw& text) // ----------------------------------------------------------------------------- -void SpinnerWidget::onClick() +EventPropagation SpinnerWidget::onClick() { if (m_children[1].m_deactivated || m_children[1].m_properties[PROP_ID] != "spinnerbody" || !isGauge()) { - return; + return EVENT_LET; } const core::position2di mouse_position @@ -487,6 +487,8 @@ void SpinnerWidget::onClick() setValue(new_value); } + + return EVENT_LET; } // ----------------------------------------------------------------------------- diff --git a/src/guiengine/widgets/spinner_widget.hpp b/src/guiengine/widgets/spinner_widget.hpp index 71ab7adae..72e5e5984 100644 --- a/src/guiengine/widgets/spinner_widget.hpp +++ b/src/guiengine/widgets/spinner_widget.hpp @@ -96,7 +96,7 @@ namespace GUIEngine virtual EventPropagation leftPressed(const int playerID); /** \brief implementing method from base class Widget */ - virtual void onClick(); + virtual EventPropagation onClick(); /** When inferring widget size from its label length, this method will be called to * if/how much space must be added to the raw label's size for the widget to be large enough */