michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsIControllerCommand.idl" michael@0: #include "nsICommandParams.idl" michael@0: michael@0: /** michael@0: * nsIControllerCommandTable michael@0: * michael@0: * An interface via which a controller can maintain a series of commands, michael@0: * and efficiently dispatch commands to their respective handlers. michael@0: * michael@0: * Controllers that use an nsIControllerCommandTable should support michael@0: * nsIInterfaceRequestor, and be able to return an interface to their michael@0: * controller command table via getInterface(). michael@0: * michael@0: */ michael@0: michael@0: [scriptable, uuid(d1a47834-6ad4-11d7-bfad-000393636592)] michael@0: interface nsIControllerCommandTable : nsISupports michael@0: { michael@0: /** michael@0: * Make this command table immutable, so that commands cannot michael@0: * be registered or unregistered. Some command tables are made michael@0: * mutable after command registration so that they can be michael@0: * used as singletons. michael@0: */ michael@0: void makeImmutable(); michael@0: michael@0: /** michael@0: * Register and unregister commands with the command table. michael@0: * michael@0: * @param aCommandName the name of the command under which to register or michael@0: * unregister the given command handler. michael@0: * michael@0: * @param aCommand the handler for this command. michael@0: */ michael@0: void registerCommand(in string aCommandName, in nsIControllerCommand aCommand); michael@0: void unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand); michael@0: michael@0: /** michael@0: * Find the command handler which has been registered to handle the named command. michael@0: * michael@0: * @param aCommandName the name of the command to find the handler for. michael@0: */ michael@0: nsIControllerCommand findCommandHandler(in string aCommandName); michael@0: michael@0: /** michael@0: * Get whether the named command is enabled. michael@0: * michael@0: * @param aCommandName the name of the command to test michael@0: * @param aCommandRefCon the command context data michael@0: */ michael@0: boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon); michael@0: michael@0: /** michael@0: * Tell the command to update its state (if it is a state updating command) michael@0: * michael@0: * @param aCommandName the name of the command to update michael@0: * @param aCommandRefCon the command context data michael@0: */ michael@0: void updateCommandState(in string aCommandName, in nsISupports aCommandRefCon); michael@0: michael@0: /** michael@0: * Get whether the named command is supported. michael@0: * michael@0: * @param aCommandName the name of the command to test michael@0: * @param aCommandRefCon the command context data michael@0: */ michael@0: boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon); michael@0: michael@0: /** michael@0: * Execute the named command. michael@0: * michael@0: * @param aCommandName the name of the command to execute michael@0: * @param aCommandRefCon the command context data michael@0: */ michael@0: void doCommand(in string aCommandName, in nsISupports aCommandRefCon); michael@0: michael@0: void doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon); michael@0: michael@0: void getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon); michael@0: }; michael@0: michael@0: michael@0: michael@0: %{C++ michael@0: // {670ee5da-6ad5-11d7-9950-000393636592} michael@0: #define NS_CONTROLLERCOMMANDTABLE_CID \ michael@0: {0x670ee5da, 0x6ad5, 0x11d7, \ michael@0: { 0x99, 0x50, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 }} michael@0: michael@0: #define NS_CONTROLLERCOMMANDTABLE_CONTRACTID \ michael@0: "@mozilla.org/embedcomp/controller-command-table;1" michael@0: %}