Skip to content

Commit

Permalink
Merge pull request #1412 from Kurtsley/add-transaction-tooltip
Browse files Browse the repository at this point in the history
Add tooltip to buy and sell buttons.
  • Loading branch information
FilmBoy84 committed Apr 18, 2024
2 parents 48b733c + 4e0821c commit 99b00d4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions game/ui/general/transactioncontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "forms/listbox.h"
#include "forms/scrollbar.h"
#include "forms/ui.h"
#include "framework/configfile.h"
#include "framework/data.h"
#include "framework/framework.h"
#include "framework/logger.h"
Expand Down Expand Up @@ -678,13 +679,39 @@ TransactionControl::createControl(const UString &id, Type type, const UString &n
control->scrollBar->setMinimum(0);
control->scrollBar->setMaximum(0);
// ScrollBar buttons

// Set tooltip text for buttons
UString buttonTooltipLeftText;
UString buttonTooltipRightText;
bool marketOnRight = config().getBool("OpenApoc.NewFeature.MarketOnRight");
switch (control->itemType)
{
case Type::AgentEquipmentBio:
buttonTooltipLeftText = "Contain";
buttonTooltipRightText = "Destroy";
break;
case Type::BioChemist:
case Type::Engineer:
case Type::Physicist:
case Type::Soldier:
buttonTooltipLeftText = "Transfer";
buttonTooltipRightText = "Transfer";
break;
default:
buttonTooltipLeftText = marketOnRight ? "Buy" : "Sell";
buttonTooltipRightText = marketOnRight ? "Sell" : "Buy";
break;
}
auto buttonScrollLeft = control->createChild<GraphicButton>(nullptr, scrollLeft);
buttonScrollLeft->Size = scrollLeft->size;
buttonScrollLeft->Location = {87, 24};
buttonScrollLeft->ToolTipText = buttonTooltipLeftText;
buttonScrollLeft->ScrollBarPrevHorizontal = control->scrollBar;

auto buttonScrollRight = control->createChild<GraphicButton>(nullptr, scrollRight);
buttonScrollRight->Size = scrollRight->size;
buttonScrollRight->Location = {247, 24};
buttonScrollRight->ToolTipText = buttonTooltipRightText;
buttonScrollRight->ScrollBarNextHorizontal = control->scrollBar;
// Callback
control->setupCallbacks();
Expand Down

0 comments on commit 99b00d4

Please sign in to comment.