AbsoluteLayout.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * AbsoluteLayout.js
  3. *
  4. * Copyright, Moxiecode Systems AB
  5. * Released under LGPL License.
  6. *
  7. * License: http://www.tinymce.com/license
  8. * Contributing: http://www.tinymce.com/contributing
  9. */
  10. /**
  11. * LayoutManager for absolute positioning. This layout manager is more of
  12. * a base class for other layouts but can be created and used directly.
  13. *
  14. * @-x-less AbsoluteLayout.less
  15. * @class tinymce.ui.AbsoluteLayout
  16. * @extends tinymce.ui.Layout
  17. */
  18. define("tinymce/ui/AbsoluteLayout", [
  19. "tinymce/ui/Layout"
  20. ], function(Layout) {
  21. "use strict";
  22. return Layout.extend({
  23. Defaults: {
  24. containerClass: 'abs-layout',
  25. controlClass: 'abs-layout-item'
  26. },
  27. /**
  28. * Recalculates the positions of the controls in the specified container.
  29. *
  30. * @method recalc
  31. * @param {tinymce.ui.Container} container Container instance to recalc.
  32. */
  33. recalc: function(container) {
  34. container.items().filter(':visible').each(function(ctrl) {
  35. var settings = ctrl.settings;
  36. ctrl.layoutRect({
  37. x: settings.x,
  38. y: settings.y,
  39. w: settings.w,
  40. h: settings.h
  41. });
  42. if (ctrl.recalc) {
  43. ctrl.recalc();
  44. }
  45. });
  46. },
  47. /**
  48. * Renders the specified container and any layout specific HTML.
  49. *
  50. * @method renderHtml
  51. * @param {tinymce.ui.Container} container Container to render HTML for.
  52. */
  53. renderHtml: function(container) {
  54. return '<div id="' + container._id + '-absend" class="' + container.classPrefix + 'abs-end"></div>' + this._super(container);
  55. }
  56. });
  57. });