UNPKG

@qooxdoo/framework

Version:

The JS Framework for Coders

182 lines (142 loc) 4.36 kB
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2009 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: * Fabian Jakobs (fjakobs) * Jonathan Weiß (jonathan_rass) ************************************************************************ */ /** * EXPERIMENTAL! * * The Scroller wraps a {@link Pane} and provides scroll bars to interactively * scroll the pane's content. * * @childControl pane {qx.ui.virtual.core.Pane} Virtual pane. */ qx.Class.define("qx.ui.virtual.core.Scroller", { extend : qx.ui.core.scroll.AbstractScrollArea, /** * @param rowCount {Integer?0} The number of rows of the virtual grid. * @param columnCount {Integer?0} The number of columns of the virtual grid. * @param cellHeight {Integer?10} The default cell height. * @param cellWidth {Integer?10} The default cell width. */ construct : function(rowCount, columnCount, cellHeight, cellWidth) { this.base(arguments); this.__pane = new qx.ui.virtual.core.Pane(rowCount, columnCount, cellHeight, cellWidth); this.__pane.addListener("update", this._computeScrollbars, this); this.__pane.addListener("scrollX", this._onScrollPaneX, this); this.__pane.addListener("scrollY", this._onScrollPaneY, this); if (qx.core.Environment.get("os.scrollBarOverlayed")) { this._add(this.__pane, {edge: 0}); } else { this._add(this.__pane, {row: 0, column: 0}); } }, members : { /** @type {qx.ui.virtual.core.Pane} Virtual pane. */ __pane : null, /* --------------------------------------------------------------------------- ACCESSOR METHODS --------------------------------------------------------------------------- */ /** * Get the scroller's virtual pane. * * @return {qx.ui.virtual.core.Pane} The scroller's pane. */ getPane : function() { return this.__pane; }, /* --------------------------------------------------------------------------- CHILD CONTROL SUPPORT --------------------------------------------------------------------------- */ // overridden _createChildControlImpl : function(id, hash) { if (id === "pane") { return this.__pane; } else { return this.base(arguments, id); } }, /* --------------------------------------------------------------------------- ITEM LOCATION SUPPORT --------------------------------------------------------------------------- */ /** * NOT IMPLEMENTED * * @param item {qx.ui.core.Widget} Item to query. * @return {Integer} Top offset. * @abstract */ getItemTop : function(item) { throw new Error("The method 'getItemTop' is not implemented!"); }, /** * NOT IMPLEMENTED * * @param item {qx.ui.core.Widget} Item to query. * @return {Integer} Top offset. * @abstract */ getItemBottom : function(item) { throw new Error("The method 'getItemBottom' is not implemented!"); }, /** * NOT IMPLEMENTED * * @param item {qx.ui.core.Widget} Item to query. * @return {Integer} Top offset. * @abstract */ getItemLeft : function(item) { throw new Error("The method 'getItemLeft' is not implemented!"); }, /** * NOT IMPLEMENTED * * @param item {qx.ui.core.Widget} Item to query. * @return {Integer} Right offset. * @abstract */ getItemRight : function(item) { throw new Error("The method 'getItemRight' is not implemented!"); }, /* --------------------------------------------------------------------------- EVENT LISTENERS --------------------------------------------------------------------------- */ // overridden _onScrollBarX : function(e) { this.__pane.setScrollX(e.getData()); }, // overridden _onScrollBarY : function(e) { this.__pane.setScrollY(e.getData()); } }, destruct : function() { this.__pane.dispose(); this.__pane = null; } });