1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include
"nsISupports.idl"
6 #include
"nsIControllerCommand.idl"
7 #include
"nsICommandParams.idl"
10 class nsControllerCommandTable
;
14 * nsIControllerCommandTable
16 * An interface via which a controller can maintain a series of commands,
17 * and efficiently dispatch commands to their respective handlers.
19 * Controllers that use an nsIControllerCommandTable should support
20 * nsIInterfaceRequestor, and be able to return an interface to their
21 * controller command table via getInterface().
25 [scriptable
, builtinclass
, uuid(c847f90e
-b8f3
-49db
-a4df
-8867831f2800
)]
26 interface nsIControllerCommandTable
: nsISupports
29 * Make this command table immutable, so that commands cannot
30 * be registered or unregistered. Some command tables are made
31 * mutable after command registration so that they can be
37 * Register and unregister commands with the command table.
39 * @param aCommandName the name of the command under which to register or
40 * unregister the given command handler.
42 * @param aCommand the handler for this command.
44 void registerCommand
(in string aCommandName
, in nsIControllerCommand aCommand
);
45 void unregisterCommand
(in string aCommandName
, in nsIControllerCommand aCommand
);
48 * Find the command handler which has been registered to handle the named command.
50 * @param aCommandName the name of the command to find the handler for.
52 nsIControllerCommand findCommandHandler
(in string aCommandName
);
55 * Get whether the named command is enabled.
57 * @param aCommandName the name of the command to test
58 * @param aCommandRefCon the command context data
60 boolean isCommandEnabled
(in string aCommandName
, in nsISupports aCommandRefCon
);
63 * Tell the command to update its state (if it is a state updating command)
65 * @param aCommandName the name of the command to update
66 * @param aCommandRefCon the command context data
68 void updateCommandState
(in string aCommandName
, in nsISupports aCommandRefCon
);
71 * Get whether the named command is supported.
73 * @param aCommandName the name of the command to test
74 * @param aCommandRefCon the command context data
76 boolean supportsCommand
(in string aCommandName
, in nsISupports aCommandRefCon
);
79 * Execute the named command.
81 * @param aCommandName the name of the command to execute
82 * @param aCommandRefCon the command context data
85 void doCommand
(in string aCommandName
, in nsISupports aCommandRefCon
);
88 void doCommandParams
(in string aCommandName
, in nsICommandParams aParam
, in nsISupports aCommandRefCon
);
90 void getCommandState
(in string aCommandName
, in nsICommandParams aParam
, in nsISupports aCommandRefCon
);
92 Array
<ACString
> getSupportedCommands
();
96 * In order to avoid circular dependency issues, these methods are defined
97 * in nsControllerCommandTable.h. Consumers need to #include that header.
99 inline nsControllerCommandTable
* AsControllerCommandTable
();
100 inline
const nsControllerCommandTable
* AsControllerCommandTable
() const;