From 318e2e95b2ad13592787f137197a9669bd77d6b4 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 5 Sep 2011 14:42:37 +0200 Subject: [PATCH] document Ox.SplitPanel properties --- source/Ox.UI/js/Panel/Ox.SplitPanel.js | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/source/Ox.UI/js/Panel/Ox.SplitPanel.js b/source/Ox.UI/js/Panel/Ox.SplitPanel.js index 03c10899..d317170e 100644 --- a/source/Ox.UI/js/Panel/Ox.SplitPanel.js +++ b/source/Ox.UI/js/Panel/Ox.SplitPanel.js @@ -155,11 +155,22 @@ Ox.SplitPanel = function(options, self) { }); } + /*@ + isCollapsed panel collapsed state + (id) -> id or position of panel, returns collapsed state + id id or position of element + @*/ that.isCollapsed = function(id) { var pos = Ox.isNumber(id) ? id : getPositionById(id); return self.options.elements[pos].collapsed; }; + /*@ + repleaseElement replace panel element + (id, element) -> replace element + id id or position of element + element new element + @*/ that.replaceElement = function(id, element) { // one can pass pos instead of id var pos = Ox.isNumber(id) ? id : getPositionById(id); @@ -180,6 +191,11 @@ Ox.SplitPanel = function(options, self) { return that; }; + /*@ + repleaseElements replace panel elements + (elements) -> replace elements + elements array of new elements + @*/ that.replaceElements = function(elements) { elements.forEach(function(element, i) { if (Ox.isNumber(element.size)) { @@ -206,6 +222,13 @@ Ox.SplitPanel = function(options, self) { return that; }; + /*@ + size get or set size + (id) -> get size + (id, size) -> set size + id id or position of panel + size size to set + @*/ that.size = function(id, size) { // one can pass pos instead of id var pos = Ox.isNumber(id) ? id : getPositionById(id), @@ -218,12 +241,23 @@ Ox.SplitPanel = function(options, self) { return that; } }; + + /*@ + getSize get size of panel + (id) -> id or position of panel, returns size + id id or position of panel + @*/ that.getSize = function(id) { var pos = Ox.isNumber(id) ? id : getPositionById(id), element = self.options.elements[pos]; return element.element[self.dimensions[0]]() * !that.isCollapsed(pos); }; + /*@ + toggle toggle collapsed state of a panel + (id) -> toggle panel + id id or position of panel + @*/ that.toggle = function(id) { // one can pass pos instead of id var pos = Ox.isNumber(id) ? id : getPositionById(id), @@ -246,6 +280,12 @@ Ox.SplitPanel = function(options, self) { }); }; + /*@ + updateSize update size of element + (pos, size) -> update size of element + pos position of element + size new size + @*/ that.updateSize = function(pos, size) { // this is called from resizebar pos = pos == 0 ? 0 : self.options.elements.length - 1; // fixme: silly that 0 or 1 is passed, and not pos