1///////////////////////////////// 2// Controls-related functionality 3///////////////////////////////// 4 5 qcodo.getControl = function(mixControl) { 6 if (typeof(mixControl) == 'string') 7 return document.getElementById(mixControl); 8 else 9 return mixControl; 10 }; 11 12 qcodo.getWrapper = function(mixControl) { 13 var objControl; if (!(objControl = qcodo.getControl(mixControl))) return; 14 15 if (objControl) 16 return this.getControl(objControl.id + "_ctl"); 17 else 18 return null; 19 }; 20 21 22 23///////////////////////////// 24// Register Control - General 25///////////////////////////// 26 27 qcodo.controlModifications = new Array(); 28 qcodo.javascriptStyleToQcodo = new Array(); 29 qcodo.javascriptStyleToQcodo["backgroundColor"] = "BackColor"; 30 qcodo.javascriptStyleToQcodo["borderColor"] = "BorderColor"; 31 qcodo.javascriptStyleToQcodo["borderStyle"] = "BorderStyle"; 32 qcodo.javascriptStyleToQcodo["border"] = "BorderWidth"; 33 qcodo.javascriptStyleToQcodo["height"] = "Height"; 34 qcodo.javascriptStyleToQcodo["width"] = "Width"; 35 qcodo.javascriptStyleToQcodo["text"] = "Text"; 36 37 qcodo.javascriptWrapperStyleToQcodo = new Array(); 38 qcodo.javascriptWrapperStyleToQcodo["position"] = "Position"; 39 qcodo.javascriptWrapperStyleToQcodo["top"] = "Top"; 40 qcodo.javascriptWrapperStyleToQcodo["left"] = "Left"; 41 42 qcodo.recordControlModification = function(strControlId, strProperty, strNewValue) { 43 if (!qcodo.controlModifications[strControlId]) 44 qcodo.controlModifications[strControlId] = new Array(); 45 qcodo.controlModifications[strControlId][strProperty] = strNewValue; 46 }; 47 48 qcodo.registerControl = function(mixControl) { 49 var objControl; if (!(objControl = qcodo.getControl(mixControl))) return; 50 51 // Link the Wrapper and the Control together 52 var objWrapper = this.getWrapper(objControl); 53 objControl.wrapper = objWrapper; 54 objWrapper.control = objControl; 55 56 // Add the wrapper to the global qcodo wrappers array 57 qcodo.wrappers[objWrapper.id] = objWrapper; 58 59 60 // Create New Methods, etc. 61 // Like: objWrapper.something = xyz; 62 63 // Updating Style-related Things 64 objWrapper.updateStyle = function(strStyleName, strNewValue) { 65 var objControl = this.control; 66 67 switch (strStyleName) { 68 case "className": 69 objControl.className = strNewValue; 70 qcodo.recordControlModification(objControl.id, "CssClass", strNewValue); 71 break; 72 73 case "parent": 74 if (strNewValue) { 75 var objNewParentControl = qcodo.getControl(strNewValue); 76 objNewParentControl.appendChild(this); 77 qcodo.recordControlModification(objControl.id, "Parent", strNewValue); 78 } else { 79 var objParentControl = this.parentNode; 80 objParentControl.removeChild(this); 81 qcodo.recordControlModification(objControl.id, "Parent", ""); 82 }; 83 break; 84 85 case "displayStyle": 86 objControl.style.display = strNewValue; 87 qcodo.recordControlModification(objControl.id, "DisplayStyle", strNewValue); 88 break; 89 90 case "display": 91 if (strNewValue) { 92 objWrapper.style.display = "inline"; 93 qcodo.recordControlModification(objControl.id, "Display", "1"); 94 } else { 95 objWrapper.style.display = "none"; 96 qcodo.recordControlModification(objControl.id, "Display", "0"); 97 }; 98 break; 99 100 case "enabled": 101 if (strNewValue) { 102 objWrapper.control.disabled = false; 103 qcodo.recordControlModification(objControl.id, "Enabled", "1"); 104 } else { 105 objWrapper.control.disabled = true; 106 qcodo.recordControlModification(objControl.id, "Enabled", "0"); 107 }; 108 break; 109 110 case "width": 111 case "height": 112 objControl.style[strStyleName] = strNewValue; 113 if (qcodo.javascriptStyleToQcodo[strStyleName]) 114 qcodo.recordControlModification(objControl.id, qcodo.javascriptStyleToQcodo[strStyleName], strNewValue); 115 if (objWrapper.handle) 116 objWrapper.updateHandle(); 117 break; 118 119 case "text": 120 objControl.innerHTML = strNewValue; 121 qcodo.recordControlModification(objControl.id, "Text", strNewValue); 122 break; 123 124 default: 125 if (qcodo.javascriptWrapperStyleToQcodo[strStyleName]) { 126 this.style[strStyleName] = strNewValue; 127 qcodo.recordControlModification(objControl.id, qcodo.javascriptWrapperStyleToQcodo[strStyleName], strNewValue); 128 } else { 129 objControl.style[strStyleName] = strNewValue; 130 if (qcodo.javascriptStyleToQcodo[strStyleName]) 131 qcodo.recordControlModification(objControl.id, qcodo.javascriptStyleToQcodo[strStyleName], strNewValue); 132 }; 133 break; 134 }; 135 }; 136 137 // Positioning-related functions 138 139 objWrapper.getAbsolutePosition = function() { 140 var intOffsetLeft = 0; 141 var intOffsetTop = 0; 142 143 var objControl = this.control; 144 145 while (objControl) { 146 // If we are IE, we don't want to include calculating 147 // controls who's wrappers are position:relative 148 if ((objControl.wrapper) && (objControl.wrapper.style.position == "relative")) { 149 150 } else { 151 intOffsetLeft += objControl.offsetLeft; 152 intOffsetTop += objControl.offsetTop; 153 }; 154 objControl = objControl.offsetParent; 155 }; 156 157 return {x:intOffsetLeft, y:intOffsetTop}; 158 }; 159 160 objWrapper.setAbsolutePosition = function(intNewX, intNewY, blnBindToParent) { 161 var objControl = this.offsetParent; 162 163 while (objControl) { 164 intNewX -= objControl.offsetLeft; 165 intNewY -= objControl.offsetTop; 166 objControl = objControl.offsetParent; 167 }; 168 169 if (blnBindToParent) { 170 if (this.parentNode.nodeName.toLowerCase() != 'form') { 171 // intNewX and intNewY must be within the parent's control 172 intNewX = Math.max(intNewX, 0); 173 intNewY = Math.max(intNewY, 0); 174 175 intNewX = Math.min(intNewX, this.offsetParent.offsetWidth - this.offsetWidth); 176 intNewY = Math.min(intNewY, this.offsetParent.offsetHeight - this.offsetHeight); 177 }; 178 }; 179 180 this.updateStyle("left", intNewX + "px"); 181 this.updateStyle("top", intNewY + "px"); 182 }; 183 184 objWrapper.setDropZoneMaskAbsolutePosition = function(intNewX, intNewY, blnBindToParent) { 185/* 186 var objControl = this.offsetParent; 187 188 while (objControl) { 189 intNewX -= objControl.offsetLeft; 190 intNewY -= objControl.offsetTop; 191 objControl = objControl.offsetParent; 192 } 193 194 if (blnBindToParent) { 195 if (this.parentNode.nodeName.toLowerCase() != 'form') { 196 // intNewX and intNewY must be within the parent's control 197 intNewX = Math.max(intNewX, 0); 198 intNewY = Math.max(intNewY, 0); 199 200 intNewX = Math.min(intNewX, this.offsetParent.offsetWidth - this.offsetWidth); 201 intNewY = Math.min(intNewY, this.offsetParent.offsetHeight - this.offsetHeight); 202 } 203 } 204 205 qc.logObject(intNewX + " x " + intNewY); 206*/ 207 this.dropZoneMask.style.left = intNewX + "px"; 208 this.dropZoneMask.style.top = intNewY + "px"; 209 }; 210 211 objWrapper.setMaskOffset = function(intDeltaX, intDeltaY) { 212 var objAbsolutePosition = this.getAbsolutePosition(); 213 this.mask.style.left = (objAbsolutePosition.x + intDeltaX) + "px"; 214 this.mask.style.top = (objAbsolutePosition.y + intDeltaY) + "px"; 215 }; 216 217 objWrapper.containsPoint = function(intX, intY) { 218 var objAbsolutePosition = this.getAbsolutePosition(); 219 if ((intX >= objAbsolutePosition.x) && (intX <= objAbsolutePosition.x + this.control.offsetWidth) && 220 (intY >= objAbsolutePosition.y) && (intY <= objAbsolutePosition.y + this.control.offsetHeight)) 221 return true; 222 else 223 return false;
224 }; 225 226 // Toggle Display / Enabled 227 objWrapper.toggleDisplay = function(strShowOrHide) { 228 // Toggles the display/hiding of the entire control (including any design/wrapper HTML) 229 // If ShowOrHide is blank, then we toggle 230 // Otherwise, we'll execute a "show" or a "hide" 231 if (strShowOrHide) { 232 if (strShowOrHide == "show") 233 this.updateStyle("display", true); 234 else 235 this.updateStyle("display", false); 236 } else 237 this.updateStyle("display", (this.style.display == "none") ? true : false); 238 }; 239 240 objWrapper.toggleEnabled = function(strEnableOrDisable) { 241 if (strEnableOrDisable) { 242 if (strEnableOrDisable == "enable") 243 this.updateStyle("enabled", true); 244 else 245 this.updateStyle("enabled", false); 246 } else 247 this.updateStyle("enabled", (this.control.disabled) ? true : false); 248 }; 249 250 objWrapper.registerClickPosition = function(objEvent) { 251 objEvent = (objEvent) ? objEvent : ((typeof(event) == "object") ? event : null); 252 qcodo.handleEvent(objEvent); 253 254 var intX = qcodo.mouse.x - this.getAbsolutePosition().x + qcodo.scroll.x; 255 var intY = qcodo.mouse.y - this.getAbsolutePosition().y + qcodo.scroll.y; 256 257 // Random IE Check 258 if (qcodo.isBrowser(qcodo.IE)) { 259 intX = intX - 2; 260 intY = intY - 2; 261 }; 262 263 document.getElementById(this.control.id + "_x").value = intX; 264 document.getElementById(this.control.id + "_y").value = intY; 265 }; 266 267 // Focus 268 objWrapper.focus = function() { 269 if (this.control.focus) { 270 if (qcodo.isBrowser(qcodo.IE) && (typeof (this.control.focus) == "object")) 271 this.control.focus(); 272 else if (typeof (this.control.focus) == "function") 273 this.control.focus(); 274 }; 275 }; 276 277 // Select All (will only work for textboxes only) 278 objWrapper.select = function() { 279 if (this.control.select) 280 this.control.select(); 281 }; 282 283 // Blink 284 objWrapper.blink = function(strFromColor, strToColor) { 285 objWrapper.defaultBackgroundColor = objWrapper.control.style.backgroundColor; 286 287 objWrapper.blinkStart = qcodo.colorRgbValues(strFromColor); 288 objWrapper.blinkEnd = qcodo.colorRgbValues(strToColor); 289 objWrapper.blinkStep = new Array( 290 Math.round((objWrapper.blinkEnd[0] - objWrapper.blinkStart[0]) / 12.5), 291 Math.round((objWrapper.blinkEnd[1] - objWrapper.blinkStart[1]) / 12.5), 292 Math.round((objWrapper.blinkEnd[2] - objWrapper.blinkStart[2]) / 12.5) 293 ); 294 objWrapper.blinkDown = new Array( 295 (objWrapper.blinkStep[0] < 0) ? true : false, 296 (objWrapper.blinkStep[1] < 0) ? true : false, 297 (objWrapper.blinkStep[2] < 0) ? true : false 298 ); 299 300 objWrapper.blinkCurrent = objWrapper.blinkStart; 301 this.control.style.backgroundColor = qcodo.colorRgbString(objWrapper.blinkCurrent); 302 qcodo.setTimeout(objWrapper.id, "qc.getC('" + objWrapper.id + "').blinkHelper()", 20); 303 }; 304 305 objWrapper.blinkHelper = function() { 306 objWrapper.blinkCurrent[0] += objWrapper.blinkStep[0]; 307 objWrapper.blinkCurrent[1] += objWrapper.blinkStep[1]; 308 objWrapper.blinkCurrent[2] += objWrapper.blinkStep[2]; 309 if (((objWrapper.blinkDown[0]) && (objWrapper.blinkCurrent[0] < objWrapper.blinkEnd[0])) || 310 ((!objWrapper.blinkDown[0]) && (objWrapper.blinkCurrent[0] > objWrapper.blinkEnd[0]))) 311 objWrapper.blinkCurrent[0] = objWrapper.blinkEnd[0]; 312 if (((objWrapper.blinkDown[1]) && (objWrapper.blinkCurrent[1] < objWrapper.blinkEnd[1])) || 313 ((!objWrapper.blinkDown[1]) && (objWrapper.blinkCurrent[1] > objWrapper.blinkEnd[1]))) 314 objWrapper.blinkCurrent[1] = objWrapper.blinkEnd[1]; 315 if (((objWrapper.blinkDown[2]) && (objWrapper.blinkCurrent[2] < objWrapper.blinkEnd[2])) || 316 ((!objWrapper.blinkDown[2]) && (objWrapper.blinkCurrent[2] > objWrapper.blinkEnd[2]))) 317 objWrapper.blinkCurrent[2] = objWrapper.blinkEnd[2]; 318 319 this.control.style.backgroundColor = qcodo.colorRgbString(objWrapper.blinkCurrent); 320 321 if ((objWrapper.blinkCurrent[0] == objWrapper.blinkEnd[0]) && 322 (objWrapper.blinkCurrent[1] == objWrapper.blinkEnd[1]) && 323 (objWrapper.blinkCurrent[2] == objWrapper.blinkEnd[2])) { 324 // Done with Blink! 325 this.control.style.backgroundColor = objWrapper.defaultBackgroun
325dColor; 326 } else { 327 qcodo.setTimeout(objWrapper.id, "qc.getC('" + objWrapper.id + "').blinkHelper()", 20); 328 }; 329 }; 330 }; 331 332 qcodo.registerControlArray = function(mixControlArray) { 333 var intLength = mixControlArray.length; 334 for (var intIndex = 0; intIndex < intLength; intIndex++) 335 qcodo.registerControl(mixControlArray[intIndex]); 336 }; 337 338 339 340////////////////// 341// Qcodo Shortcuts 342////////////////// 343 344 qc.getC = qcodo.getControl; 345 qc.getW = qcodo.getWrapper; 346 qc.regC = qcodo.registerControl; 347 qc.regCA = qcodo.registerControlArray;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.