embedding/components/commandhandler/public/nsICommandManager.idl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2b634d8475cb
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "nsISupports.idl"
7 #include "nsIObserver.idl"
8 #include "nsICommandParams.idl"
9
10 interface nsIDOMWindow;
11
12 /*
13 * nsICommandManager is an interface used to executing user-level commands,
14 * and getting the state of available commands.
15 *
16 * Commands are identified by strings, which are documented elsewhere.
17 * In addition, the list of required and optional parameters for
18 * each command, that are passed in via the nsICommandParams, are
19 * also documented elsewhere. (Where? Need a good location for this).
20 */
21
22
23 [scriptable, uuid(080D2001-F91E-11D4-A73C-F9242928207C)]
24 interface nsICommandManager : nsISupports
25 {
26 /*
27 * Register an observer on the specified command. The observer's Observe
28 * method will get called when the state (enabled/disbaled, or toggled etc)
29 * of the command changes.
30 *
31 * You can register the same observer on multiple commmands by calling this
32 * multiple times.
33 */
34 void addCommandObserver(in nsIObserver aCommandObserver,
35 in string aCommandToObserve);
36
37 /*
38 * Stop an observer from observering the specified command. If the observer
39 * was also registered on ther commands, they will continue to be observed.
40 *
41 * Passing an empty string in 'aCommandObserved' will remove the observer
42 * from all commands.
43 */
44 void removeCommandObserver(in nsIObserver aCommandObserver,
45 in string aCommandObserved);
46
47 /*
48 * Ask the command manager if the specified command is supported.
49 * If aTargetWindow is null, the focused window is used.
50 *
51 */
52 boolean isCommandSupported(in string aCommandName,
53 in nsIDOMWindow aTargetWindow);
54
55 /*
56 * Ask the command manager if the specified command is currently.
57 * enabled.
58 * If aTargetWindow is null, the focused window is used.
59 */
60 boolean isCommandEnabled(in string aCommandName,
61 in nsIDOMWindow aTargetWindow);
62
63 /*
64 * Get the state of the specified commands.
65 *
66 * On input: aCommandParams filled in with values that the caller cares
67 * about, most of which are command-specific (see the command documentation
68 * for details). One boolean value, "enabled", applies to all commands,
69 * and, in return will be set to indicate whether the command is enabled
70 * (equivalent to calling isCommandEnabled).
71 *
72 * aCommandName is the name of the command that needs the state
73 * aTargetWindow is the source of command controller
74 * (null means use focus controller)
75 * On output: aCommandParams: values set by the caller filled in with
76 * state from the command.
77 */
78 void getCommandState(in string aCommandName,
79 in nsIDOMWindow aTargetWindow,
80 /* inout */ in nsICommandParams aCommandParams);
81
82 /*
83 * Execute the specified command.
84 * The command will be executed in aTargetWindow if it is specified.
85 * If aTargetWindow is null, it will go to the focused window.
86 *
87 * param: aCommandParams, a list of name-value pairs of command parameters,
88 * may be null for parameter-less commands.
89 *
90 */
91 void doCommand(in string aCommandName,
92 in nsICommandParams aCommandParams,
93 in nsIDOMWindow aTargetWindow);
94
95 };
96
97
98 /*
99
100 Arguments to observers "Observe" method are as follows:
101
102 void Observe( in nsISupports aSubject, // The nsICommandManager calling this Observer
103 in string aTopic, // Name of the command
104 in wstring aDummy ); // unused
105
106 */
107
108 // {64edb481-0c04-11d5-a73c-e964b968b0bc}
109 %{C++
110 #define NS_COMMAND_MANAGER_CID \
111 { 0x64edb481, 0x0c04, 0x11d5, { 0xa7, 0x3c, 0xe9, 0x64, 0xb9, 0x68, 0xb0, 0xbc } }
112
113 #define NS_COMMAND_MANAGER_CONTRACTID \
114 "@mozilla.org/embedcomp/command-manager;1"
115 %}
116
117
118

mercurial