nsIHTMLAbsPosEditor.idl 4.0 KB

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