1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

AButton::SetToolTip takes TranslatableString

This commit is contained in:
Paul Licameli 2019-12-15 11:49:01 -05:00
parent 681950fc61
commit e875adaa6f
4 changed files with 13 additions and 4 deletions

View File

@ -313,8 +313,8 @@ MixerTrackCluster::MixerTrackCluster(wxWindow* parent,
#if wxUSE_TOOLTIPS
mStaticText_TrackName->SetToolTip(mTrack->GetName());
mToggleButton_Mute->SetToolTip(_("Mute"));
mToggleButton_Solo->SetToolTip(_("Solo"));
mToggleButton_Mute->SetToolTip(XO("Mute"));
mToggleButton_Solo->SetToolTip(XO("Solo"));
if (GetWave())
mMeter->SetToolTip(XO("Signal Level Meter"));
#endif // wxUSE_TOOLTIPS

View File

@ -869,7 +869,7 @@ void ToolBar::SetButtonToolTip
if (commandManager)
result =
commandManager->DescribeCommandsAndShortcuts(commands, nCommands);
button.SetToolTip(result);
button.SetToolTip( TranslatableString{ result } );
}
//

View File

@ -285,6 +285,11 @@ void AButton::UseDisabledAsDownHiliteImage(bool flag)
mUseDisabledAsDownHiliteImage = flag;
}
void AButton::SetToolTip( TranslatableString toolTip )
{
wxWindow::SetToolTip( toolTip.Strip().Translation() );
}
// This compensates for a but in wxWidgets 3.0.2 for mac:
// Couldn't set focus from keyboard when AcceptsFocus returns false;
// this bypasses that limitation
@ -445,7 +450,7 @@ void AButton::OnMouseEvent(wxMouseEvent & event)
// to make it pop up when we want it.
auto text = GetToolTipText();
UnsetToolTip();
SetToolTip(text);
wxWindow::SetToolTip(text);
mCursorIsInWindow = true;
}
else if (event.Leaving())

View File

@ -20,6 +20,7 @@
#include "ImageRoll.h" // member variable
class wxImage;
class TranslatableString;
class AButton final : public wxWindow {
friend class AButtonAx;
@ -55,6 +56,9 @@ class AButton final : public wxWindow {
virtual ~ AButton();
// overload and hide the inherited function that takes naked wxString:
void SetToolTip(TranslatableString toolTip);
bool AcceptsFocus() const override { return s_AcceptsFocus; }
bool AcceptsFocusFromKeyboard() const override { return mEnabled; }