embedding/components/commandhandler/public/nsIControllerCommandTable.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/embedding/components/commandhandler/public/nsIControllerCommandTable.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,97 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsISupports.idl"
     1.9 +#include "nsIControllerCommand.idl"
    1.10 +#include "nsICommandParams.idl"
    1.11 +
    1.12 +/**
    1.13 + * nsIControllerCommandTable
    1.14 + * 
    1.15 + * An interface via which a controller can maintain a series of commands,
    1.16 + * and efficiently dispatch commands to their respective handlers.
    1.17 + *
    1.18 + * Controllers that use an nsIControllerCommandTable should support
    1.19 + * nsIInterfaceRequestor, and be able to return an interface to their
    1.20 + * controller command table via getInterface().
    1.21 + * 
    1.22 + */
    1.23 +
    1.24 +[scriptable, uuid(d1a47834-6ad4-11d7-bfad-000393636592)]
    1.25 +interface nsIControllerCommandTable : nsISupports
    1.26 +{
    1.27 +  /**
    1.28 +   * Make this command table immutable, so that commands cannot
    1.29 +   * be registered or unregistered. Some command tables are made
    1.30 +   * mutable after command registration so that they can be 
    1.31 +   * used as singletons.
    1.32 +   */
    1.33 +  void  makeImmutable();
    1.34 +  
    1.35 +  /**
    1.36 +   * Register and unregister commands with the command table.
    1.37 +   *
    1.38 +   * @param aCommandName  the name of the command under which to register or
    1.39 +   *                      unregister the given command handler.
    1.40 +   *
    1.41 +   * @param aCommand      the handler for this command.
    1.42 +   */
    1.43 +  void    registerCommand(in string aCommandName, in nsIControllerCommand aCommand);
    1.44 +  void    unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand);
    1.45 +  
    1.46 +  /**
    1.47 +   * Find the command handler which has been registered to handle the named command.
    1.48 +   *
    1.49 +   * @param aCommandName  the name of the command to find the handler for.
    1.50 +   */
    1.51 +  nsIControllerCommand findCommandHandler(in string aCommandName);
    1.52 +
    1.53 +  /**
    1.54 +   * Get whether the named command is enabled.
    1.55 +   *
    1.56 +   * @param aCommandName    the name of the command to test
    1.57 +   * @param aCommandRefCon  the command context data
    1.58 +   */
    1.59 +	boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon);
    1.60 +
    1.61 +  /**
    1.62 +   * Tell the command to update its state (if it is a state updating command)
    1.63 +   *
    1.64 +   * @param aCommandName    the name of the command to update
    1.65 +   * @param aCommandRefCon  the command context data
    1.66 +   */
    1.67 +	void  updateCommandState(in string aCommandName, in nsISupports aCommandRefCon);
    1.68 +
    1.69 +  /**
    1.70 +   * Get whether the named command is supported.
    1.71 +   *
    1.72 +   * @param aCommandName    the name of the command to test
    1.73 +   * @param aCommandRefCon  the command context data
    1.74 +   */
    1.75 +	boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon);
    1.76 +
    1.77 +  /**
    1.78 +   * Execute the named command.
    1.79 +   *
    1.80 +   * @param aCommandName    the name of the command to execute
    1.81 +   * @param aCommandRefCon  the command context data
    1.82 +   */
    1.83 +	void    doCommand(in string aCommandName, in nsISupports aCommandRefCon);
    1.84 +
    1.85 +	void    doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
    1.86 +
    1.87 +	void    getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
    1.88 +};
    1.89 +
    1.90 +
    1.91 +
    1.92 +%{C++
    1.93 +// {670ee5da-6ad5-11d7-9950-000393636592}
    1.94 +#define NS_CONTROLLERCOMMANDTABLE_CID \
    1.95 +  {0x670ee5da, 0x6ad5, 0x11d7, \
    1.96 +    { 0x99, 0x50, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 }}
    1.97 +
    1.98 +#define NS_CONTROLLERCOMMANDTABLE_CONTRACTID \
    1.99 + "@mozilla.org/embedcomp/controller-command-table;1"
   1.100 +%}

mercurial