"Fossies" - the Fresh Open Source Software Archive

Member "firefox-69.0.1/dom/html/nsIMenuBuilder.idl" (17 Sep 2019, 2130 Bytes) of package /linux/www/firefox-69.0.1.source.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) IDL source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "nsIMenuBuilder.idl": 60.7.2_vs_68.0.

    1 /* -*- Mode: IDL; 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 
    8 webidl Element;
    9 
   10 /**
   11  * An interface used to construct native toolbar or context menus from <menu>
   12  */
   13 
   14 [scriptable, uuid(93F4A48F-D043-4F45-97FD-9771EA1AF976)]
   15 interface nsIMenuBuilder : nsISupports
   16 {
   17 
   18   /**
   19    * Create the top level menu or a submenu. The implementation should create
   20    * a new context for this menu, so all subsequent methods will add new items
   21    * to this newly created menu.
   22    */
   23   void openContainer(in AString aLabel);
   24 
   25   /**
   26    * Add a new menu item. All menu item details can be obtained from
   27    * the element. This method is not called for hidden elements or elements
   28    * with no or empty label. The icon should be loaded only if aCanLoadIcon
   29    * is true.
   30    */
   31   void addItemFor(in Element aElement,
   32                   in boolean aCanLoadIcon);
   33 
   34   /**
   35    * Create a new separator.
   36    */
   37   void addSeparator();
   38 
   39   /**
   40    * Remove last added separator.
   41    * Sometimes it's needed to remove last added separator, otherwise it's not
   42    * possible to implement the postprocessing in one pass.
   43    * See http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#building-menus-and-toolbars
   44    */
   45   void undoAddSeparator();
   46 
   47   /**
   48    * Set the context to the parent menu.
   49    */
   50   void closeContainer();
   51 
   52   /**
   53    * Returns a JSON string representing the menu hierarchy. For a context menu,
   54    * it will be of the form:
   55    *  {
   56    *    type: "menu",
   57    *    children: [
   58    *      {
   59    *        type: "menuitem",
   60    *        label: "label",
   61    *        icon: "image.png"
   62    *      },
   63    *      {
   64    *        type: "separator",
   65    *      },
   66    *    ];
   67    */
   68   AString toJSONString();
   69 
   70   /**
   71    * Invoke the action of the menuitem with assigned id aGeneratedItemId.
   72    *
   73    * @param aGeneratedItemId the menuitem id
   74    */
   75   void click(in AString aGeneratedItemId);
   76 };