From f3508bdfdac089dd286317153cc92b395de1ef59 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 19 Jul 2023 17:08:15 +0300 Subject: [PATCH] Show option description on hovering --- client/widgets/CGarrisonInt.cpp | 10 +++++----- client/widgets/CGarrisonInt.h | 1 - client/widgets/RadialMenu.cpp | 9 +++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/client/widgets/CGarrisonInt.cpp b/client/widgets/CGarrisonInt.cpp index bbb57dda6..e4414c515 100644 --- a/client/widgets/CGarrisonInt.cpp +++ b/client/widgets/CGarrisonInt.cpp @@ -351,11 +351,11 @@ void CGarrisonSlot::gesture(bool on, const Point & initialPosition, const Point return; std::vector menuElements = { - { RadialMenuConfig::ITEM_NW, "stackMerge", "", [this](){owner->bulkMergeStacks(this);} }, - { RadialMenuConfig::ITEM_NE, "stackInfo", "", [this](){viewInfo();} }, - { RadialMenuConfig::ITEM_WW, "stackSplitOne", "", [this](){splitIntoParts(this->getGarrison(), 1); } }, - { RadialMenuConfig::ITEM_EE, "stackSplitEqual", "", [this](){owner->bulkSmartSplitStack(this);} }, - { RadialMenuConfig::ITEM_SW, "heroMove", "", [this](){owner->moveStackToAnotherArmy(this);} }, + { RadialMenuConfig::ITEM_NW, "stackMerge", "Merge same units", [this](){owner->bulkMergeStacks(this);} }, + { RadialMenuConfig::ITEM_NE, "stackInfo", "Show unit information", [this](){viewInfo();} }, + { RadialMenuConfig::ITEM_WW, "stackSplitOne", "Split off single unit", [this](){splitIntoParts(this->getGarrison(), 1); } }, + { RadialMenuConfig::ITEM_EE, "stackSplitEqual", "Split unit equally", [this](){owner->bulkSmartSplitStack(this);} }, + { RadialMenuConfig::ITEM_SW, "heroMove", "Move unit to another army", [this](){owner->moveStackToAnotherArmy(this);} }, }; GH.windows().createAndPushWindow(pos.center(), menuElements); diff --git a/client/widgets/CGarrisonInt.h b/client/widgets/CGarrisonInt.h index b991d4f31..b77d6300b 100644 --- a/client/widgets/CGarrisonInt.h +++ b/client/widgets/CGarrisonInt.h @@ -106,7 +106,6 @@ public: bool smallIcons; ///< true - 32x32 imgs, false - 58x64 bool removableUnits; ///< player Can remove units from up - bool twoRows; ///< slots Will be placed in 2 rows ESlotsLayout layout; diff --git a/client/widgets/RadialMenu.cpp b/client/widgets/RadialMenu.cpp index 84e8aeb9e..23db1a3fa 100644 --- a/client/widgets/RadialMenu.cpp +++ b/client/widgets/RadialMenu.cpp @@ -69,7 +69,16 @@ void RadialMenu::addItem(const Point & offset, const std::string & path, const s void RadialMenu::gesturePanning(const Point & initialPosition, const Point & currentPosition, const Point & lastUpdateDistance) { + GH.statusbar()->clear(); + for(const auto & item : items) + { + if (item->isInside(currentPosition)) + { + GH.statusbar()->write(item->hoverText); + break; + } + } } void RadialMenu::gesture(bool on, const Point & initialPosition, const Point & finalPosition)