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 * nsIControllerCommandTable
12 * An interface via which a controller can maintain a series of commands,
13 * and efficiently dispatch commands to their respective handlers.
15 * Controllers that use an nsIControllerCommandTable should support
16 * nsIInterfaceRequestor, and be able to return an interface to their
17 * controller command table via getInterface().
21 [scriptable
, uuid(c847f90e
-b8f3
-49db
-a4df
-8867831f2800
)]
22 interface nsIControllerCommandTable
: nsISupports
25 * Make this command table immutable, so that commands cannot
26 * be registered or unregistered. Some command tables are made
27 * mutable after command registration so that they can be
33 * Register and unregister commands with the command table.
35 * @param aCommandName the name of the command under which to register or
36 * unregister the given command handler.
38 * @param aCommand the handler for this command.
40 void registerCommand
(in string aCommandName
, in nsIControllerCommand aCommand
);
41 void unregisterCommand
(in string aCommandName
, in nsIControllerCommand aCommand
);
44 * Find the command handler which has been registered to handle the named command.
46 * @param aCommandName the name of the command to find the handler for.
48 nsIControllerCommand findCommandHandler
(in string aCommandName
);
51 * Get whether the named command is enabled.
53 * @param aCommandName the name of the command to test
54 * @param aCommandRefCon the command context data
56 boolean isCommandEnabled
(in string aCommandName
, in nsISupports aCommandRefCon
);
59 * Tell the command to update its state (if it is a state updating command)
61 * @param aCommandName the name of the command to update
62 * @param aCommandRefCon the command context data
64 void updateCommandState
(in string aCommandName
, in nsISupports aCommandRefCon
);
67 * Get whether the named command is supported.
69 * @param aCommandName the name of the command to test
70 * @param aCommandRefCon the command context data
72 boolean supportsCommand
(in string aCommandName
, in nsISupports aCommandRefCon
);
75 * Execute the named command.
77 * @param aCommandName the name of the command to execute
78 * @param aCommandRefCon the command context data
80 void doCommand
(in string aCommandName
, in nsISupports aCommandRefCon
);
82 void doCommandParams
(in string aCommandName
, in nsICommandParams aParam
, in nsISupports aCommandRefCon
);
84 void getCommandState
(in string aCommandName
, in nsICommandParams aParam
, in nsISupports aCommandRefCon
);
86 void getSupportedCommands
(out unsigned long count
,
87 [array
, size_is(count
), retval] out string commands
);
93 // {670ee5da-6ad5-11d7-9950-000393636592}
94 #define NS_CONTROLLERCOMMANDTABLE_CID \
95 {0x670ee5da, 0x6ad5, 0x11d7, \
96 { 0x99, 0x50, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 }}
98 #define NS_CONTROLLERCOMMANDTABLE_CONTRACTID \
99 "@mozilla.org/embedcomp/controller-command-table;1"