|
1 /* -*- Mode: C++; 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 #include "domstubs.idl" |
|
8 |
|
9 [scriptable, uuid(91375f52-20e6-4757-9835-eb04fabe5498)] |
|
10 |
|
11 interface nsIHTMLAbsPosEditor : nsISupports |
|
12 { |
|
13 /** |
|
14 * true if the selection container is absolutely positioned |
|
15 */ |
|
16 readonly attribute boolean selectionContainerAbsolutelyPositioned; |
|
17 |
|
18 /** |
|
19 * this contains the absolutely positioned element currently edited |
|
20 * or null |
|
21 */ |
|
22 readonly attribute nsIDOMElement positionedElement; |
|
23 |
|
24 /** |
|
25 * true if Absolute Positioning handling is enabled in the editor |
|
26 */ |
|
27 attribute boolean absolutePositioningEnabled; |
|
28 |
|
29 |
|
30 /* Utility methods */ |
|
31 |
|
32 /** |
|
33 * true if Snap To Grid is enabled in the editor. |
|
34 */ |
|
35 attribute boolean snapToGridEnabled; |
|
36 |
|
37 /** |
|
38 * sets the grid size in pixels. |
|
39 * @param aSizeInPixels [IN] the size of the grid in pixels |
|
40 */ |
|
41 attribute unsigned long gridSize; |
|
42 |
|
43 /* Selection-based methods */ |
|
44 |
|
45 /** |
|
46 * returns the deepest absolutely positioned container of the selection |
|
47 * if it exists or null. |
|
48 */ |
|
49 readonly attribute nsIDOMElement absolutelyPositionedSelectionContainer; |
|
50 |
|
51 /** |
|
52 * extracts the selection from the normal flow of the document and |
|
53 * positions it. |
|
54 * @param aEnabled [IN] true to absolutely position the selection, |
|
55 * false to put it back in the normal flow |
|
56 */ |
|
57 void absolutePositionSelection(in boolean aEnabled); |
|
58 |
|
59 /** |
|
60 * adds aChange to the z-index of the currently positioned element. |
|
61 * @param aChange [IN] relative change to apply to current z-index |
|
62 */ |
|
63 void relativeChangeZIndex(in long aChange); |
|
64 |
|
65 /* Element-based methods */ |
|
66 |
|
67 /** |
|
68 * extracts an element from the normal flow of the document and |
|
69 * positions it, and puts it back in the normal flow. |
|
70 * @param aElement [IN] the element |
|
71 * @param aEnabled [IN] true to absolutely position the element, |
|
72 * false to put it back in the normal flow |
|
73 */ |
|
74 void absolutelyPositionElement(in nsIDOMElement aElement, |
|
75 in boolean aEnabled); |
|
76 |
|
77 /** |
|
78 * sets the position of an element; warning it does NOT check if the |
|
79 * element is already positioned or not and that's on purpose. |
|
80 * @param aElement [IN] the element |
|
81 * @param aX [IN] the x position in pixels. |
|
82 * @param aY [IN] the y position in pixels. |
|
83 */ |
|
84 void setElementPosition(in nsIDOMElement aElement, in long aX, in long aY); |
|
85 |
|
86 /** |
|
87 * returns the absolute z-index of a positioned element. Never returns 'auto'. |
|
88 * @return the z-index of the element |
|
89 * @param aElement [IN] the element. |
|
90 */ |
|
91 long getElementZIndex(in nsIDOMElement aElement); |
|
92 |
|
93 /** |
|
94 * sets the z-index of an element. |
|
95 * @param aElement [IN] the element |
|
96 * @param aZorder [IN] the z-index |
|
97 */ |
|
98 void setElementZIndex(in nsIDOMElement aElement, in long aZorder); |
|
99 |
|
100 /** |
|
101 * adds aChange to the z-index of an arbitrary element. |
|
102 * @return the new z-index of the element |
|
103 * @param aElement [IN] the element |
|
104 * @param aChange [IN] relative change to apply to current z-index of |
|
105 * the element |
|
106 */ |
|
107 long relativeChangeElementZIndex(in nsIDOMElement aElement, in long aChange); |
|
108 |
|
109 /* Other */ |
|
110 |
|
111 /** |
|
112 * shows a grabber attached to an arbitrary element. The grabber is an image |
|
113 * positioned on the left hand side of the top border of the element. Dragging |
|
114 * and dropping it allows to change the element's absolute position in the |
|
115 * document. See chrome://editor/content/images/grabber.gif |
|
116 * @param aElement [IN] the element |
|
117 */ |
|
118 void showGrabberOnElement(in nsIDOMElement aElement); |
|
119 |
|
120 /** |
|
121 * hide the grabber if it shown. |
|
122 */ |
|
123 void hideGrabber(); |
|
124 |
|
125 /** |
|
126 * refreshes the grabber if it shown, possibly updating its position or |
|
127 * even hiding it. |
|
128 */ |
|
129 void refreshGrabber(); |
|
130 |
|
131 }; |
|
132 |