KiCad PCB EDA Suite
HOTKEY_FILTER Class Reference


Public Member Functions

 HOTKEY_FILTER (const wxString &aFilterStr)
bool FilterMatches (const 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 223 of file widget_hotkey_list.cpp.

Constructor & Destructor Documentation


HOTKEY_FILTER::HOTKEY_FILTER ( const wxString &  aFilterStr)

Definition at line 226 of file widget_hotkey_list.cpp.

227  {
228  m_normalised_filter_str = aFilterStr.Upper();
229  m_valid = m_normalised_filter_str.size() > 0;
230  }
wxString m_normalised_filter_str

References m_normalised_filter_str, and m_valid.

Member Function Documentation

◆ FilterMatches()

bool HOTKEY_FILTER::FilterMatches ( const HOTKEY aHotkey) const

Method FilterMatches.

Checks if the filter matches the given hotkey

true on match (or if filter is disabled)

Definition at line 239 of file widget_hotkey_list.cpp.

240  {
241  if( !m_valid )
242  return true;
244  // Match in the (translated) filter string
245  const auto normedInfo = wxGetTranslation( aHotkey.m_Actions[ 0 ]->GetLabel() ).Upper();
246  if( normedInfo.Contains( m_normalised_filter_str ) )
247  return true;
249  const wxString keyName = KeyNameFromKeyCode( aHotkey.m_EditKeycode );
250  if( keyName.Upper().Contains( m_normalised_filter_str ) )
251  return true;
253  return false;
254  }
wxString m_normalised_filter_str
std::vector< TOOL_ACTION * > m_Actions
Definition: hotkey_store.h:35
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Function KeyNameFromKeyCode return the key name from the key code Only some wxWidgets key values are ...
int m_EditKeycode
Definition: hotkey_store.h:36

References KeyNameFromKeyCode(), HOTKEY::m_Actions, HOTKEY::m_EditKeycode, m_normalised_filter_str, and m_valid.

Referenced by WIDGET_HOTKEY_LIST::updateShownItems().

Member Data Documentation

◆ m_normalised_filter_str

wxString HOTKEY_FILTER::m_normalised_filter_str

Definition at line 259 of file widget_hotkey_list.cpp.

Referenced by FilterMatches(), and HOTKEY_FILTER().

◆ m_valid

bool HOTKEY_FILTER::m_valid

Definition at line 258 of file widget_hotkey_list.cpp.

Referenced by FilterMatches(), and HOTKEY_FILTER().

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