KiCad PCB EDA Suite
HOTKEY_FILTER Class Reference

HOTKEY_FILTER. More...

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

HOTKEY_FILTER.

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::HOTKEY_FILTER ( const wxString &  aFilterStr)
inline

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

References m_normalised_filter_str, and m_valid.

Member Function Documentation

◆ FilterMatches()

bool HOTKEY_FILTER::FilterMatches ( const HOTKEY aHotkey) const
inline

Method FilterMatches.

Checks if the filter matches the given hotkey

Returns
true on match (or if filter is disabled)

Definition at line 247 of file widget_hotkey_list.cpp.

248  {
249  if( !m_valid )
250  return true;
251 
252  // Match in the (translated) filter string
253  const auto normedInfo = wxGetTranslation( aHotkey.m_Actions[ 0 ]->GetLabel() ).Upper();
254  if( normedInfo.Contains( m_normalised_filter_str ) )
255  return true;
256 
257  const wxString keyName = KeyNameFromKeyCode( aHotkey.m_EditKeycode );
258  if( keyName.Upper().Contains( m_normalised_filter_str ) )
259  return true;
260 
261  return false;
262  }
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
private

Definition at line 267 of file widget_hotkey_list.cpp.

Referenced by FilterMatches(), and HOTKEY_FILTER().

◆ m_valid

bool HOTKEY_FILTER::m_valid
private

Definition at line 266 of file widget_hotkey_list.cpp.

Referenced by FilterMatches(), and HOTKEY_FILTER().


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