[Qooxdoo-commit] qooxdoo/source/script/gui QxWidget.js,1.1.2.65,1.1.2.66
Brought to you by:
ecker,
martinwittemann
|
From: Sebastian W. <wp...@us...> - 2006-02-02 16:51:21
|
Update of /cvsroot/qooxdoo/qooxdoo/source/script/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23080/source/script/gui Modified Files: Tag: renderer QxWidget.js Log Message: Reimplemented state handling, fixed some issues with blank images Index: QxWidget.js =================================================================== RCS file: /cvsroot/qooxdoo/qooxdoo/source/script/gui/Attic/QxWidget.js,v retrieving revision 1.1.2.65 retrieving revision 1.1.2.66 diff -u -d -r1.1.2.65 -r1.1.2.66 --- QxWidget.js 2 Feb 2006 14:10:24 -0000 1.1.2.65 +++ QxWidget.js 2 Feb 2006 16:51:03 -0000 1.1.2.66 @@ -52,7 +52,6 @@ // ************************************************************************ // HTML MAPPING DATA STRUCTURES // ************************************************************************ - // Allows the user to setup styles and attributes without a // need to have the target element created already. /* @@ -63,25 +62,15 @@ // ************************************************************************ - // QUEUE + // LAYOUT CHANGES // ************************************************************************ - - // Holds current layout changes this._layoutChanges = {}; // ************************************************************************ - // STATE MANAGMENT + // APPEARANCE // ************************************************************************ - - // Contains the currently active states this._states = {}; - - for (var vCat in QxWidget.states) { - this._states[QxWidget.states[vCat][0]] = true; - }; - - this._applyInitialAppearance(); }; @@ -872,8 +861,9 @@ // this.debug("_beforeDisappear"); // Remove any hover/pressed styles - this.setMouseState(QxConst.STATE_OUT); - this.setButtonState(QxConst.STATE_NOTPRESSED); + this.removeState(QxConst.STATE_OVER); + this.removeState(QxConst.STATE_PRESSED); + this.removeState(QxConst.STATE_LEFT); // this.debug("_beforeDisappear"); this.createDispatchEvent(QxConst.EVENT_TYPE_BEFORERDISAPPEAR); @@ -2999,7 +2989,7 @@ proto._modifyEnabled = function(propValue, propOldValue, propData) { - this.setEnabledState(propValue ? QxConst.STATE_ENABLED : QxConst.STATE_DISABLED); + propValue ? this.removeState(QxConst.STATE_DISABLED) : this.addState(QxConst.STATE_DISABLED); return true; }; @@ -3009,119 +2999,30 @@ /* --------------------------------------------------------------------------- - STYLES & BEHAVIOR + STATE HANDLING --------------------------------------------------------------------------- */ -QxWidget.STATE_GROUP_MOUSE = "mouse"; -QxWidget.STATE_GROUP_FOCUS = "focus"; -QxWidget.STATE_GROUP_ENABLED = "enabled"; -QxWidget.STATE_GROUP_ACTIVE = "active"; - -QxWidget.STATE_GROUP_CHECKED = "checked"; -QxWidget.STATE_GROUP_BUTTON = "button"; - -QxWidget.STATE_GROUP_SELECTED = "selected"; -QxWidget.STATE_GROUP_ANCHOR = "anchor"; -QxWidget.STATE_GROUP_LEAD = "lead"; - -QxWidget.STATE_GROUP_WINDOW = "window"; - -QxWidget.states = -{ - "mouse" : [ "out", "over" ], - "focus" : [ "blurred", "focused" ], - "enabled" : [ "enabled", "disabled" ], - "active" : [ "inactive", "active" ], - - "checked" : [ "unchecked", "checked" ], - "button" : [ "notpressed", "pressed", "left" ], - - "selected" : [ "notselected", "selected" ], - "anchor" : [ "notanchor", "anchor" ], - "lead" : [ "notlead", "lead" ], - - "window" : [ "restored", "maximized" ] -}; - -proto.getAllStates = function() { - return this._states; -}; - proto.hasState = function(vState) { return this._states[vState] ? true : false; }; - - - - -proto.setMouseState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_MOUSE); -}; - -proto.setFocusState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_FOCUS); -}; - -proto.setEnabledState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_ENABLED); -}; - -proto.setActiveState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_ACTIVE); -}; - -proto.setCheckedState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_CHECKED); -}; - -proto.setButtonState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_BUTTON); -}; - -proto.setSelectedState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_SELECTED); -}; - -proto.setAnchorState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_ANCHOR); -}; - -proto.setLeadState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_LEAD); -}; - -proto.setWindowState = function(vState) { - return this._setState(vState, QxWidget.STATE_GROUP_WINDOW); +proto.addState = function(vState) +{ + this._states[vState] = true; + + if (this._hasParent) { + QxWidget.addToGlobalStateQueue(this); + }; }; - - -proto._setState = function(vState, vCat) +proto.removeState = function(vState) { - var vSetStates = this._states; - - if (vSetStates[vState]) { - return; - }; - - var vCatStates = QxWidget.states[vCat]; - - for (var i=0, l=vCatStates.length, vCatState; i<l; i++) - { - vCatState = vCatStates[i]; - - if (vCatState != vState) { - delete vSetStates[vCatState]; - }; - }; - - vSetStates[vState] = true; + delete this._states[vState]; if (this._hasParent) { QxWidget.addToGlobalStateQueue(this); - }; + }; }; @@ -3130,7 +3031,11 @@ - +/* +--------------------------------------------------------------------------- + APPEARANCE +--------------------------------------------------------------------------- +*/ proto._applyInitialAppearance = function() { @@ -3183,12 +3088,6 @@ }; }; - - - - - - if (QxClient.isMshtml()) { /* @@ -3641,7 +3540,7 @@ } catch(ex) {}; }; - this.setFocusState(QxConst.STATE_BLURRED); + this.removeState(QxConst.STATE_FOCUSED); return true; }; @@ -3654,7 +3553,7 @@ } catch(ex) {}; }; - this.setFocusState(QxConst.STATE_FOCUSED); + this.addState(QxConst.STATE_FOCUSED); return true; }; |