File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,9 +10,17 @@ ctrlBaseTooltip::~ctrlBaseTooltip()
1010 HideTooltip ();
1111}
1212
13+ void ctrlBaseTooltip::SetTooltip (const std::string& tooltip)
14+ {
15+ tooltip_ = tooltip;
16+ if (showing_)
17+ ShowTooltip (tooltip_);
18+ }
19+
1320void ctrlBaseTooltip::SwapTooltip (ctrlBaseTooltip& other)
1421{
1522 std::swap (tooltip_, other.tooltip_ );
23+ std::swap (showing_, other.showing_ );
1624}
1725
1826void ctrlBaseTooltip::ShowTooltip () const
@@ -23,9 +31,11 @@ void ctrlBaseTooltip::ShowTooltip() const
2331void ctrlBaseTooltip::ShowTooltip (const std::string& tooltip) const
2432{
2533 WINDOWMANAGER .SetToolTip (this , tooltip);
34+ showing_ = true ;
2635}
2736
2837void ctrlBaseTooltip::HideTooltip () const
2938{
3039 WINDOWMANAGER .SetToolTip (this , " " );
40+ showing_ = false ;
3141}
Original file line number Diff line number Diff 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);
@@ -26,4 +26,5 @@ class ctrlBaseTooltip
2626
2727protected:
2828 std::string tooltip_;
29+ mutable bool showing_ = false ;
2930};
You can’t perform that action at this time.
0 commit comments