1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 17:10:55 +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 #if wxUSE_TOOLTIPS
mStaticText_TrackName->SetToolTip(mTrack->GetName()); mStaticText_TrackName->SetToolTip(mTrack->GetName());
mToggleButton_Mute->SetToolTip(_("Mute")); mToggleButton_Mute->SetToolTip(XO("Mute"));
mToggleButton_Solo->SetToolTip(_("Solo")); mToggleButton_Solo->SetToolTip(XO("Solo"));
if (GetWave()) if (GetWave())
mMeter->SetToolTip(XO("Signal Level Meter")); mMeter->SetToolTip(XO("Signal Level Meter"));
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS

View File

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

View File

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

View File

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