Changed zouba directory heirarchy.
[ptas] / wrt / zouba / WRTKit / UI / Control.js
diff --git a/wrt/zouba/WRTKit/UI/Control.js b/wrt/zouba/WRTKit/UI/Control.js
deleted file mode 100644 (file)
index fd3c8bb..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*\r
-� Copyright 2008 Nokia Corporation. All rights reserved.\r
-\r
-IMPORTANT:  The Nokia software ("WRTKit and Example Widget files") is supplied to you by Nokia\r
-Corporation (�Nokia�) in consideration of your agreement to the following terms. Your use, installation\r
-and/or redistribution of the WRTKit and Example Widget files constitutes acceptance of these terms. If\r
-you do not agree with these terms, please do not use, install, or redistribute the WRTKit and Example\r
-Widget files.\r
-\r
-In consideration of your agreement to abide by the following terms, and subject to these terms, Nokia\r
-grants you a personal, non-exclusive license, under Nokia�s copyrights in the WRTKit and Example\r
-Widget files, to use, reproduce, and redistribute the WRTKit and Example files, in text form (for HTML,\r
-CSS, or JavaScript files) or binary form (for associated images), for the sole purpose of creating S60\r
-Widgets.\r
-\r
-If you redistribute the WRTKit and Example files, you must retain this entire notice in all such\r
-redistributions of the WRTKit and Example files.\r
-\r
-You may not use the name, trademarks, service marks or logos of Nokia to endorse or promote products\r
-that include the WRTKit and Example files without the prior written explicit agreement with Nokia.\r
-Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by\r
-Nokia herein, including but not limited to any patent rights that may be infringed by your products that\r
-incorporate the WRTKit and Example files or by other works in which the WRTKit and Example files\r
-may be incorporated.\r
-\r
-The WRTKit and Example files are provided on an "AS IS" basis.  NOKIA MAKES NO\r
-WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED\r
-WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A\r
-PARTICULAR PURPOSE, REGARDING THE EXAMPLES OR ITS USE AND OPERATION\r
-ALONE OR IN COMBINATION WITH YOUR PRODUCTS.\r
-\r
-IN NO EVENT SHALL NOKIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR\r
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
-INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, AND/OR\r
-DISTRIBUTION OF THE EXAMPLES, HOWEVER CAUSED AND WHETHER UNDER THEORY\r
-OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE,\r
-EVEN IF NOKIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-*/\r
-\r
-///////////////////////////////////////////////////////////////////////////////\r
-// The Control class is an abstract base class for all user interface controls.\r
-\r
-// Constructor.\r
-function Control(id, caption) {\r
-    if (id != UI_NO_INIT_ID) {\r
-        this.init(id, caption);\r
-    }\r
-}\r
-\r
-// Control inherits from UIElement.\r
-Control.prototype = new UIElement(UI_NO_INIT_ID);\r
-\r
-// The view that control belongs to.\r
-Control.prototype.view = null;\r
-\r
-// Is the control focused?\r
-Control.prototype.focused = false;\r
-\r
-// Is the pointer over this control?\r
-Control.prototype.hovering = false;\r
-\r
-// The element hierarchy in a control is as follows:\r
-//\r
-// rootElement\r
-//     assemblyElement\r
-//         captionElement\r
-//         controlElement\r
-//\r
-// The assembly element groups the portion of a control that typically handle\r
-// the visual effects for focus and hover states. Having a separate root and\r
-// assembly elements allows other elements to be added to a control without\r
-// them being affected by the CSS rules of the assembly element.\r
-\r
-// The assembly element of this control.\r
-Control.prototype.assemblyElement = null;\r
-\r
-// The caption of this control; null if none.\r
-Control.prototype.caption = null;\r
-\r
-// The caption element of this control.\r
-Control.prototype.captionElement = null;\r
-\r
-// The control element of this control.\r
-Control.prototype.controlElement = null;\r
-\r
-// Initializer - called from constructor.\r
-Control.prototype.init = function(id, caption) {\r
-    uiLogger.debug("Control.init(" + id + ", " + caption + ")");\r
-    \r
-    // call superclass initializer\r
-    UIElement.prototype.init.call(this, id);\r
-    \r
-    // create assembly, caption and control elements\r
-    this.assemblyElement = document.createElement("div");\r
-    this.captionElement = document.createElement("div");\r
-    this.assemblyElement.appendChild(this.captionElement);\r
-    this.controlElement = document.createElement("div");\r
-    this.assemblyElement.appendChild(this.controlElement);\r
-    this.rootElement.appendChild(this.assemblyElement);\r
-    \r
-    // set the caption\r
-    // style is not updated because the subclass will update the style later\r
-    // when it has completely initialized the component\r
-    this.setCaption(caption, true);\r
-}\r
-\r
-// Returns the caption; null if none.\r
-Control.prototype.getCaption = function() {\r
-    return this.caption;\r
-}\r
-\r
-// Sets the caption; null if none.\r
-Control.prototype.setCaption = function(caption, noStyleUpdate) {\r
-    uiLogger.debug("Control.setCaption(" + caption + ")");\r
-    \r
-    // set the display style\r
-    this.captionElement.style.display = (caption == null) ? "none" : "block";\r
-    \r
-    // set the caption\r
-    this.caption = caption;\r
-    this.captionElement.innerHTML = (caption == null) ? "" : caption;\r
-    \r
-    // update style\r
-    if (!noStyleUpdate) {\r
-        this.updateStyleFromState();\r
-    }\r
-}\r
-\r
-// Returns the enabled state.\r
-// Override this in subclasses as required to implement the state change.\r
-Control.prototype.isEnabled = function() {\r
-    return false;\r
-}\r
-\r
-// Sets the enabled state.\r
-// Override this in subclasses as required to implement the state change.\r
-Control.prototype.setEnabled = function(enabled) {\r
-    uiLogger.debug("Control.setEnabled(" + enabled + ")");\r
-}\r
-\r
-// Returns the focusable state for the control.\r
-// Defaults focusable if enabled - override this in subclasses as required.\r
-Control.prototype.isFocusable = function() {\r
-    return this.isEnabled();\r
-}\r
-\r
-// Returns the focused state for the control.\r
-Control.prototype.isFocused = function() {\r
-    return this.focused;\r
-}\r
-\r
-// Sets the focused state for the control.\r
-// Note: This may not always succeed.\r
-// Override this in subclasses as required to implement the state change.\r
-Control.prototype.setFocused = function(focused) {\r
-    uiLogger.debug("Control.setFocused(" + focused + ")");\r
-    // note that this.focused gets set as a result of focusStateChanged() being called\r
-    // rather than setting it explicitly here\r
-}\r
-\r
-// Called when the focus state has changed for this control.\r
-Control.prototype.focusStateChanged = function(focused) {\r
-    uiLogger.debug("Control.focusStateChanged(" + focused + ")");\r
-    if (this.focused != focused) {\r
-        this.focused = focused;\r
-        \r
-        // let the view know about the focus change\r
-        if (this.view != null) {\r
-            this.view.focusedControlChanged(focused ? this : null);\r
-        }\r
-        \r
-        // update the style from the current state\r
-        this.updateStyleFromState();\r
-        \r
-        // notify event listeners\r
-        this.fireEvent(this.createEvent("FocusStateChanged", focused));\r
-    }\r
-}\r
-\r
-// Called when the hover state has changed for this control.\r
-Control.prototype.hoverStateChanged = function(hovering) {\r
-    uiLogger.debug("Control.hoverStateChanged(" + hovering + ")");\r
-    if (this.hovering != hovering) {\r
-        this.hovering = hovering;\r
-        \r
-        // update the style from the current state\r
-        this.updateStyleFromState();\r
-        \r
-        // notify event listeners\r
-        this.fireEvent(this.createEvent("HoverStateChanged", hovering));\r
-    }\r
-}\r
-\r
-// Helper method that returns the state name for the current state.\r
-Control.prototype.getStyleStateName = function() {\r
-    var focusable = this.isFocusable();\r
-    if (focusable && this.focused) {\r
-        return "Focus";\r
-    } else if (focusable && this.hovering) {\r
-        return "Hover";\r
-    } else if (!this.isEnabled()) {\r
-        return "Disabled";\r
-    } else {\r
-        return "Normal";\r
-    }\r
-}\r
-\r
-// Resets the state tracking for focus and hover.\r
-// Override this in subclasses as required to implement the state reset.\r
-Control.prototype.resetFocusState = function() {\r
-    uiLogger.debug("Control.resetFocusState()");\r
-    this.hovering = false;\r
-    this.focused = false;\r
-    this.updateStyleFromState();\r
-}\r
-\r
-// Helper function that sets a classname for an element.\r
-// Only sets the class name if it actually is different from the current value.\r
-Control.prototype.setClassName = function(element, className) {\r
-    if (element.className != className) {\r
-        element.className = className;\r
-    }\r
-}\r
-\r
-// Updates the style of the control to reflects the state of the control.\r
-// Override this in subclasses as required to implement the state change.\r
-Control.prototype.updateStyleFromState = function() {\r
-    uiLogger.debug("Control.updateStyleFromState()");\r
-}\r