diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp index 3c39590dee..5b92699982 100644 --- a/apps/openmw/mwgui/waitdialog.cpp +++ b/apps/openmw/mwgui/waitdialog.cpp @@ -84,6 +84,8 @@ namespace MWGui trackFocusEvents(mUntilHealedButton); trackFocusEvents(mWaitButton); trackFocusEvents(mCancelButton); + for (MyGUI::Widget* widget : mHourSlider->getAllWidgets()) + trackFocusEvents(widget); } void WaitDialog::setPtr(const MWWorld::Ptr& ptr) diff --git a/apps/openmw/mwgui/waitdialog.hpp b/apps/openmw/mwgui/waitdialog.hpp index 8a38dd0976..0d6d2a82d2 100644 --- a/apps/openmw/mwgui/waitdialog.hpp +++ b/apps/openmw/mwgui/waitdialog.hpp @@ -4,6 +4,7 @@ #include "timeadvancer.hpp" #include "windowbase.hpp" #include +#include namespace MWGui { @@ -53,7 +54,7 @@ namespace MWGui MyGUI::Button* mUntilHealedButton; MyGUI::Button* mWaitButton; MyGUI::Button* mCancelButton; - MyGUI::ScrollBar* mHourSlider; + Gui::ScrollBar* mHourSlider; TimeAdvancer mTimeAdvancer; bool mSleeping; diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 7659de0ffd..6e6d3ee984 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -353,7 +353,7 @@ add_component_dir (myguiplatform ) add_component_dir (widgets - box fontwrapper imagebutton tags list numericeditbox sharedstatebutton windowcaption widgets + box fontwrapper imagebutton tags list numericeditbox scrollbar sharedstatebutton windowcaption widgets ) add_component_dir (fontloader diff --git a/components/widgets/scrollbar.cpp b/components/widgets/scrollbar.cpp new file mode 100644 index 0000000000..0384003e65 --- /dev/null +++ b/components/widgets/scrollbar.cpp @@ -0,0 +1,17 @@ +#include "scrollbar.hpp" + +#include + +namespace Gui +{ + std::vector ScrollBar::getAllWidgets() + { + std::vector widgets; + widgets.push_back(mWidgetStart); + widgets.push_back(mWidgetEnd); + widgets.push_back(mWidgetTrack); + widgets.push_back(mWidgetFirstPart); + widgets.push_back(mWidgetSecondPart); + return widgets; + } +} diff --git a/components/widgets/scrollbar.hpp b/components/widgets/scrollbar.hpp new file mode 100644 index 0000000000..fa4cee01f0 --- /dev/null +++ b/components/widgets/scrollbar.hpp @@ -0,0 +1,18 @@ +#ifndef OPENMW_COMPONENTS_WIDGETS_SCROLLBAR_H +#define OPENMW_COMPONENTS_WIDGETS_SCROLLBAR_H + +#include + +namespace Gui +{ + /// @brief A scrollbar that can return all its widgets for binding hover listeners. + class ScrollBar : public MyGUI::ScrollBar + { + MYGUI_RTTI_DERIVED(ScrollBar) + + public: + std::vector getAllWidgets(); + }; +} + +#endif diff --git a/components/widgets/widgets.cpp b/components/widgets/widgets.cpp index d27d7e5fc9..58b5736b30 100644 --- a/components/widgets/widgets.cpp +++ b/components/widgets/widgets.cpp @@ -6,6 +6,7 @@ #include "imagebutton.hpp" #include "list.hpp" #include "numericeditbox.hpp" +#include "scrollbar.hpp" #include "sharedstatebutton.hpp" #include "windowcaption.hpp" @@ -26,6 +27,7 @@ namespace Gui MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); + MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); MyGUI::FactoryManager::getInstance().registerFactory("Widget"); }