diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup')
3 files changed, 0 insertions, 635 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/Popup.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/Popup.js deleted file mode 100644 index 171016d658..0000000000 --- a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/Popup.js +++ /dev/null @@ -1,329 +0,0 @@ -/* ************************************************************************ - - qooxdoo - the new era of web development - - http://qooxdoo.org - - Copyright: - 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org - - License: - LGPL 2.1: http://www.gnu.org/licenses/lgpl.html - - Authors: - * Sebastian Werner (wpbasti) - * Andreas Ecker (ecker) - -************************************************************************ */ - -/* ************************************************************************ - -#module(ui_popup) -#optional(qx.manager.object.MenuManager) - -************************************************************************ */ - -qx.OO.defineClass("qx.ui.popup.Popup", qx.ui.layout.CanvasLayout, -function() -{ - qx.ui.layout.CanvasLayout.call(this); - - this.setZIndex(this._minZIndex); -}); - -qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "popup" }); - -/*! - Whether to let the system decide when to hide the popup. Setting - this to false gives you better control but it also requires you - to handle the closing of the popup. -*/ -qx.OO.addProperty({ name : "autoHide", type : "boolean", defaultValue : true }); - -/*! - Make element displayed (if switched to true the widget will be created, if needed, too). - Instead of qx.ui.core.Widget, the default is false here. -*/ -qx.OO.changeProperty({ name : "display", type : "boolean", defaultValue : false }); - -/*! - Center the popup on open -*/ -qx.OO.addProperty({ name : "centered", type : "boolean", defaultValue : false }); - -/** - * Whether the popup should be restricted to the visible area of the page when opened. - */ -qx.OO.addProperty({ name : "restrictToPageOnOpen", type : "boolean", defaultValue : true }); - - -qx.Proto._showTimeStamp = (new Date(0)).valueOf(); -qx.Proto._hideTimeStamp = (new Date(0)).valueOf(); - - -/** - * The minimum offset to the left of the page too keep when - * {@link #restrictToPageOnOpen} is true (in pixels). - */ -qx.Settings.setDefault("restrictToPageLeft", "5"); - -/** - * The minimum offset to the right of the page too keep when - * {@link #restrictToPageOnOpen} is true (in pixels). - */ -qx.Settings.setDefault("restrictToPageRight", "5"); - -/** - * The minimum offset to the top of the page too keep when - * {@link #restrictToPageOnOpen} is true (in pixels). - */ -qx.Settings.setDefault("restrictToPageTop", "5"); - -/** - * The minimum offset to the bottom of the page too keep when - * {@link #restrictToPageOnOpen} is true (in pixels). - */ -qx.Settings.setDefault("restrictToPageBottom", "5"); - - - - - -/* ---------------------------------------------------------------------------- - APPEAR/DISAPPEAR ---------------------------------------------------------------------------- -*/ - -qx.Proto._beforeAppear = function() -{ - qx.ui.layout.CanvasLayout.prototype._beforeAppear.call(this); - - if (this.getRestrictToPageOnOpen()) { - this._wantedLeft = this.getLeft(); - - if (this._wantedLeft != null) { - // Move the popup out of the view so its size could be calculated before - // it is positioned. - this.setLeft(10000); - if (this.getElement() != null) { - // The popup was already visible once before - // -> Move it immediately before it gets visible again - this.getElement().style.left = 10000; - } - } - } - - qx.manager.object.PopupManager.getInstance().add(this); - qx.manager.object.PopupManager.getInstance().update(this); - - this._showTimeStamp = (new Date).valueOf(); - this.bringToFront(); -} - -qx.Proto._beforeDisappear = function() -{ - qx.ui.layout.CanvasLayout.prototype._beforeDisappear.call(this); - - qx.manager.object.PopupManager.getInstance().remove(this); - - this._hideTimeStamp = (new Date).valueOf(); -} - -qx.Proto._afterAppear = function() { - qx.ui.layout.CanvasLayout.prototype._afterAppear.call(this); - - if (this.getRestrictToPageOnOpen()) { - var doc = qx.ui.core.ClientDocument.getInstance(); - var docWidth = doc.getClientWidth(); - var docHeight = doc.getClientHeight(); - var restrictToPageLeft = parseInt(qx.Settings.getValueOfClass("qx.ui.popup.Popup", "restrictToPageLeft")); - var restrictToPageRight = parseInt(qx.Settings.getValueOfClass("qx.ui.popup.Popup", "restrictToPageRight")); - var restrictToPageTop = parseInt(qx.Settings.getValueOfClass("qx.ui.popup.Popup", "restrictToPageTop")); - var restrictToPageBottom = parseInt(qx.Settings.getValueOfClass("qx.ui.popup.Popup", "restrictToPageBottom")); - var left = (this._wantedLeft == null) ? this.getLeft() : this._wantedLeft; - var top = this.getTop(); - var width = this.getBoxWidth(); - var height = this.getBoxHeight(); - - var oldLeft = this.getLeft(); - var oldTop = top; - - // NOTE: We check right and bottom first, because top and left should have - // priority, when both sides are violated. - if (left + width > docWidth - restrictToPageRight) { - left = docWidth - restrictToPageRight - width; - } - if (top + height > docHeight - restrictToPageBottom) { - top = docHeight - restrictToPageBottom - height; - } - if (left < restrictToPageLeft) { - left = restrictToPageLeft; - } - if (top < restrictToPageTop) { - top = restrictToPageTop; - } - - if (left != oldLeft || top != oldTop) { - var self = this; - window.setTimeout(function() { - self.setLeft(left); - self.setTop(top); - qx.ui.core.Widget.flushGlobalQueues(); - }, 0); - } - } -}; - - - - - -/* ---------------------------------------------------------------------------- - ACTIVE/INACTIVE ---------------------------------------------------------------------------- -*/ - -qx.Proto._makeActive = function() { - this.getFocusRoot().setActiveChild(this); -} - -qx.Proto._makeInactive = function() -{ - var vRoot = this.getFocusRoot(); - var vCurrent = vRoot.getActiveChild(); - - if (vCurrent == this) { - vRoot.setActiveChild(vRoot); - } -} - - - - - -/* ---------------------------------------------------------------------------- - FOCUS ---------------------------------------------------------------------------- -*/ - -qx.Proto.isFocusable = function() { - return false; -} - - - - - -/* ---------------------------------------------------------------------------- - ZIndex Positioning ---------------------------------------------------------------------------- -*/ - -qx.Proto._minZIndex = 1e6; - -qx.Proto.bringToFront = function() -{ - this.forceZIndex(Infinity); - this._sendTo(); -} - -qx.Proto.sendToBack = function() -{ - this.forceZIndex(-Infinity); - this._sendTo(); -} - -qx.Proto._sendTo = function() -{ - var vPopups = qx.lang.Object.getValues(qx.manager.object.PopupManager.getInstance().getAll()); - var vMenus = qx.lang.Object.getValues(qx.manager.object.MenuManager.getInstance().getAll()); - - var vAll = vPopups.concat(vMenus).sort(qx.util.Compare.byZIndex); - var vLength = vAll.length; - var vIndex = this._minZIndex; - - for (var i=0; i<vLength; i++) { - vAll[i].setZIndex(vIndex++); - } -} - - - - - - -/* ---------------------------------------------------------------------------- - TIMESTAMP HANDLING ---------------------------------------------------------------------------- -*/ - -qx.Proto.getShowTimeStamp = function() { - return this._showTimeStamp; -} - -qx.Proto.getHideTimeStamp = function() { - return this._hideTimeStamp; -} - -/* ---------------------------------------------------------------------------- - UTILITIES ---------------------------------------------------------------------------- -*/ - -/** - * Positions the popup relative to some reference element. - * @param el {var} Reference DOM element/widget. - * @param offsetX {int} Offset in pixels in X direction (optional). - * @param offsetY {int} Offset in pixels in Y direction (optional). - */ -qx.Proto.positionRelativeTo = function(el, offsetX, offsetY) -{ - if (el instanceof qx.ui.core.Widget) { - el = el.getElement(); - } - if (el) { - var gecko = qx.sys.Client.getInstance().isGecko(); - var loc = qx.dom.Location; - this.setLocation(loc.getClientAreaLeft(el) - (gecko ? qx.dom.Style.getBorderLeft(el):0) + (offsetX || 0), - loc.getClientAreaTop(el) - (gecko ? qx.dom.Style.getBorderTop(el):0) + (offsetY || 0)); - } else { - this.warn('Missing reference element'); - } -} - -qx.Proto.centerToBrowser = function() -{ - var d = qx.ui.core.ClientDocument.getInstance(); - - var left = (d.getClientWidth() - this.getBoxWidth()) / 2; - var top = (d.getClientHeight() - this.getBoxHeight()) / 2; - - this.setLeft(left < 0 ? 0 : left); - this.setTop(top < 0 ? 0 : top); -} - - - -/* ---------------------------------------------------------------------------- - DISPOSER ---------------------------------------------------------------------------- -*/ - -qx.Proto.dispose = function() -{ - if (this.getDisposed()) { - return; - } - - this._showTimeStamp = null; - this._hideTimeStamp = null; - - return qx.ui.layout.CanvasLayout.prototype.dispose.call(this); -} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/PopupAtom.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/PopupAtom.js deleted file mode 100644 index eee111b84e..0000000000 --- a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/PopupAtom.js +++ /dev/null @@ -1,51 +0,0 @@ -/* ************************************************************************ - - qooxdoo - the new era of web development - - http://qooxdoo.org - - Copyright: - 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org - - License: - LGPL 2.1: http://www.gnu.org/licenses/lgpl.html - - Authors: - * Sebastian Werner (wpbasti) - * Andreas Ecker (ecker) - -************************************************************************ */ - -/* ************************************************************************ - -#module(ui_popup) - -************************************************************************ */ - -qx.OO.defineClass("qx.ui.popup.PopupAtom", qx.ui.popup.Popup, -function(vLabel, vIcon) -{ - qx.ui.popup.Popup.call(this); - - this._atom = new qx.ui.basic.Atom(vLabel, vIcon); - this._atom.setParent(this); -}); - -qx.Proto.getAtom = function() { - return this._atom; -} - -qx.Proto.dispose = function() -{ - if (this.getDisposed()) { - return; - } - - if (this._atom) - { - this._atom.dispose(); - this._atom = null; - } - - return qx.ui.popup.Popup.prototype.dispose.call(this); -} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/ToolTip.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/ToolTip.js deleted file mode 100644 index 6fd70f61ba..0000000000 --- a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/popup/ToolTip.js +++ /dev/null @@ -1,255 +0,0 @@ -/* ************************************************************************ - - qooxdoo - the new era of web development - - http://qooxdoo.org - - Copyright: - 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org - - License: - LGPL 2.1: http://www.gnu.org/licenses/lgpl.html - - Authors: - * Sebastian Werner (wpbasti) - * Andreas Ecker (ecker) - -************************************************************************ */ - -/* ************************************************************************ - -#module(ui_popup) -#load(qx.manager.object.ToolTipManager) - -************************************************************************ */ - -qx.OO.defineClass("qx.ui.popup.ToolTip", qx.ui.popup.PopupAtom, -function(vLabel, vIcon) -{ - // ************************************************************************ - // INIT - // ************************************************************************ - - qx.ui.popup.PopupAtom.call(this, vLabel, vIcon); - - // Apply shadow - this.setStyleProperty("filter", "progid:DXImageTransform.Microsoft.Shadow(color='Gray', Direction=135, Strength=4)"); - - - // ************************************************************************ - // TIMER - // ************************************************************************ - - this._showTimer = new qx.client.Timer(this.getShowInterval()); - this._showTimer.addEventListener("interval", this._onshowtimer, this); - - this._hideTimer = new qx.client.Timer(this.getHideInterval()); - this._hideTimer.addEventListener("interval", this._onhidetimer, this); - - - // ************************************************************************ - // EVENTS - // ************************************************************************ - this.addEventListener("mouseover", this._onmouseover); - this.addEventListener("mouseout", this._onmouseover); -}); - -qx.Proto._minZIndex = 1e7; - - -/* ---------------------------------------------------------------------------- - PROPERTIES ---------------------------------------------------------------------------- -*/ - -qx.OO.changeProperty({ name : "appearance", type : "string", defaultValue : "tool-tip" }); - -qx.OO.addProperty({ name : "hideOnHover", type : "boolean", defaultValue : true }); - -qx.OO.addProperty({ name : "mousePointerOffsetX", type : "number", defaultValue : 1 }); -qx.OO.addProperty({ name : "mousePointerOffsetY", type : "number", defaultValue : 20 }); - -qx.OO.addProperty({ name : "showInterval", type : "number", defaultValue : 1000 }); -qx.OO.addProperty({ name : "hideInterval", type : "number", defaultValue : 4000 }); - -qx.OO.addProperty({ name : "boundToWidget", type : "object", instance : "qx.ui.core.Widget" }); - - - - - - - - -/* ---------------------------------------------------------------------------- - MODIFIER ---------------------------------------------------------------------------- -*/ - -qx.Proto._modifyHideInterval = function(propValue, propOldValue, propData) -{ - this._hideTimer.setInterval(propValue); - return true; -} - -qx.Proto._modifyShowInterval = function(propValue, propOldValue, propData) -{ - this._showTimer.setInterval(propValue); - return true; -} - -qx.Proto._modifyBoundToWidget = function(propValue, propOldValue, propData) -{ - if (propValue) - { - this.setParent(propValue.getTopLevelWidget()); - } - else if (propOldValue) - { - this.setParent(null); - } - - return true; -} - - - - - - -/* ---------------------------------------------------------------------------- - APPEAR/DISAPPEAR ---------------------------------------------------------------------------- -*/ - -qx.Proto._beforeAppear = function() -{ - qx.ui.popup.PopupAtom.prototype._beforeAppear.call(this); - - this._stopShowTimer(); - this._startHideTimer(); -} - -qx.Proto._beforeDisappear = function() { - qx.ui.popup.PopupAtom.prototype._beforeDisappear.call(this); - - this._stopHideTimer(); -} - - - - - - -/* ---------------------------------------------------------------------------- - TIMER ---------------------------------------------------------------------------- -*/ - -qx.Proto._startShowTimer = function() -{ - if(!this._showTimer.getEnabled()) { - this._showTimer.start(); - } -} - -qx.Proto._startHideTimer = function() -{ - if(!this._hideTimer.getEnabled()) { - this._hideTimer.start(); - } -} - -qx.Proto._stopShowTimer = function() -{ - if(this._showTimer.getEnabled()) { - this._showTimer.stop(); - } -} - -qx.Proto._stopHideTimer = function() -{ - if(this._hideTimer.getEnabled()) { - this._hideTimer.stop(); - } -} - - - - - - - -/* ---------------------------------------------------------------------------- - EVENTS ---------------------------------------------------------------------------- -*/ - -qx.Proto._onmouseover = function(e) -{ - if(this.getHideOnHover()) { - this.hide(); - } -} - -qx.Proto._onshowtimer = function(e) -{ - this.setLeft(qx.event.type.MouseEvent.getPageX() + this.getMousePointerOffsetX()); - this.setTop(qx.event.type.MouseEvent.getPageY() + this.getMousePointerOffsetY()); - - this.show(); - - // we need a manual flushing because it could be that - // there is currently no event which do this for us - // and so show the tooltip. - qx.ui.core.Widget.flushGlobalQueues(); - - return true; -} - -qx.Proto._onhidetimer = function(e) { - return this.hide(); -} - - - - - - - -/* ---------------------------------------------------------------------------- - DISPOSER ---------------------------------------------------------------------------- -*/ - -qx.Proto.dispose = function() -{ - if(this.getDisposed()) { - return; - } - - this.removeEventListener("mouseover", this._onmouseover); - this.removeEventListener("mouseout", this._onmouseover); - - if (this._showTimer) - { - this._showTimer.removeEventListener("interval", this._onshowtimer, this); - this._showTimer.dispose(); - this._showTimer = null; - } - - if (this._hideTimer) - { - this._hideTimer.removeEventListener("interval", this._onhidetimer, this); - this._hideTimer.dispose(); - this._hideTimer = null; - } - - return qx.ui.popup.PopupAtom.prototype.dispose.call(this); -} |