editor/idl/nsIHTMLAbsPosEditor.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/idl/nsIHTMLAbsPosEditor.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,132 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +#include "domstubs.idl"
    1.11 +
    1.12 +[scriptable, uuid(91375f52-20e6-4757-9835-eb04fabe5498)]
    1.13 +
    1.14 +interface nsIHTMLAbsPosEditor : nsISupports
    1.15 +{
    1.16 +  /**
    1.17 +   * true if the selection container is absolutely positioned
    1.18 +   */
    1.19 +  readonly attribute boolean selectionContainerAbsolutelyPositioned;
    1.20 +
    1.21 +  /**
    1.22 +   * this contains the absolutely positioned element currently edited
    1.23 +   * or null
    1.24 +   */
    1.25 +  readonly attribute nsIDOMElement positionedElement;
    1.26 +
    1.27 +  /**
    1.28 +   * true if Absolute Positioning handling is enabled in the editor
    1.29 +   */
    1.30 +  attribute boolean absolutePositioningEnabled;
    1.31 +
    1.32 +
    1.33 +  /* Utility methods */
    1.34 +
    1.35 +  /**
    1.36 +   * true if Snap To Grid is enabled in the editor.
    1.37 +   */
    1.38 +  attribute boolean snapToGridEnabled;
    1.39 +
    1.40 +  /**
    1.41 +   * sets the grid size in pixels.
    1.42 +   * @param aSizeInPixels [IN] the size of the grid in pixels
    1.43 +   */
    1.44 +  attribute unsigned long gridSize;
    1.45 +
    1.46 +  /* Selection-based methods */
    1.47 +
    1.48 +  /**
    1.49 +   * returns the deepest absolutely positioned container of the selection
    1.50 +   * if it exists or null.
    1.51 +   */
    1.52 +  readonly attribute nsIDOMElement absolutelyPositionedSelectionContainer;
    1.53 +
    1.54 +  /**
    1.55 +   * extracts the selection from the normal flow of the document and
    1.56 +   * positions it.
    1.57 +   * @param aEnabled [IN] true to absolutely position the selection,
    1.58 +   *                      false to put it back in the normal flow
    1.59 +   */
    1.60 +  void absolutePositionSelection(in boolean aEnabled);
    1.61 +
    1.62 +  /**
    1.63 +   * adds aChange to the z-index of the currently positioned element.
    1.64 +   * @param aChange [IN] relative change to apply to current z-index
    1.65 +   */
    1.66 +  void relativeChangeZIndex(in long aChange);
    1.67 +
    1.68 +  /* Element-based methods */
    1.69 +
    1.70 +  /**
    1.71 +   * extracts an element from the normal flow of the document and
    1.72 +   * positions it, and puts it back in the normal flow.
    1.73 +   * @param aElement [IN] the element
    1.74 +   * @param aEnabled [IN] true to absolutely position the element,
    1.75 +   *                      false to put it back in the normal flow
    1.76 +   */
    1.77 +  void absolutelyPositionElement(in nsIDOMElement aElement,
    1.78 +                                 in boolean aEnabled);
    1.79 +
    1.80 +  /**
    1.81 +   * sets the position of an element; warning it does NOT check if the
    1.82 +   * element is already positioned or not and that's on purpose.
    1.83 +   * @param aElement [IN] the element
    1.84 +   * @param aX       [IN] the x position in pixels.
    1.85 +   * @param aY       [IN] the y position in pixels.
    1.86 +   */
    1.87 +  void setElementPosition(in nsIDOMElement aElement, in long aX, in long aY);
    1.88 +
    1.89 +  /**
    1.90 +   * returns the absolute z-index of a positioned element. Never returns 'auto'.
    1.91 +   * @return         the z-index of the element
    1.92 +   * @param aElement [IN] the element.
    1.93 +   */
    1.94 +  long getElementZIndex(in nsIDOMElement aElement);
    1.95 +
    1.96 +  /**
    1.97 +   * sets the z-index of an element.
    1.98 +   * @param aElement [IN] the element
    1.99 +   * @param aZorder  [IN] the z-index
   1.100 +   */
   1.101 +  void setElementZIndex(in nsIDOMElement aElement, in long aZorder);
   1.102 +
   1.103 +  /**
   1.104 +   * adds aChange to the z-index of an arbitrary element.
   1.105 +   * @return         the new z-index of the element
   1.106 +   * @param aElement [IN] the element
   1.107 +   * @param aChange  [IN] relative change to apply to current z-index of
   1.108 +   *                      the element
   1.109 +   */
   1.110 +  long relativeChangeElementZIndex(in nsIDOMElement aElement, in long aChange);
   1.111 +
   1.112 +  /* Other */
   1.113 +
   1.114 +  /**
   1.115 +   * shows a grabber attached to an arbitrary element. The grabber is an image
   1.116 +   * positioned on the left hand side of the top border of the element. Dragging
   1.117 +   * and dropping it allows to change the element's absolute position in the
   1.118 +   * document. See chrome://editor/content/images/grabber.gif
   1.119 +   * @param aElement [IN] the element
   1.120 +   */
   1.121 +  void showGrabberOnElement(in nsIDOMElement aElement);
   1.122 +
   1.123 +  /**
   1.124 +   * hide the grabber if it shown.
   1.125 +   */
   1.126 +  void hideGrabber();
   1.127 +
   1.128 +  /**
   1.129 +   * refreshes the grabber if it shown, possibly updating its position or
   1.130 +   * even hiding it.
   1.131 +   */
   1.132 +  void refreshGrabber();
   1.133 +
   1.134 +};
   1.135 +

mercurial