Audacity  2.2.2
Keyboard.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  Keyboard.h
6 
7  Dominic Mazzoni
8  Brian Gunlogson
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_KEYBOARD__
13 #define __AUDACITY_KEYBOARD__
14 
15 #include <wx/defs.h>
16 #include <wx/event.h>
17 #include <wx/string.h>
18 
19 struct NormalizedKeyString : private wxString
20 {
21  NormalizedKeyString() = default;
22 
23  explicit NormalizedKeyString( const wxString &str );
24 
25  wxString Display(bool usesSpecialChars = false) const;
26 
27  const wxString &Raw() const { return *this; }
28 
29  bool NoCaseEqual( const NormalizedKeyString &other ) const
30  { return 0 == this->Raw() .CmpNoCase( other.Raw() ); }
31 
32  using wxString::empty;
33 };
34 
35 inline bool operator ==
37 { return a.Raw () == b.Raw(); }
38 
39 inline bool operator !=
41 { return a.Raw () != b.Raw(); }
42 
43 inline bool operator <
45 { return a.Raw () < b.Raw(); }
46 
47 NormalizedKeyString KeyEventToKeyString(const wxKeyEvent & keyEvent);
48 
49 #endif
NormalizedKeyString KeyEventToKeyString(const wxKeyEvent &keyEvent)
Definition: Keyboard.cpp:78
bool NoCaseEqual(const NormalizedKeyString &other) const
Definition: Keyboard.h:29
NormalizedKeyString()=default
const wxString & Raw() const
Definition: Keyboard.h:27
wxString Display(bool usesSpecialChars=false) const
Definition: Keyboard.cpp:53