splitpanel rewrite

This commit is contained in:
rolux 2011-03-03 22:26:17 +01:00
parent 543072280b
commit 1e4a83a7c9
4 changed files with 42 additions and 30 deletions

View file

@ -25,7 +25,7 @@ Bars
background: -moz-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192)); background: -moz-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192))); background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192)));
} }
.OxThemeClassic .OxResizebar > .OxLine { .OxThemeClassic .OxSeparator > .OxLine {
background: rgb(208, 208, 208); background: rgb(208, 208, 208);
} }

View file

@ -1229,18 +1229,6 @@ Panels
} }
.OxSplitPanel { .OxSplitPanel {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
}
.OxSplitPanel > div {
position: absolute;
}
.OxSplitPanel2 {
display: box; display: box;
display: -moz-box; display: -moz-box;
display: -webkit-box; display: -webkit-box;
@ -1249,52 +1237,52 @@ Panels
-mox-box-flex: 0; -mox-box-flex: 0;
-webkit-box-flex: 0; -webkit-box-flex: 0;
} }
.OxSplitPanel2.OxHorizontal { .OxSplitPanel.OxHorizontal {
box-orient: horizontal; box-orient: horizontal;
-moz-box-orient: horizontal; -moz-box-orient: horizontal;
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
} }
.OxSplitPanel2.OxVertical { .OxSplitPanel.OxVertical {
box-orient: vertical; box-orient: vertical;
-moz-box-orient: vertical; -moz-box-orient: vertical;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.OxSplitPanel2 > * { .OxSplitPanel > * {
box-flex: 0; box-flex: 0;
-mox-box-flex: 0; -mox-box-flex: 0;
-webkit-box-flex: 0; -webkit-box-flex: 0;
} }
.OxSplitPanel2 > .OxSeparator { .OxSplitPanel > .OxSeparator {
display: -webkit-box; display: -webkit-box;
position: relative; position: relative;
z-index: 2; z-index: 2;
} }
.OxSplitPanel2 > .OxSeparator > * { .OxSplitPanel > .OxSeparator > * {
-webkit-box-flex: 0; -webkit-box-flex: 0;
} }
.OxSplitPanel2 > .OxSeparator > .OxLine { .OxSplitPanel > .OxSeparator > .OxLine {
background-color: black; background-color: black;
} }
.OxSplitPanel2.OxHorizontal > .OxSeparator { .OxSplitPanel.OxHorizontal > .OxSeparator {
width: 5px; width: 5px;
margin: 0 -2px 0 -2px; margin: 0 -2px 0 -2px;
cursor: ew-resize; cursor: ew-resize;
} }
.OxSplitPanel2.OxHorizontal > .OxSeparator > .OxLine { .OxSplitPanel.OxHorizontal > .OxSeparator > .OxLine {
width: 1px; width: 1px;
} }
.OxSplitPanel2.OxHorizontal > .OxSeparator > .OxSpace { .OxSplitPanel.OxHorizontal > .OxSeparator > .OxSpace {
width: 2px; width: 2px;
} }
.OxSplitPanel2.OxVertical > .OxSeparator { .OxSplitPanel.OxVertical > .OxSeparator {
height: 5px; height: 5px;
margin: -2px 0 -2px 0; margin: -2px 0 -2px 0;
cursor: ns-resize; cursor: ns-resize;
} }
.OxSplitPanel2.OxVertical > .OxSeparator > .OxLine { .OxSplitPanel.OxVertical > .OxSeparator > .OxLine {
height: 1px; height: 1px;
} }
.OxSplitPanel2.OxVertical > .OxSeparator > .OxSpace { .OxSplitPanel.OxVertical > .OxSeparator > .OxSpace {
height: 2px; height: 2px;
} }
/* /*

View file

@ -27,7 +27,7 @@ Bars
background: -webkit-gradient(linear, left top, left bottom, from(rgb(64, 64, 64)), to(rgb(32, 32, 32))); background: -webkit-gradient(linear, left top, left bottom, from(rgb(64, 64, 64)), to(rgb(32, 32, 32)));
} }
.OxThemeModern .OxResizebar > .OxLine { .OxThemeModern .OxSeparator > .OxLine {
background: rgb(48, 48, 48); background: rgb(48, 48, 48);
} }

View file

@ -11170,7 +11170,7 @@ requires
return that; return that;
}; };
Ox.SplitPanel2 = function(options, self) { Ox.SplitPanel = function(options, self) {
var self = self || {}, var self = self || {},
that = new Ox.Element('div', self) that = new Ox.Element('div', self)
@ -11180,7 +11180,7 @@ requires
}) })
.options(options) .options(options)
.addClass( .addClass(
'OxSplitPanel2 Ox' + Ox.toTitleCase(self.options.orientation) 'OxSplitPanel Ox' + Ox.toTitleCase(self.options.orientation)
); );
Ox.extend(self, { Ox.extend(self, {
@ -11318,13 +11318,16 @@ requires
function setPercent(pos) { function setPercent(pos) {
var element = self.options.elements[pos], var element = self.options.elements[pos],
flex = element.size.replace('%', ''), flex = (
element.size == 'auto' ? self.autoPercent : element.size
).replace('%', ''),
css = { css = {
boxFlex: flex, boxFlex: flex,
MozBoxFlex: flex, MozBoxFlex: flex,
WebkitBoxFlex: flex WebkitBoxFlex: flex
}; };
css[self.dimensions[0]] = ''; css[self.dimensions[0]] = '';
Ox.print('setPercent', css)
element.element.css(css); element.element.css(css);
} }
@ -11349,6 +11352,27 @@ requires
}); });
} }
that.replaceElement = function(pos, element) {
var $element = self.options.elements[pos].element;
$element.replaceWith(self.options.elements[pos].element = element);
if (Ox.isNumber(self.options.elements[pos].size)) {
setPixels(pos);
} else {
setPercent(pos);
}
return that;
};
that.resizeElement = function(pos, size) {
var element = self.options.elements[pos];
element.size = size;
if (Ox.isNumber(element.size)) {
setPixels(pos);
} else {
setPercent(pos);
}
}
that.toggle = function(pos) { that.toggle = function(pos) {
var css = {}, var css = {},
element = self.options.elements[pos], element = self.options.elements[pos],
@ -11395,7 +11419,7 @@ requires
resize resize
toggle toggle
*/ */
Ox.SplitPanel = function(options, self) { Ox._SplitPanel = function(options, self) {
var self = self || {}, var self = self || {},
that = new Ox.Element({}, self) // fixme: Container that = new Ox.Element({}, self) // fixme: Container
.defaults({ .defaults({