Skip to content

Commit 9dd260a

Browse files
falbrechtskirchingerFlow86
authored andcommitted
Update text in shown tooltip
When a tooltip's text is changed, ask the WindowManager to update the currently shown tooltip. The call is only effective if the tooltip is actually being shown.
1 parent 2096f7d commit 9dd260a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

libs/s25main/controls/ctrlBaseTooltip.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ ctrlBaseTooltip::~ctrlBaseTooltip()
1010
HideTooltip();
1111
}
1212

13+
void ctrlBaseTooltip::SetTooltip(const std::string& tooltip)
14+
{
15+
tooltip_ = tooltip;
16+
WINDOWMANAGER.SetToolTip(this, tooltip_, true);
17+
}
18+
1319
void ctrlBaseTooltip::SwapTooltip(ctrlBaseTooltip& other)
1420
{
1521
std::swap(tooltip_, other.tooltip_);

libs/s25main/controls/ctrlBaseTooltip.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ctrlBaseTooltip
1414
ctrlBaseTooltip(std::string tooltip = "") : tooltip_(std::move(tooltip)) {}
1515
virtual ~ctrlBaseTooltip();
1616

17-
void SetTooltip(const std::string& tooltip) { tooltip_ = tooltip; }
17+
void SetTooltip(const std::string& tooltip);
1818
const std::string& GetTooltip() const { return tooltip_; }
1919
/// Swap the tooltips of those controls
2020
void SwapTooltip(ctrlBaseTooltip& other);

0 commit comments

Comments
 (0)