This class represents a single modifier key. A modifier key is Shift, Ctrl or Alt. A key has, besides a GDK symbol related to it, a Mask that must be appended to each keyboard event when this modifier is set.
| 43 | // that must be appended to each keyboard event when this modifier is |
| 44 | // set. |
| 45 | class XModifierKey |
| 46 | { |
| 47 | public: |
| 48 | // Stores the key associated with this modifier and the bit-mask |
| 49 | // to set when this key was toggled. |
| 50 | XModifierKey(const guint& associated_gdk_key, const GdkModifierType& gdk_mod, |
| 51 | const guint32& stored_state); |
| 52 | // if a_key matches the associated gdk key, toggeles the modifier |
| 53 | // key state. |
| 54 | void ToggleIfKeyMatches(const guint a_key); |
| 55 | // Returns true if the key given matches the key associated with |
| 56 | // this modifier. |
| 57 | bool KeyMatches(const guint a_key) const; |
| 58 | // if the modifier key was pressed, return the mask to OR with. |
| 59 | // If not, return 0. |
| 60 | guint GetAppropriateMask() const; |
| 61 | // Set the modifier to false. |
| 62 | void ClearModifier(); |
| 63 | // Returns the associated key |
| 64 | guint get_associated_key() const; |
| 65 | // Returns true if the modifier is set, false otherwise. |
| 66 | bool get_toggle() const; |
| 67 | // Store the current state of the modifier key into the provided int. |
| 68 | void StoreState(guint32* state_store) const; |
| 69 | private: |
| 70 | bool toggle_; |
| 71 | guint associated_key_; |
| 72 | GdkModifierType gdk_mod_mask_; |
| 73 | }; |
| 74 | |
| 75 | XModifierKey::XModifierKey(const guint& associated_gdk_key, |
| 76 | const GdkModifierType& gdk_mod, |