Loading...
Searching...
No Matches
juce::ApplicationCommandInfo Struct Reference

## Detailed Description

Holds information describing an application command.

This object is used to pass information about a particular command, such as its name, description and other usage flags.

When an ApplicationCommandTarget is asked to provide information about the commands it can perform, this is the structure gets filled-in to describe each one.

See also
  ApplicationCommandTarget, ApplicationCommandTarget::getCommandInfo(), ApplicationCommandManager

The documentation for this struct was generated from the following file:

- juce_gui_basics/commands/juce_ApplicationCommandInfo.h

## Public Types

enum | CommandFlags { isDisabled = 1 << 0 , isTicked = 1 << 1 , wantsKeyUpDownCallbacks = 1 << 2 , hiddenFromKeyEditor = 1 << 3 , readOnlyInKeyEditor = 1 << 4 , dontTriggerVisualFeedback = 1 << 5 }
| Flags describing the ways in which this command should be used. More...

## Public Member Functions

| ApplicationCommandInfo (CommandID commandID) noexcept
void | setInfo (const String &shortName, const String &description, const String &categoryName, int flags) noexcept
| Sets a number of the structures values at once.
void | setActive (bool isActive) noexcept
| An easy way to set or remove the isDisabled bit in the structure's flags field.
void | setTicked (bool isTicked) noexcept
| An easy way to set or remove the isTicked bit in the structure's flags field.
void | addDefaultKeypress (int keyCode, ModifierKeys modifiers) noexcept
| Handy method for adding a keypress to the defaultKeypresses array.

## Public Attributes

CommandID | commandID
| The command's unique ID number.
String | shortName
| A short name to describe the command.
String | description
| A longer description of the command.
String | categoryName
| A named category that the command fits into.
Array< KeyPress > | defaultKeypresses
| A list of zero or more keypresses that should be used as the default keys for this command.
int | flags
| A bitwise-OR of the values specified in the CommandFlags enum.

## Member Enums

## CommandFlags

enum juce::ApplicationCommandInfo::CommandFlags

Flags describing the ways in which this command should be used.

A bitwise-OR of these values is stored in the ApplicationCommandInfo::flags variable.

Enumerator

isDisabled

Indicates that the command can't currently be performed.

The ApplicationCommandTarget::getCommandInfo() method must set this flag if it's not currently permissible to perform the command. If the flag is set, then components that trigger the command, e.g. PopupMenu, may choose to grey-out the command or show themselves as not being enabled.

See also
  ApplicationCommandInfo::setActive

isTicked

Indicates that the command should have a tick next to it on a menu.

If your command is shown on a menu and this is set, it'll show a tick next to it. Other components such as buttons may also use this flag to indicate that it is a value that can be toggled, and is currently in the 'on' state.

See also
  ApplicationCommandInfo::setTicked

wantsKeyUpDownCallbacks

If this flag is present, then when a KeyPressMappingSet invokes the command, it will call the command twice, once on key-down and again on key-up.

See also
  ApplicationCommandTarget::InvocationInfo

hiddenFromKeyEditor | If this flag is present, then a KeyMappingEditorComponent will not display the command in its list.
readOnlyInKeyEditor | If this flag is present, then a KeyMappingEditorComponent will display the command in its list, but won't allow the assigned keypress to be changed.
dontTriggerVisualFeedback | If this flag is present and the command is invoked from a keypress, then any buttons or menus that are also connected to the command will not flash to indicate that they've been triggered.

## Constructors and Destructors

## ApplicationCommandInfo()

juce::ApplicationCommandInfo::ApplicationCommandInfo | ( | CommandID | commandID | ) |

explicit noexcept

References commandID.

## Member Functions

## setInfo()

void juce::ApplicationCommandInfo::setInfo | ( | const String & | shortName,
|  | const String & | description,
|  | const String & | categoryName,
|  | int | flags )

noexcept

Sets a number of the structures values at once.

The meanings of each of the parameters is described below, in the appropriate member variable's description.

References categoryName, description, flags, and shortName.

## setActive()

void juce::ApplicationCommandInfo::setActive | ( | bool | isActive | ) |

noexcept

An easy way to set or remove the isDisabled bit in the structure's flags field.

If isActive is true, the flags member has the isDisabled bit cleared; if isActive is false, the bit is set.

## setTicked()

void juce::ApplicationCommandInfo::setTicked | ( | bool | isTicked | ) |

noexcept

An easy way to set or remove the isTicked bit in the structure's flags field.

References isTicked.

## addDefaultKeypress()

void juce::ApplicationCommandInfo::addDefaultKeypress | ( | int | keyCode,
|  | ModifierKeys | modifiers )

noexcept

Handy method for adding a keypress to the defaultKeypresses array.

This is just so you can write things like:

myinfo.addDefaultKeypress ('s', ModifierKeys::commandModifier);
juce::ModifierKeys::commandModifier
@ commandModifier
Command key flag - on windows this is the same as the CTRL key flag.
Definition juce_ModifierKeys.h:159

instead of

myinfo.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier));
juce::KeyPress
Represents a key press, including any modifier keys that are needed.
Definition juce_KeyPress.h:49

## Member Data Documentation

## commandID

CommandID juce::ApplicationCommandInfo::commandID

The command's unique ID number.

Referenced by ApplicationCommandInfo().

## shortName

String juce::ApplicationCommandInfo::shortName

A short name to describe the command.

This should be suitable for use in menus, on buttons that trigger the command, etc.

You can use the setInfo() method to quickly set this and some of the command's other properties.

Referenced by setInfo().

## description

String juce::ApplicationCommandInfo::description

A longer description of the command.

This should be suitable for use in contexts such as a KeyMappingEditorComponent or pop-up tooltip describing what the command does.

You can use the setInfo() method to quickly set this and some of the command's other properties.

Referenced by setInfo().

## categoryName

String juce::ApplicationCommandInfo::categoryName

A named category that the command fits into.

You can give your commands any category you like, and these will be displayed in contexts such as the KeyMappingEditorComponent, where the category is used to group commands together.

You can use the setInfo() method to quickly set this and some of the command's other properties.

Referenced by setInfo().

## defaultKeypresses

Array<KeyPress> juce::ApplicationCommandInfo::defaultKeypresses

A list of zero or more keypresses that should be used as the default keys for this command.

Methods such as KeyPressMappingSet::resetToDefaultMappings() will use the keypresses in this list to initialise the default set of key-to-command mappings.

See also
  addDefaultKeypress

## flags

int juce::ApplicationCommandInfo::flags

A bitwise-OR of the values specified in the CommandFlags enum.

You can use the setInfo() method to quickly set this and some of the command's other properties.

Referenced by setInfo().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited