michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "domstubs.idl" michael@0: michael@0: [scriptable, uuid(91375f52-20e6-4757-9835-eb04fabe5498)] michael@0: michael@0: interface nsIHTMLAbsPosEditor : nsISupports michael@0: { michael@0: /** michael@0: * true if the selection container is absolutely positioned michael@0: */ michael@0: readonly attribute boolean selectionContainerAbsolutelyPositioned; michael@0: michael@0: /** michael@0: * this contains the absolutely positioned element currently edited michael@0: * or null michael@0: */ michael@0: readonly attribute nsIDOMElement positionedElement; michael@0: michael@0: /** michael@0: * true if Absolute Positioning handling is enabled in the editor michael@0: */ michael@0: attribute boolean absolutePositioningEnabled; michael@0: michael@0: michael@0: /* Utility methods */ michael@0: michael@0: /** michael@0: * true if Snap To Grid is enabled in the editor. michael@0: */ michael@0: attribute boolean snapToGridEnabled; michael@0: michael@0: /** michael@0: * sets the grid size in pixels. michael@0: * @param aSizeInPixels [IN] the size of the grid in pixels michael@0: */ michael@0: attribute unsigned long gridSize; michael@0: michael@0: /* Selection-based methods */ michael@0: michael@0: /** michael@0: * returns the deepest absolutely positioned container of the selection michael@0: * if it exists or null. michael@0: */ michael@0: readonly attribute nsIDOMElement absolutelyPositionedSelectionContainer; michael@0: michael@0: /** michael@0: * extracts the selection from the normal flow of the document and michael@0: * positions it. michael@0: * @param aEnabled [IN] true to absolutely position the selection, michael@0: * false to put it back in the normal flow michael@0: */ michael@0: void absolutePositionSelection(in boolean aEnabled); michael@0: michael@0: /** michael@0: * adds aChange to the z-index of the currently positioned element. michael@0: * @param aChange [IN] relative change to apply to current z-index michael@0: */ michael@0: void relativeChangeZIndex(in long aChange); michael@0: michael@0: /* Element-based methods */ michael@0: michael@0: /** michael@0: * extracts an element from the normal flow of the document and michael@0: * positions it, and puts it back in the normal flow. michael@0: * @param aElement [IN] the element michael@0: * @param aEnabled [IN] true to absolutely position the element, michael@0: * false to put it back in the normal flow michael@0: */ michael@0: void absolutelyPositionElement(in nsIDOMElement aElement, michael@0: in boolean aEnabled); michael@0: michael@0: /** michael@0: * sets the position of an element; warning it does NOT check if the michael@0: * element is already positioned or not and that's on purpose. michael@0: * @param aElement [IN] the element michael@0: * @param aX [IN] the x position in pixels. michael@0: * @param aY [IN] the y position in pixels. michael@0: */ michael@0: void setElementPosition(in nsIDOMElement aElement, in long aX, in long aY); michael@0: michael@0: /** michael@0: * returns the absolute z-index of a positioned element. Never returns 'auto'. michael@0: * @return the z-index of the element michael@0: * @param aElement [IN] the element. michael@0: */ michael@0: long getElementZIndex(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * sets the z-index of an element. michael@0: * @param aElement [IN] the element michael@0: * @param aZorder [IN] the z-index michael@0: */ michael@0: void setElementZIndex(in nsIDOMElement aElement, in long aZorder); michael@0: michael@0: /** michael@0: * adds aChange to the z-index of an arbitrary element. michael@0: * @return the new z-index of the element michael@0: * @param aElement [IN] the element michael@0: * @param aChange [IN] relative change to apply to current z-index of michael@0: * the element michael@0: */ michael@0: long relativeChangeElementZIndex(in nsIDOMElement aElement, in long aChange); michael@0: michael@0: /* Other */ michael@0: michael@0: /** michael@0: * shows a grabber attached to an arbitrary element. The grabber is an image michael@0: * positioned on the left hand side of the top border of the element. Dragging michael@0: * and dropping it allows to change the element's absolute position in the michael@0: * document. See chrome://editor/content/images/grabber.gif michael@0: * @param aElement [IN] the element michael@0: */ michael@0: void showGrabberOnElement(in nsIDOMElement aElement); michael@0: michael@0: /** michael@0: * hide the grabber if it shown. michael@0: */ michael@0: void hideGrabber(); michael@0: michael@0: /** michael@0: * refreshes the grabber if it shown, possibly updating its position or michael@0: * even hiding it. michael@0: */ michael@0: void refreshGrabber(); michael@0: michael@0: }; michael@0: