33 : owner (target), info (
inf)
37 void messageCallback()
override
40 target->tryToInvoke (info,
false);
55bool ApplicationCommandTarget::tryToInvoke (
const InvocationInfo& info,
const bool async)
61 (
new CommandMessage (
this, info))->post();
90 while (target !=
nullptr)
104 if (depth > 100 || target ==
this)
108 if (target ==
nullptr)
112 if (target !=
nullptr)
141 while (target !=
nullptr)
143 if (target->tryToInvoke (info, async))
152 if (depth > 100 || target ==
this)
156 if (target ==
nullptr)
160 if (target !=
nullptr)
161 return target->tryToInvoke (info, async);
176ApplicationCommandTarget::InvocationInfo::InvocationInfo (
const CommandID command)
177 : commandID (command),
179 invocationMethod (direct),
180 originatingComponent (
nullptr),
182 millisecsSinceKeyPressed (0)
A command target publishes a list of command IDs that it can perform.
ApplicationCommandTarget * getTargetForCommand(CommandID commandID)
Searches this target and all subsequent ones for the first one that can handle the specified command.
ApplicationCommandTarget()
Creates a command target.
bool isCommandActive(CommandID commandID)
Checks whether this command can currently be performed by this target.
virtual ApplicationCommandTarget * getNextCommandTarget()=0
This must return the next target to try after this one.
virtual void getCommandInfo(CommandID commandID, ApplicationCommandInfo &result)=0
This must provide details about one of the commands that this target can perform.
virtual void getAllCommands(Array< CommandID > &commands)=0
This must return a complete list of commands that this target can handle.
bool invokeDirectly(CommandID commandID, bool asynchronously)
Invokes a given command directly on this target.
virtual bool perform(const InvocationInfo &info)=0
This must actually perform the specified command.
ApplicationCommandTarget * findFirstTargetParentComponent()
If this object is a Component, this method will search upwards in its current UI hierarchy for the ne...
virtual ~ApplicationCommandTarget()
Destructor.
bool invoke(const InvocationInfo &invocationInfo, bool asynchronously)
Makes this target invoke a command.
Holds a resizable array of primitive or copy-by-value objects.
The base class for all JUCE user-interface objects.
static JUCEApplication *JUCE_CALLTYPE getInstance() noexcept
Returns the global instance of the application object being run.
Internal class used as the base class for all message objects.
This class acts as a pointer which will automatically become null if the object to which it points is...
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
int CommandID
A type used to hold the unique ID for an application command.
Holds information describing an application command.
int flags
A bitwise-OR of the values specified in the CommandFlags enum.
@ isDisabled
Indicates that the command can't currently be performed.
Contains contextual details about the invocation of a command.
InvocationMethod invocationMethod
The type of event that triggered this command.
@ direct
The command is being invoked directly by a piece of code.