Class: TModifierKeys

Declaration: KeyPrimitives.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

TModifierKey is a concrete class that can be used to set the modifier key currently needed by the application. For instance, while binding keyboard accelerators to menu items, you can specify a modifier key and a text key to perform the menu item action. As an example, you might use Power-C to perform the copy command on a selection.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TModifierKeys::TModifierKeys

  1. TModifierKeys ()
  2. TModifierKeys (const TModifierKeys & modKeys)

Interface Category:

API.

Purpose:

  1. Default constructor. Creates an object which represents the state of no modifier keys being pressed.
  2. Copy constructor

Calling Context:

  1. Called by the stream-in operators and those interested in parsing keyboard events.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::~TModifierKeys

virtual ~ TModifierKeys ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::operator=

TModifierKeys & operator =(const TModifierKeys & modKeys)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

Returns a const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::operator==

bool operator ==(const TModifierKeys & modKeys) const

Interface Category:

API.

Purpose:

Returns true if this object is equal to the specified object. Equality is determined by checking to see if the modifiers that are set in the two objects are identical.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if this and the specified modifier are equal; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::operator!=

bool operator != (const TModifierKeys & modKeys) const

Interface Category:

API.

Purpose:

Returns true if this object is not equal to the specified object. Inequality is determined by testing whether or not the modifiers set in the two objects are identical.

Calling Context:

Call this function by using the operator in an expression.

Parameters:

Return Value:

Returns true if this and the specified modifier are not equal; returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::operator>>=

virtual TStream & operator >>=(TStream & to) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::operator<<=

virtual TStream & operator <<= (TStream & from)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsKeyDown

bool IsKeyDown (TVirtualKeyCode :: EVirtualKey modifier) const

Interface Category:

API.

Purpose:

Tests whether or not the specified modifier key code is down; that is, pressed.

Calling Context:

Called to check if a given modifier is down.

Parameters:

Return Value:

Returns true if the given modifier is down; returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsKeyUp

bool IsKeyUp (TVirtualKeyCode :: EVirtualKey modifier) const

Interface Category:

API.

Purpose:

Tests whether or not the specified modifier key code is up; that is, not pressed.

Calling Context:

Called to check if a given modifier is up.

Parameters:

Return Value:

Returns true if the modifier is up; returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlyKeyDown

bool IsOnlyKeyDown (TVirtualKeyCode :: EVirtualKey modifier) const

Interface Category:

API.

Purpose:

Tests whether or not the specified modifier is the only modifier key down; that is, if all other modifiers are up.

Calling Context:

Called to check if a given modifier is the only modifier down.

Parameters:

Return Value:

Returns true if it is the only modifier down; returns false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetModifierKey

virtual void SetModifierKey (TVirtualKeyCode :: EVirtualKey modifier, bool isDown =true)

Interface Category:

API.

Purpose:

Sets the modifier key code to be the one specified. The Boolean flag indicates whether the specified key code is down or up.

Calling Context:

Called to set the current modifier key.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsPowerKeyDown

bool IsPowerKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the power key is down.

Calling Context:

Called to test if the power key is down.

Parameters:

Return Value:

Returns true if power key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsPowerKeyUp

bool IsPowerKeyUp () const

Interface Category:

API.

Purpose:

Tests whether or not the power key is up.

Calling Context:

Called to test if the power key is up.

Parameters:

Return Value:

Returns true if power key is up; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlyPowerKeyDown

bool IsOnlyPowerKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the power key is the only one down.

Calling Context:

Called to test if the power key is the only key down.

Parameters:

Return Value:

Returns true if the power key is the only key down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetPowerKey

virtual void SetPowerKey (bool isDown =true)

Interface Category:

API.

Purpose:

Sets the power key to be down or up. If the isDown flag is true, the modifier will set the power key to be down. If the isDown flag is false, the modifier will set the power key to be up.

Calling Context:

Called to have the modifier set power key down or up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsSecondPowerKeyDown

bool IsSecondPowerKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the second power key is down.

Calling Context:

Called to check if the second power key is down.

Parameters:

Return Value:

Returns true if the second power key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsSecondPowerKeyUp

bool IsSecondPowerKeyUp () const

Interface Category:

API.

Purpose:

Tests whether or not the second power key is up.

Calling Context:

Called to check if the second power key is up.

Parameters:

Return Value:

Returns true if the second power key is up; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlySecondPowerKeyDown

bool IsOnlySecondPowerKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the second power key is the only modifier key down.

Calling Context:

Called to see if only the second power key is down.

Parameters:

Return Value:

Returns true if only the second power key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetSecondPowerKey

virtual void SetSecondPowerKey (bool isDown =true)

Interface Category:

API.

Purpose:

Sets the second power key. If the isDown flag is true, the modifier will set the second power key to be down. If isDown flag is false, the modifier will set the second power key to be up.

Calling Context:

Called to set the modifier to have second power key down or up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsShiftKeyDown

bool IsShiftKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the shift key is down.

Calling Context:

Called to test if the shift key is down.

Parameters:

Return Value:

Returns true if the shift key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsShiftKeyUp

bool IsShiftKeyUp () const

Interface Category:

API.

Purpose:

Tests whether or not the shift key is up.

Calling Context:

Called to test if the shift key is up.

Parameters:

Return Value:

Returns true if the shift is up; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlyShiftKeyDown

bool IsOnlyShiftKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the shift key is the only modifier key down.

Calling Context:

Called to test if the shift key is the only key down.

Parameters:

Return Value:

Returns true if the shift key is the only key down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetShiftKey

virtual void SetShiftKey (bool isDown =true)

Interface Category:

API.

Purpose:

Sets the shift key to be down or up. If the isDown flag is true, the modifier will set the shift key to be down. If isDown flag is false, the modifier will set the shift key to be up.

Calling Context:

Called to set the shift modifier key to be down or up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsSecondShiftKeyDown

bool IsSecondShiftKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the second shift key is down.

Calling Context:

Called to test if the second shift is down.

Parameters:

Return Value:

Returns true if the second shift key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsSecondShiftKeyUp

bool IsSecondShiftKeyUp () const

Interface Category:

API.

Purpose:

Tests whether or not the second shift key is up.

Calling Context:

Called to test if the second shift key is up.

Parameters:

Return Value:

Returns true if the second shift key is up; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlySecondShiftKeyDown

bool IsOnlySecondShiftKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the second shift key is the only key down.

Calling Context:

Called to test if the second shift key is the only key down.

Parameters:

Return Value:

Returns true if the second shift key is the only key down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetSecondShiftKey

virtual void SetSecondShiftKey (bool isDown =true)

Interface Category:

API.

Purpose:

Sets the second shift key to be down or up. If the isDown flag is true, the modifier will set the second shift key to be down. If the isDown flag is false, the modifier will set the second shift key to be up.

Calling Context:

Called to set the second shift modifier key to be down or up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsCapsLockKeyDown

bool IsCapsLockKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not if the CapsLock key is down.

Calling Context:

Called to test if the CapsLock modifier key is down.

Parameters:

Return Value:

Returns true if the CapsLock key is down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsCapsLockKeyUp

bool IsCapsLockKeyUp () const

Interface Category:

API.

Purpose:

Tests whether or not the CapsLock key is up.

Calling Context:

Called to test if the CapsLock key is up.

Parameters:

Return Value:

Returns true if the CapsLock key is up; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOnlyCapsLockKeyDown

bool IsOnlyCapsLockKeyDown () const

Interface Category:

API.

Purpose:

Tests whether or not the CapsLock key is the only modifier key down.

Calling Context:

Called to test if the CapsLock key is the only key down.

Parameters:

Return Value:

Returns true if the CapsLock key is the only key down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::SetCapsLockKey

virtual void SetCapsLockKey (bool isDown =true)

Interface Category:

API.

Purpose:

Sets the CapsLock key to be down or up. If the isDown flag is true, the modifier will set the CapsLock key to be down. If the isDown flag is false, the modifier will set the CapsLock key to be up.

Calling Context:

Called to set the CapsLock modifier key to be down or up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsOneOfTheseModifiersDown

bool IsOneOfTheseModifiersDown (const TModifierKeys & modKeys) const

Interface Category:

API.

Purpose:

Tests whether or not any one of the modifiers that are set in the specified key is down.

Calling Context:

Called to test if the modifiers in the specified key and this key have at least one common modifier.

Parameters:

Return Value:

Returns true if this modifier and the specified modifier key have at least one common modifier set to be down; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::UnionWith

void UnionWith(const TModifierKeys& modKeys)

Interface Category:

API.

Purpose:

Adds the modifiers from the specified key to the modifiers for this key.

Calling Context:

Called to merge the modifiers of the specified key into this key.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::MaskAndMatchModifiers

bool MaskAndMatchModifiers (const TModifierKeys & modSet1, const TModifierKeys & mask)

Interface Category:

API.

Purpose:

Masks the specified modifier keys with the specified mask (logical AND) and tests if the result matches this modifier.

Calling Context:

Called to test if this modifier and the result of the specified mask and modifier are identical.

Parameters:

Return Value:

Returns true if the modifier resulting from the logical and is identical to this modifier.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::IsModifier

bool IsModifier (TVirtualKeyCode :: EVirtualKey virtualKey) const

Interface Category:

API.

Purpose:

Determines whether or not the specified key code is a modifier.

Calling Context:

Called to test if the specified key code is a modifier.

Parameters:

Return Value:

Returns true if the given key code is a modifier; false otherwise.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::GetModifiersOn

virtual void GetModifiersOn (TPrimitiveTypeArray < TVirtualKeyCode :: EVirtualKey> & modifiersOn) const

Interface Category:

API.

Purpose:

Gets the modifiers that are currently down.

Calling Context:

Called to get the modifiers currently down.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TModifierKeys::GetModifiersOff

virtual void GetModifiersOff (TPrimitiveTypeArray < TVirtualKeyCode :: EVirtualKey >& modifiersOff) const

Interface Category:

API.

Purpose:

Gets the modifiers that are currently up.

Calling Context:

Called to get the modifiers currently up.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.