openshot-audio  0.1.2
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
juce::ModifierKeys Class Reference

#include <juce_gui_basics.h>

Public Types

enum  Flags {
  noModifiers = 0, shiftModifier = 1, ctrlModifier = 2, altModifier = 4,
  leftButtonModifier = 16, rightButtonModifier = 32, middleButtonModifier = 64, commandModifier = ctrlModifier,
  popupMenuClickModifier = rightButtonModifier, allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier, allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier, ctrlAltCommandModifiers = ctrlModifier | altModifier | commandModifier
}
 

Public Member Functions

 ModifierKeys () noexcept
 
 ModifierKeys (int flags) noexcept
 
 ModifierKeys (const ModifierKeys &other) noexcept
 
ModifierKeysoperator= (const ModifierKeys other) noexcept
 
bool isCommandDown () const noexcept
 
bool isPopupMenu () const noexcept
 
bool isLeftButtonDown () const noexcept
 
bool isRightButtonDown () const noexcept
 
bool isMiddleButtonDown () const noexcept
 
bool isAnyMouseButtonDown () const noexcept
 
bool isAnyModifierKeyDown () const noexcept
 
bool isShiftDown () const noexcept
 
bool isCtrlDown () const noexcept
 
bool isAltDown () const noexcept
 
ModifierKeys withOnlyMouseButtons () const noexcept
 
ModifierKeys withoutMouseButtons () const noexcept
 
bool operator== (const ModifierKeys other) const noexcept
 
bool operator!= (const ModifierKeys other) const noexcept
 
int getRawFlags () const noexcept
 
ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept
 
ModifierKeys withFlags (int rawFlagsToSet) const noexcept
 
bool testFlags (int flagsToTest) const noexcept
 
int getNumMouseButtonsDown () const noexcept
 

Static Public Member Functions

static ModifierKeys getCurrentModifiers () noexcept
 
static ModifierKeys getCurrentModifiersRealtime () noexcept
 

Friends

class ComponentPeer
 
class MouseInputSource
 
class MouseInputSourceInternal
 

Detailed Description

Represents the state of the mouse buttons and modifier keys.

This is used both by mouse events and by KeyPress objects to describe the state of keys such as shift, control, alt, etc.

See also
KeyPress, MouseEvent::mods

Member Enumeration Documentation

Flags that represent the different keys.

Enumerator
noModifiers 

Indicates no modifier keys.

shiftModifier 

Shift key flag.

ctrlModifier 

CTRL key flag.

altModifier 

ALT key flag.

leftButtonModifier 

Left mouse button flag.

rightButtonModifier 

Right mouse button flag.

middleButtonModifier 

Middle mouse button flag.

commandModifier 

Command key flag - on windows this is the same as the CTRL key flag.

popupMenuClickModifier 

Popup menu flag - on windows this is the same as rightButtonModifier, on the Mac it's the same as (rightButtonModifier | ctrlModifier).

allKeyboardModifiers 

Represents a combination of all the shift, alt, ctrl and command key modifiers.

allMouseButtonModifiers 

Represents a combination of all the mouse buttons at once.

ctrlAltCommandModifiers 

Represents a combination of all the alt, ctrl and command key modifiers.

Constructor & Destructor Documentation

ModifierKeys::ModifierKeys ( )
noexcept

Creates a ModifierKeys object with no flags set.

ModifierKeys::ModifierKeys ( int  flags)
noexcept

Creates a ModifierKeys object from a raw set of flags.

Parameters
flagsto represent the keys that are down
See also
shiftModifier, ctrlModifier, altModifier, leftButtonModifier, rightButtonModifier, commandModifier, popupMenuClickModifier
ModifierKeys::ModifierKeys ( const ModifierKeys other)
noexcept

Creates a copy of another object.

Member Function Documentation

ModifierKeys ModifierKeys::getCurrentModifiers ( )
staticnoexcept

Creates a ModifierKeys object to represent the last-known state of the keyboard and mouse buttons.

