KiCad PCB EDA Suite
HOTKEY_FILTER Class Reference

Class HOTKEY_FILTER. More...

Public Member Functions

 HOTKEY_FILTER (const wxString &aFilterStr)
bool FilterMatches (const EDA_HOTKEY &aHotkey) const
 Method FilterMatches. More...

Private Attributes

bool m_valid
wxString m_normalised_filter_str

Detailed Description


Class to manage logic for filtering hotkeys based on user input

Definition at line 231 of file widget_hotkey_list.cpp.

Constructor & Destructor Documentation

HOTKEY_FILTER::HOTKEY_FILTER ( const wxString &  aFilterStr)

Definition at line 234 of file widget_hotkey_list.cpp.

235  {
236  m_normalised_filter_str = aFilterStr.Upper();
237  m_valid = m_normalised_filter_str.size() > 0;
238  }
wxString m_normalised_filter_str

Member Function Documentation

bool HOTKEY_FILTER::FilterMatches ( const EDA_HOTKEY aHotkey) const

Method FilterMatches.

Checks if the filter matches the given hotkey

true on match (or if filter is disabled)

Definition at line 248 of file widget_hotkey_list.cpp.

References KeyNameFromKeyCode(), EDA_HOTKEY::m_InfoMsg, and EDA_HOTKEY::m_KeyCode.

Referenced by WIDGET_HOTKEY_LIST::updateShownItems().

249  {
250  if( !m_valid )
251  return true;
253  // Match in the (translated) filter string
254  const auto normedInfo = wxGetTranslation( aHotkey.m_InfoMsg ).Upper();
255  if( normedInfo.Contains( m_normalised_filter_str ) )
256  return true;
258  const wxString keyName = KeyNameFromKeyCode( aHotkey.m_KeyCode );
259  if( keyName.Upper().Contains( m_normalised_filter_str ) )
260  return true;
262  return false;
263  }
wxString m_normalised_filter_str
wxString m_InfoMsg
Definition: hotkeys_basic.h:66
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Function KeyNameFromKeyCode return the key name from the key code Only some wxWidgets key values are ...

Member Data Documentation

wxString HOTKEY_FILTER::m_normalised_filter_str

Definition at line 268 of file widget_hotkey_list.cpp.

bool HOTKEY_FILTER::m_valid

Definition at line 267 of file widget_hotkey_list.cpp.

The documentation for this class was generated from the following file: