LuciadCPillar 2025.0.12
Loading...
Searching...
No Matches
luciad::ModifierKeys Struct Reference

Utility class that contains the combination of the modifier keys pressed. More...

#include <luciad/input/ModifierKeys.h>

Public Member Functions

constexpr ModifierKeys (size_t keys)
 Creates a new instance.
constexpr size_t getKeys () const
 Returns the combined pressed modifier keys.
constexpr bool hasFlag (ModifierKeys keys) const
 Returns if the specified modifier keys are pressed.
bool operator!= (const ModifierKeys &other) const
constexpr ModifierKeys operator& (const ModifierKeys &other) const
constexpr ModifierKeysoperator&= (const ModifierKeys &other)
constexpr ModifierKeysoperator= (const ModifierKeys &other)=default
bool operator== (const ModifierKeys &other) const
constexpr ModifierKeys operator^ (const ModifierKeys &other) const
constexpr ModifierKeysoperator^= (const ModifierKeys &other)
constexpr ModifierKeys operator| (const ModifierKeys &other) const
constexpr ModifierKeysoperator|= (const ModifierKeys &other)
constexpr ModifierKeys operator~ () const

Static Public Member Functions

static const ModifierKeysalt ()
 A ModifierKeys instance that represents the Alt modifier key.
static const ModifierKeysctrl ()
 A ModifierKeys instance that represents the Ctrl modifier key.
static const ModifierKeysnone ()
 A ModifierKeys instance that represents no modifier keys.
static const ModifierKeysshift ()
 A ModifierKeys instance that represents the Shift modifier key.

Detailed Description

Utility class that contains the combination of the modifier keys pressed.

The modifiers keys are mapped to the following values:

An example usage is:

auto ctrl = ModifierKeys::ctrl();
auto alt = ModifierKeys::alt();
auto ctrlAlt = ctrl | alt;
bool isNone = ctrlAlt == ModifierKeys::none(); // False
bool isAlt = ctrlAlt.hasFlag(ModifierKeys::alt()); // True
bool isCtrlAlt = ctrlAlt == (ModifierKeys::alt() | ModifierKeys::ctrl()); // True
See also
luciad::KeyCode for the available key codes to use in conjunction with this class.
Since
2020.1

Constructor & Destructor Documentation

◆ ModifierKeys()

luciad::ModifierKeys::ModifierKeys ( size_t keys)
inlineexplicitconstexpr

Creates a new instance.

Parameters
keysthe bits that represent the modifier keys.

Member Function Documentation

◆ alt()

const ModifierKeys & luciad::ModifierKeys::alt ( )
static

A ModifierKeys instance that represents the Alt modifier key.

◆ ctrl()

const ModifierKeys & luciad::ModifierKeys::ctrl ( )
static

A ModifierKeys instance that represents the Ctrl modifier key.

◆ getKeys()

size_t luciad::ModifierKeys::getKeys ( ) const
inlineconstexpr

Returns the combined pressed modifier keys.

Returns
the combined pressed modifier keys.

◆ hasFlag()

bool luciad::ModifierKeys::hasFlag ( ModifierKeys keys) const
inlineconstexpr

Returns if the specified modifier keys are pressed.

Parameters
keys
Returns
if the keys are pressed

◆ none()

const ModifierKeys & luciad::ModifierKeys::none ( )
static

A ModifierKeys instance that represents no modifier keys.

◆ operator!=()

bool luciad::ModifierKeys::operator!= ( const ModifierKeys & other) const
inline

◆ operator&()

ModifierKeys luciad::ModifierKeys::operator& ( const ModifierKeys & other) const
inlineconstexpr

◆ operator&=()

ModifierKeys & luciad::ModifierKeys::operator&= ( const ModifierKeys & other)
inlineconstexpr

◆ operator=()

ModifierKeys & luciad::ModifierKeys::operator= ( const ModifierKeys & other)
constexprdefault

◆ operator==()

bool luciad::ModifierKeys::operator== ( const ModifierKeys & other) const
inline

◆ operator^()

ModifierKeys luciad::ModifierKeys::operator^ ( const ModifierKeys & other) const
inlineconstexpr

◆ operator^=()

ModifierKeys & luciad::ModifierKeys::operator^= ( const ModifierKeys & other)
inlineconstexpr

◆ operator|()

ModifierKeys luciad::ModifierKeys::operator| ( const ModifierKeys & other) const
inlineconstexpr

◆ operator|=()

ModifierKeys & luciad::ModifierKeys::operator|= ( const ModifierKeys & other)
inlineconstexpr

◆ operator~()

ModifierKeys luciad::ModifierKeys::operator~ ( ) const
inlineconstexpr

◆ shift()

const ModifierKeys & luciad::ModifierKeys::shift ( )
static

A ModifierKeys instance that represents the Shift modifier key.