See also
getCurrentModifiersRealtime
static ModifierKeys juce::ModifierKeys::getCurrentModifiersRealtime ( )
staticnoexcept

Creates a ModifierKeys object to represent the current state of the keyboard and mouse buttons.

This isn't often needed and isn't recommended, but will actively check all the mouse and key states rather than just returning their last-known state like getCurrentModifiers() does.

This is only needed in special circumstances for up-to-date modifier information at times when the app's event loop isn't running normally.

Another reason to avoid this method is that it's not stateless, and calling it may update the value returned by getCurrentModifiers(), which could cause subtle changes in the behaviour of some components.

int ModifierKeys::getNumMouseButtonsDown ( ) const
noexcept

Returns the total number of mouse buttons that are down.

int juce::ModifierKeys::getRawFlags ( ) const
inlinenoexcept

Returns the raw flags for direct testing.

bool juce::ModifierKeys::isAltDown ( ) const
inlinenoexcept

Checks whether the ALT key's flag is set.

bool juce::ModifierKeys::isAnyModifierKeyDown ( ) const
inlinenoexcept

Tests for any of the modifier key flags.

bool juce::ModifierKeys::isAnyMouseButtonDown ( ) const
inlinenoexcept

Tests for any of the mouse-button flags.

bool juce::ModifierKeys::isCommandDown ( ) const
inlinenoexcept

Checks whether the 'command' key flag is set (or 'ctrl' on Windows/Linux).

This is a platform-agnostic way of checking for the operating system's preferred command-key modifier - so on the Mac it tests for the Apple key, on Windows/Linux, it's actually checking for the CTRL key.

bool juce::ModifierKeys::isCtrlDown ( ) const
inlinenoexcept

Checks whether the CTRL key's flag is set.

Remember that it's better to use the platform-agnostic routines to test for command-key and popup-menu modifiers.

See also
isCommandDown, isPopupMenu
bool juce::ModifierKeys::isLeftButtonDown ( ) const
inlinenoexcept

Checks whether the flag is set for the left mouse-button.

bool juce::ModifierKeys::isMiddleButtonDown ( ) const
inlinenoexcept
bool juce::ModifierKeys::isPopupMenu ( ) const
inlinenoexcept

Checks whether the user is trying to launch a pop-up menu.

This checks for platform-specific modifiers that might indicate that the user is following the operating system's normal method of showing a pop-up menu.

So on Windows/Linux, this method is really testing for a right-click. On the Mac, it tests for either the CTRL key being down, or a right-click.

bool juce::ModifierKeys::isRightButtonDown ( ) const
inlinenoexcept

Checks whether the flag is set for the right mouse-button.

Note that for detecting popup-menu clicks, you should be using isPopupMenu() instead, as this is platform-independent (and makes your code more explanatory too).

bool juce::ModifierKeys::isShiftDown ( ) const
inlinenoexcept

Checks whether the shift key's flag is set.

bool juce::ModifierKeys::operator!= ( const ModifierKeys  other) const
inlinenoexcept
ModifierKeys & ModifierKeys::operator= ( const ModifierKeys  other)
noexcept

Copies this object from another one.

bool juce::ModifierKeys::operator== ( const ModifierKeys  other) const
inlinenoexcept
bool juce::ModifierKeys::testFlags ( int  flagsToTest) const
inlinenoexcept

Tests a combination of flags and returns true if any of them are set.

ModifierKeys juce::ModifierKeys::withFlags ( int  rawFlagsToSet) const
inlinenoexcept
ModifierKeys juce::ModifierKeys::withOnlyMouseButtons ( ) const
inlinenoexcept

Returns a copy of only the mouse-button flags

ModifierKeys juce::ModifierKeys::withoutFlags ( int  rawFlagsToClear) const
inlinenoexcept
ModifierKeys juce::ModifierKeys::withoutMouseButtons ( ) const
inlinenoexcept

Returns a copy of only the non-mouse flags

Friends And Related Function Documentation

friend class ComponentPeer
friend
friend class MouseInputSource
friend
friend class MouseInputSourceInternal
friend

The documentation for this class was generated from the following files: