|
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/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 #include "nsIControllerCommand.idl" |
|
7 #include "nsICommandParams.idl" |
|
8 |
|
9 /** |
|
10 * nsIControllerCommandTable |
|
11 * |
|
12 * An interface via which a controller can maintain a series of commands, |
|
13 * and efficiently dispatch commands to their respective handlers. |
|
14 * |
|
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(). |
|
18 * |
|
19 */ |
|
20 |
|
21 [scriptable, uuid(d1a47834-6ad4-11d7-bfad-000393636592)] |
|
22 interface nsIControllerCommandTable : nsISupports |
|
23 { |
|
24 /** |
|
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 |
|
28 * used as singletons. |
|
29 */ |
|
30 void makeImmutable(); |
|
31 |
|
32 /** |
|
33 * Register and unregister commands with the command table. |
|
34 * |
|
35 * @param aCommandName the name of the command under which to register or |
|
36 * unregister the given command handler. |
|
37 * |
|
38 * @param aCommand the handler for this command. |
|
39 */ |
|
40 void registerCommand(in string aCommandName, in nsIControllerCommand aCommand); |
|
41 void unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand); |
|
42 |
|
43 /** |
|
44 * Find the command handler which has been registered to handle the named command. |
|
45 * |
|
46 * @param aCommandName the name of the command to find the handler for. |
|
47 */ |
|
48 nsIControllerCommand findCommandHandler(in string aCommandName); |
|
49 |
|
50 /** |
|
51 * Get whether the named command is enabled. |
|
52 * |
|
53 * @param aCommandName the name of the command to test |
|
54 * @param aCommandRefCon the command context data |
|
55 */ |
|
56 boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon); |
|
57 |
|
58 /** |
|
59 * Tell the command to update its state (if it is a state updating command) |
|
60 * |
|
61 * @param aCommandName the name of the command to update |
|
62 * @param aCommandRefCon the command context data |
|
63 */ |
|
64 void updateCommandState(in string aCommandName, in nsISupports aCommandRefCon); |
|
65 |
|
66 /** |
|
67 * Get whether the named command is supported. |
|
68 * |
|
69 * @param aCommandName the name of the command to test |
|
70 * @param aCommandRefCon the command context data |
|
71 */ |
|
72 boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon); |
|
73 |
|
74 /** |
|
75 * Execute the named command. |
|
76 * |
|
77 * @param aCommandName the name of the command to execute |
|
78 * @param aCommandRefCon the command context data |
|
79 */ |
|
80 void doCommand(in string aCommandName, in nsISupports aCommandRefCon); |
|
81 |
|
82 void doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon); |
|
83 |
|
84 void getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon); |
|
85 }; |
|
86 |
|
87 |
|
88 |
|
89 %{C++ |
|
90 // {670ee5da-6ad5-11d7-9950-000393636592} |
|
91 #define NS_CONTROLLERCOMMANDTABLE_CID \ |
|
92 {0x670ee5da, 0x6ad5, 0x11d7, \ |
|
93 { 0x99, 0x50, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 }} |
|
94 |
|
95 #define NS_CONTROLLERCOMMANDTABLE_CONTRACTID \ |
|
96 "@mozilla.org/embedcomp/controller-command-table;1" |
|
97 %} |