Add tooltips to hotkey dialog buttons

THis is done in the generic widget, so other users can
benefit from it.
This commit is contained in:
John Beard 2018-10-02 13:41:16 +01:00 committed by Wayne Stambaugh
parent 23038b1550
commit 7c2c8d307e
3 changed files with 11 additions and 0 deletions

View File

@ -101,6 +101,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
{ {
wxID_RESET, wxID_RESET,
_( "Reset Hotkeys" ), _( "Reset Hotkeys" ),
_( "Undo all changes made so far in this dialog" ),
[this]( wxCommandEvent ){ [this]( wxCommandEvent ){
m_hotkeyListCtrl->ResetAllHotkeys( false ); m_hotkeyListCtrl->ResetAllHotkeys( false );
} }
@ -108,6 +109,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
{ {
wxID_ANY, wxID_ANY,
_( "Set to Defaults" ), _( "Set to Defaults" ),
_( "Set all hotkeys to the built-in KiCad defaults" ),
[this]( wxCommandEvent ){ [this]( wxCommandEvent ){
m_hotkeyListCtrl->ResetAllHotkeys( true ); m_hotkeyListCtrl->ResetAllHotkeys( true );
} }
@ -118,6 +120,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
{ {
wxID_ANY, wxID_ANY,
_( "Import..." ), _( "Import..." ),
_( "Import hotkey definitions from an external file, replacing the current values" ),
[this]( wxCommandEvent ){ [this]( wxCommandEvent ){
m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname ); m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );
} }
@ -125,6 +128,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
{ {
wxID_ANY, wxID_ANY,
_( "Export..." ), _( "Export..." ),
_( "Export these hotkey definitions to an external file" ),
[this]( wxCommandEvent ){ [this]( wxCommandEvent ){
m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname ); m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname );
} }

View File

@ -68,6 +68,8 @@ void BUTTON_ROW_PANEL::addButtons( bool aLeft, const BTN_DEF_LIST& aDefs )
if( ( aLeft ) || ( !aLeft && i < aDefs.size() - 1 ) ) if( ( aLeft ) || ( !aLeft && i < aDefs.size() - 1 ) )
this_style |= wxRIGHT; this_style |= wxRIGHT;
btn->SetToolTip( def.m_tooltip );
m_sizer->Add( btn, btn_proportion, this_style, btn_margin ); m_sizer->Add( btn, btn_proportion, this_style, btn_margin );
btn->Bind( wxEVT_COMMAND_BUTTON_CLICKED, def.m_callback ); btn->Bind( wxEVT_COMMAND_BUTTON_CLICKED, def.m_callback );

View File

@ -63,6 +63,11 @@ public:
*/ */
wxString m_text; wxString m_text;
/**
* Button tooltip text - empty string for no tooltip
*/
wxString m_tooltip;
/** /**
* The callback fired when the button is clicked. Can be nullptr, * The callback fired when the button is clicked. Can be nullptr,
* but then the button is useless. * but then the button is useless.