nsIControllerCommandTable.idl 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #include "nsISupports.idl"
  5. #include "nsIControllerCommand.idl"
  6. #include "nsICommandParams.idl"
  7. /**
  8. * nsIControllerCommandTable
  9. *
  10. * An interface via which a controller can maintain a series of commands,
  11. * and efficiently dispatch commands to their respective handlers.
  12. *
  13. * Controllers that use an nsIControllerCommandTable should support
  14. * nsIInterfaceRequestor, and be able to return an interface to their
  15. * controller command table via getInterface().
  16. *
  17. */
  18. [scriptable, uuid(c847f90e-b8f3-49db-a4df-8867831f2800)]
  19. interface nsIControllerCommandTable : nsISupports
  20. {
  21. /**
  22. * Make this command table immutable, so that commands cannot
  23. * be registered or unregistered. Some command tables are made
  24. * mutable after command registration so that they can be
  25. * used as singletons.
  26. */
  27. void makeImmutable();
  28. /**
  29. * Register and unregister commands with the command table.
  30. *
  31. * @param aCommandName the name of the command under which to register or
  32. * unregister the given command handler.
  33. *
  34. * @param aCommand the handler for this command.
  35. */
  36. void registerCommand(in string aCommandName, in nsIControllerCommand aCommand);
  37. void unregisterCommand(in string aCommandName, in nsIControllerCommand aCommand);
  38. /**
  39. * Find the command handler which has been registered to handle the named command.
  40. *
  41. * @param aCommandName the name of the command to find the handler for.
  42. */
  43. nsIControllerCommand findCommandHandler(in string aCommandName);
  44. /**
  45. * Get whether the named command is enabled.
  46. *
  47. * @param aCommandName the name of the command to test
  48. * @param aCommandRefCon the command context data
  49. */
  50. boolean isCommandEnabled(in string aCommandName, in nsISupports aCommandRefCon);
  51. /**
  52. * Tell the command to update its state (if it is a state updating command)
  53. *
  54. * @param aCommandName the name of the command to update
  55. * @param aCommandRefCon the command context data
  56. */
  57. void updateCommandState(in string aCommandName, in nsISupports aCommandRefCon);
  58. /**
  59. * Get whether the named command is supported.
  60. *
  61. * @param aCommandName the name of the command to test
  62. * @param aCommandRefCon the command context data
  63. */
  64. boolean supportsCommand(in string aCommandName, in nsISupports aCommandRefCon);
  65. /**
  66. * Execute the named command.
  67. *
  68. * @param aCommandName the name of the command to execute
  69. * @param aCommandRefCon the command context data
  70. */
  71. void doCommand(in string aCommandName, in nsISupports aCommandRefCon);
  72. void doCommandParams(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
  73. void getCommandState(in string aCommandName, in nsICommandParams aParam, in nsISupports aCommandRefCon);
  74. void getSupportedCommands(out unsigned long count,
  75. [array, size_is(count), retval] out string commands);
  76. };
  77. %{C++
  78. // {670ee5da-6ad5-11d7-9950-000393636592}
  79. #define NS_CONTROLLERCOMMANDTABLE_CID \
  80. {0x670ee5da, 0x6ad5, 0x11d7, \
  81. { 0x99, 0x50, 0x00, 0x03, 0x93, 0x63, 0x65, 0x92 }}
  82. #define NS_CONTROLLERCOMMANDTABLE_CONTRACTID \
  83. "@mozilla.org/embedcomp/controller-command-table;1"
  84. %}