2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-04-10 22:44:03 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIControllerCommand.idl"
|
|
|
|
#include "nsICommandParams.idl"
|
|
|
|
|
2019-04-03 15:52:14 +03:00
|
|
|
%{C++
|
|
|
|
class nsControllerCommandTable;
|
|
|
|
%}
|
|
|
|
|
2003-04-10 22:44:03 +04:00
|
|
|
/**
|
|
|
|
* nsIControllerCommandTable
|
2019-05-23 01:37:14 +03:00
|
|
|
*
|
2003-04-10 22:44:03 +04:00
|
|
|
* An interface via which a controller can maintain a series of commands,
|
|
|
|
* and efficiently dispatch commands to their respective handlers.
|
|
|
|
*
|
|
|
|
* Controllers that use an nsIControllerCommandTable should support
|
|
|
|
* nsIInterfaceRequestor, and be able to return an interface to their
|
|
|
|
* controller command table via getInterface().
|
2019-05-23 01:37:14 +03:00
|
|
|
*
|
2003-04-10 22:44:03 +04:00
|
|
|
*/
|
|
|
|
|
2019-04-03 15:52:14 +03:00
|
|
|
[scriptable, builtinclass, uuid(c847f90e-b8f3-49db-a4df-8867831f2800)]
|
2003-04-10 22:44:03 +04:00
|
|
|
interface nsIControllerCommandTable : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Make this command table immutable, so that commands cannot
|
|
|
|
* be registered or unregistered. Some command tables are made
|
2019-05-23 01:37:14 +03:00
|
|
|
* mutable after command registration so that they can be
|
2003-04-10 22:44:03 +04:00
|
|
|
* used as singletons.
|
|
|
|
*/
|
|
|
|
void makeImmutable();
|
2019-05-23 01:37:14 +03:00
|
|
|
|
2003-04-10 22:44:03 +04:00
|
|
|
/**
|
|
|
|
* Register and unregister commands with the command table.
|
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command under which to register or
|
|
|
|
* unregister the given command handler.
|
|
|
|
*
|
|
|
|
* @param aCommand the handler for this command.
|
|
|
|
*/
|
|
|
|
void registerCommand(in string aCommandName, in nsIControllerCommand aCommand);
|
|
|
|
void unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand);
|
2019-05-23 01:37:14 +03:00
|
|
|
|
2003-04-10 22:44:03 +04:00
|
|
|
/**
|
|
|
|
* Find the command handler which has been registered to handle the named command.
|
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command to find the handler for.
|
|
|
|
*/
|
|
|
|
nsIControllerCommand findCommandHandler(in string aCommandName);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the named command is enabled.
|
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command to test
|
|
|
|
* @param aCommandRefCon the command context data
|
|
|
|
*/
|
|
|
|
boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon);
|
|
|
|
|
|
|
|
/**
|
2005-11-26 00:57:13 +03:00
|
|
|
* Tell the command to update its state (if it is a state updating command)
|
2003-04-10 22:44:03 +04:00
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command to update
|
|
|
|
* @param aCommandRefCon the command context data
|
|
|
|
*/
|
|
|
|
void updateCommandState(in string aCommandName, in nsISupports aCommandRefCon);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get whether the named command is supported.
|
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command to test
|
|
|
|
* @param aCommandRefCon the command context data
|
|
|
|
*/
|
|
|
|
boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the named command.
|
|
|
|
*
|
|
|
|
* @param aCommandName the name of the command to execute
|
|
|
|
* @param aCommandRefCon the command context data
|
|
|
|
*/
|
2019-03-12 04:57:42 +03:00
|
|
|
[can_run_script]
|
2003-04-10 22:44:03 +04:00
|
|
|
void doCommand(in string aCommandName, in nsISupports aCommandRefCon);
|
|
|
|
|
2019-03-13 03:43:48 +03:00
|
|
|
[can_run_script]
|
2003-04-10 22:44:03 +04:00
|
|
|
void doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
|
|
|
|
|
|
|
|
void getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
|
2014-12-09 18:48:27 +03:00
|
|
|
|
2019-05-21 20:06:06 +03:00
|
|
|
Array<ACString> getSupportedCommands();
|
2019-04-03 15:52:14 +03:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
/**
|
|
|
|
* In order to avoid circular dependency issues, these methods are defined
|
|
|
|
* in nsControllerCommandTable.h. Consumers need to #include that header.
|
|
|
|
*/
|
|
|
|
inline nsControllerCommandTable* AsControllerCommandTable();
|
|
|
|
inline const nsControllerCommandTable* AsControllerCommandTable() const;
|
|
|
|
%}
|
2003-04-10 22:44:03 +04:00
|
|
|
};
|
|
|
|
|