PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/embedding/components/commandhandler/public/nsICommandManager.idl

http://github.com/zpao/v8monkey
IDL | 152 lines | 28 code | 18 blank | 106 comment | 0 complexity | 15996aabbbb4e6e32c353f3b669e3ee3 MD5 | raw file
  1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  5 * The contents of this file are subject to the Mozilla Public License Version
  6 * 1.1 (the "License"); you may not use this file except in compliance with
  7 * the License. You may obtain a copy of the License at
  8 * http://www.mozilla.org/MPL/
  9 *
 10 * Software distributed under the License is distributed on an "AS IS" basis,
 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12 * for the specific language governing rights and limitations under the
 13 * License.
 14 *
 15 * The Original Code is mozilla.org code.
 16 *
 17 * The Initial Developer of the Original Code is
 18 * Netscape Communications Corporation.
 19 * Portions created by the Initial Developer are Copyright (C) 1998
 20 * the Initial Developer. All Rights Reserved.
 21 *
 22 * Contributor(s):
 23 *   Simon Fraser <sfraser@netscape.com>
 24 *   Kathleen Brade <brade@netscape.com>
 25 *
 26 * Alternatively, the contents of this file may be used under the terms of
 27 * either the GNU General Public License Version 2 or later (the "GPL"), or
 28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 29 * in which case the provisions of the GPL or the LGPL are applicable instead
 30 * of those above. If you wish to allow use of your version of this file only
 31 * under the terms of either the GPL or the LGPL, and not to allow others to
 32 * use your version of this file under the terms of the MPL, indicate your
 33 * decision by deleting the provisions above and replace them with the notice
 34 * and other provisions required by the GPL or the LGPL. If you do not delete
 35 * the provisions above, a recipient may use your version of this file under
 36 * the terms of any one of the MPL, the GPL or the LGPL.
 37 *
 38 * ***** END LICENSE BLOCK ***** */
 39
 40#include "nsISupports.idl"
 41#include "nsIObserver.idl"
 42#include "nsICommandParams.idl"
 43
 44interface nsIDOMWindow;
 45
 46/*
 47 * nsICommandManager is an interface used to executing user-level commands,
 48 * and getting the state of available commands.
 49 *
 50 * Commands are identified by strings, which are documented elsewhere.
 51 * In addition, the list of required and optional parameters for
 52 * each command, that are passed in via the nsICommandParams, are
 53 * also documented elsewhere. (Where? Need a good location for this).
 54 */
 55 
 56 
 57[scriptable, uuid(080D2001-F91E-11D4-A73C-F9242928207C)]
 58interface nsICommandManager : nsISupports
 59{
 60  /*
 61   * Register an observer on the specified command. The observer's Observe
 62   * method will get called when the state (enabled/disbaled, or toggled etc)
 63   * of the command changes.
 64   *
 65   * You can register the same observer on multiple commmands by calling this
 66   * multiple times.
 67   */
 68  void        addCommandObserver(in nsIObserver aCommandObserver,
 69                                 in string aCommandToObserve);
 70
 71  /*
 72   * Stop an observer from observering the specified command. If the observer
 73   * was also registered on ther commands, they will continue to be observed.
 74   *
 75   * Passing an empty string in 'aCommandObserved' will remove the observer
 76   * from all commands.
 77   */
 78  void        removeCommandObserver(in nsIObserver aCommandObserver,
 79                                    in string aCommandObserved);
 80
 81  /*
 82   * Ask the command manager if the specified command is supported.
 83   * If aTargetWindow is null, the focused window is used.
 84   *
 85   */
 86  boolean     isCommandSupported(in string aCommandName,
 87                                 in nsIDOMWindow aTargetWindow);
 88
 89  /*
 90   * Ask the command manager if the specified command is currently.
 91   * enabled.
 92   * If aTargetWindow is null, the focused window is used.
 93   */
 94  boolean     isCommandEnabled(in string aCommandName,
 95                               in nsIDOMWindow aTargetWindow);
 96
 97  /*
 98   * Get the state of the specified commands.
 99   *
100   * On input: aCommandParams filled in with values that the caller cares
101   * about, most of which are command-specific (see the command documentation
102   * for details). One boolean value, "enabled", applies to all commands,
103   * and, in return will be set to indicate whether the command is enabled
104   * (equivalent to calling isCommandEnabled).
105   *
106   * aCommandName is the name of the command that needs the state
107   * aTargetWindow is the source of command controller 
108   *      (null means use focus controller)
109   * On output: aCommandParams: values set by the caller filled in with
110   * state from the command.
111   */
112  void        getCommandState(in string aCommandName,
113                              in nsIDOMWindow aTargetWindow,
114                  /* inout */ in nsICommandParams aCommandParams);
115    
116  /*
117   * Execute the specified command.
118   * The command will be executed in aTargetWindow if it is specified.
119   * If aTargetWindow is null, it will go to the focused window.
120   *
121   * param: aCommandParams, a list of name-value pairs of command parameters,
122   * may be null for parameter-less commands.
123   *
124   */
125  void        doCommand(in string aCommandName,
126                        in nsICommandParams aCommandParams,
127                        in nsIDOMWindow aTargetWindow);
128
129};
130
131
132/*
133
134Arguments to observers "Observe" method are as follows:
135
136  void Observe(   in nsISupports aSubject,          // The nsICommandManager calling this Observer
137                  in string      aTopic,            // Name of the command
138                  in wstring     aDummy );          // unused
139
140*/
141
142// {64edb481-0c04-11d5-a73c-e964b968b0bc}
143%{C++
144#define NS_COMMAND_MANAGER_CID \
145{ 0x64edb481, 0x0c04, 0x11d5, { 0xa7, 0x3c, 0xe9, 0x64, 0xb9, 0x68, 0xb0, 0xbc } }
146
147#define NS_COMMAND_MANAGER_CONTRACTID \
148 "@mozilla.org/embedcomp/command-manager;1"
149%}
150
151
152