You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by al...@apache.org on 2018/05/14 09:10:02 UTC

[royale-asjs] branch feature/MXRoyale updated: Spark ToggleButtonBase.as Added

This is an automated email from the ASF dual-hosted git repository.

alinakazi pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/MXRoyale by this push:
     new 27bdc0c  Spark ToggleButtonBase.as Added
27bdc0c is described below

commit 27bdc0cc369a2afe6c97a2db1198802c75940520
Author: alinakazi <AL...@GMAIL.COM>
AuthorDate: Mon May 14 02:09:58 2018 -0700

    Spark ToggleButtonBase.as Added
---
 .../components/supportClasses/ToggleButtonBase.as  | 255 +++++++++++++++++++++
 1 file changed, 255 insertions(+)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ToggleButtonBase.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ToggleButtonBase.as
new file mode 100644
index 0000000..0643e67
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ToggleButtonBase.as
@@ -0,0 +1,255 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components.supportClasses
+{
+
+/* import flash.events.Event;
+import flash.events.MouseEvent; */
+import org.apache.royale.events.Event;
+import org.apache.royale.events.MouseEvent; 
+import mx.core.mx_internal;
+import mx.events.FlexEvent;
+
+use namespace mx_internal;
+
+/**
+ *  Dispatched when the <code>selected</code> property 
+ *  changes for the ToggleButtonBase control. 
+ * 
+ *  This event is dispatched only when the 
+ *  user interacts with the control by using the mouse.
+ *
+ *  @eventType flash.events.Event.CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+//[Event(name="change", type="flash.events.Event")]
+
+/**
+ *  Up State of the Button when it's selected
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+//[SkinState("upAndSelected")]
+
+/**
+ *  Over State of the Button when it's selected
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+//[SkinState("overAndSelected")]
+
+/**
+ *  Down State of the Button when it's selected
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+//[SkinState("downAndSelected")]
+
+/**
+ *  Disabled State of the Button when it's selected
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+//[SkinState("disabledAndSelected")]
+
+//--------------------------------------
+//  Other metadata
+//--------------------------------------
+
+//[AccessibilityClass(implementation="spark.accessibility.ToggleButtonAccImpl")]
+
+/**
+ *  The ToggleButtonBase component is the base class for the Spark button components
+ *  that support the <code>selected</code> property.
+ *  ToggleButton, CheckBox and RadioButton are subclasses of ToggleButtonBase.
+ *
+ *  @mxml
+ *
+ *  <p>The <code>&lt;s:ToggleButtonBase&gt;</code> tag inherits all of the tag 
+ *  attributes of its superclass and adds the following tag attributes:</p>
+ *
+ *  <pre>
+ *  &lt;s:ToggleButtonBase
+ *    <strong>Properties</strong>
+ *    selected="false"
+ * 
+ *    <strong>events</strong>
+ *    change="<i>No default</i>"
+ *  /&gt;
+ *  </pre> 
+ *
+ *  @see spark.components.ToggleButton
+ *  @see spark.components.CheckBox
+ *  @see spark.components.RadioButton
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Royale 0.9.4
+ */
+public class ToggleButtonBase extends ButtonBase
+{
+    //include "../../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class mixins
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @private
+     *  Placeholder for mixin by ToggleButtonAccImpl.
+     */
+   // mx_internal static var createAccessibilityImplementation:Function;
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Royale 0.9.4
+     */    
+    public function ToggleButtonBase()
+    {
+        super();
+		
+		// ToggleButtons don't use minimumDownStateTime.  If they are quick-tapped
+		// with a touchDelay, they don't fake it and go in to the down state for a bit.
+		// They go immediately to the selected state.
+		//disableMinimumDownStateTime = true;
+    }
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  selected
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the selected property 
+     */
+    private var _selected:Boolean;
+
+    [Bindable]
+    [Inspectable(category="General", defaultValue="false")]
+    
+    /**
+     *  Contains <code>true</code> if the button is in the down state, 
+     *  and <code>false</code> if it is in the up state.
+     *
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Royale 0.9.4
+     */    
+    public function get selected():Boolean
+    {
+        return _selected;
+    }
+    
+    /**
+     *  @private
+     */    
+    public function set selected(value:Boolean):void
+    {
+        if (value == _selected)
+            return;
+
+        _selected = value;            
+        dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
+        invalidateSkinState();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  States
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */ 
+    /* override protected function getCurrentSkinState():String
+    {
+        if (!selected)
+            return super.getCurrentSkinState();
+        else
+            return super.getCurrentSkinState() + "AndSelected";
+    } */
+    
+    /**
+     *  @private
+     */ 
+    /* override protected function buttonReleased():void
+    {
+        super.buttonReleased();
+        
+        selected = !selected;
+        
+        dispatchEvent(new Event(Event.CHANGE));
+    } */
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden methods
+    //
+    //--------------------------------------------------------------------------
+    
+    /**
+     *  @private
+     */
+    /* override protected function initializeAccessibility():void
+    {
+        if (ToggleButtonBase.createAccessibilityImplementation != null)
+            ToggleButtonBase.createAccessibilityImplementation(this);
+    } */
+}
+
+}

-- 
To stop receiving notification emails like this one, please contact
alinakazi@apache.org.