Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltip to buy and sell buttons. #1412

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -672,13 +673,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
Loading