@qooxdoo/framework
Version:
The JS Framework for Coders
119 lines (98 loc) • 2.86 kB
JavaScript
/* ************************************************************************
qooxdoo - the new era of web development
http://qooxdoo.org
Copyright:
2004-2008 1&1 Internet AG, Germany, http://www.1und1.de
License:
MIT: https://opensource.org/licenses/MIT
See the LICENSE file in the project's top-level directory for details.
Authors:
* Sebastian Werner (wpbasti)
* Jonathan Weiß (jonathan_rass)
************************************************************************ */
/**
* The splitter is the element between the two panes.
*
* @internal
*
* @childControl knob {qx.ui.basic.Image} knob to resize the splitpane
*/
qx.Class.define("qx.ui.splitpane.Splitter", {
extend: qx.ui.core.Widget,
/*
*****************************************************************************
CONSTRUCTOR
*****************************************************************************
*/
/**
* @param parentWidget {qx.ui.splitpane.Pane} The underlaying split pane.
*/
construct(parentWidget) {
super();
// set layout
if (parentWidget.getOrientation() == "vertical") {
this._setLayout(new qx.ui.layout.HBox(0, "center"));
this._getLayout().setAlignY("middle");
} else {
this._setLayout(new qx.ui.layout.VBox(0, "middle"));
this._getLayout().setAlignX("center");
}
// create knob child control
if (this.isKnobVisible()) {
this._createChildControl("knob");
}
},
/*
*****************************************************************************
PROPERTIES
*****************************************************************************
*/
properties: {
// overridden
allowShrinkX: {
refine: true,
init: false
},
// overridden
allowShrinkY: {
refine: true,
init: false
},
/**
* The visibility of the splitter button.
* Allows to remove the splitter button in favor of other visual separation
* means like background color differences.
*/
knobVisible: {
check: "Boolean",
init: true,
themeable: true,
apply: "_applyKnobVisible"
}
},
/*
*****************************************************************************
MEMBERS
*****************************************************************************
*/
members: {
// overridden
_createChildControlImpl(id, hash) {
var control;
switch (id) {
// Create splitter knob
case "knob":
control = new qx.ui.basic.Image();
this._add(control);
break;
}
return control || super._createChildControlImpl(id);
},
// property apply
_applyKnobVisible(value, old) {
this.getChildControl("knob").setVisibility(
value ? "visible" : "excluded"
);
}
}
});