1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00
Files
audacity/src/commands/Keyboard.h
Paul Licameli e5052a1973 Use a type distinction for key strings in normalized form...
... Such are not for display to the user.  They are appended to menu item
names to identify accelerators, and wxWidgets transforms them appropriately
for the operating system.
2018-02-25 14:56:17 -05:00

50 lines
1.2 KiB
C

/**********************************************************************
Audacity: A Digital Audio Editor
Keyboard.h
Dominic Mazzoni
Brian Gunlogson
**********************************************************************/
#ifndef __AUDACITY_KEYBOARD__
#define __AUDACITY_KEYBOARD__
#include <wx/defs.h>
#include <wx/event.h>
#include <wx/string.h>
struct NormalizedKeyString : private wxString
{
NormalizedKeyString() = default;
explicit NormalizedKeyString( const wxString &str );
wxString Display(bool usesSpecialChars = false) const;
const wxString &Raw() const { return *this; }
bool NoCaseEqual( const NormalizedKeyString &other ) const
{ return 0 == this->Raw() .CmpNoCase( other.Raw() ); }
using wxString::empty;
};
inline bool operator ==
( const NormalizedKeyString &a, const NormalizedKeyString &b)
{ return a.Raw () == b.Raw(); }
inline bool operator !=
( const NormalizedKeyString &a, const NormalizedKeyString &b)
{ return a.Raw () != b.Raw(); }
inline bool operator <
( const NormalizedKeyString &a, const NormalizedKeyString &b)
{ return a.Raw () < b.Raw(); }
NormalizedKeyString KeyEventToKeyString(const wxKeyEvent & keyEvent);
#endif