diff --git a/TODO b/TODO index 44f9b7d..04cc72b 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -* Continue rebasing from 2f431b404983b49adfd3cca1c39a9b0a9616e70d +* Continue rebasing from 3cffde49fee87bfe5a426e8c799f143ed965cc60 * Add a focus listener interface. * Make focus apply synchronously. * Graphics and input objects for DirectX. diff --git a/include/guisan/key.hpp b/include/guisan/key.hpp index 1a025ff..a41890e 100644 --- a/include/guisan/key.hpp +++ b/include/guisan/key.hpp @@ -122,6 +122,23 @@ namespace gcn */ char getChar() const; + + /** + * Compares to keys. + * + * @param key The key to compare this key with. + * @return True if the keys are equal, false otherwise. + */ + bool operator==(const Key& key) const; + + /** + * Compares to keys. + * + * @param key The key to compare this key with. + * @return True if the keys are not equal, false otherwise. + */ + bool operator!=(const Key& key) const; + /** * An enum with key values. */ diff --git a/src/key.cpp b/src/key.cpp index b594335..17e6de5 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -96,12 +96,22 @@ namespace gcn { return mValue; } - - char Key::getChar() const - { - if(mValue == 9 || mValue == 13 || (mValue <= 122 && mValue >= 32)) - return (char)mValue; - - return '\0'; - } + + char Key::getChar() const + { + if (mValue == 9 || mValue == 13 || (mValue <= 122 && mValue >= 32)) + return (char) mValue; + + return '\0'; + } + + bool Key::operator==(const Key& key) const + { + return mValue == key.mValue; + } + + bool Key::operator!=(const Key& key) const + { + return (mValue != key.mValue); + } }