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

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


The following commit(s) were added to refs/heads/color_picker by this push:
     new 34976c3  Starting spectrum component
34976c3 is described below

commit 34976c394b96686ffee6fdeaec48fc8d1e987862
Author: DESKTOP-RH4S838\Yishay <[email protected]>
AuthorDate: Sun Mar 17 16:36:14 2019 +0200

    Starting spectrum component
---
 .../apache/royale/html/beads/models/ColorModel.as  | 91 ++++++++++++++++++++++
 .../royale/html/supportClasses/ColorSpectrum.as    | 82 +++++++++++++++++++
 .../royale/org/apache/royale/core/IColorModel.as   | 44 +++++++++++
 3 files changed, 217 insertions(+)

diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/ColorModel.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/ColorModel.as
new file mode 100644
index 0000000..ad5f346
--- /dev/null
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/models/ColorModel.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.html.beads.models
+{      
+       import org.apache.royale.core.IBead;
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.core.IColorModel;
+       import org.apache.royale.events.Event;
+       import org.apache.royale.events.EventDispatcher;
+               
+    /**
+     *  The ColorModel class is the most basic data model for a
+     *  component that displays or edits a color. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.9.6
+     */
+       public class ColorModel extends EventDispatcher implements IBead, 
IColorModel
+       {
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+               public function ColorModel()
+               {
+               }
+               
+               public function set strand(value:IStrand):void
+               {
+                       _strand = value;
+               }
+
+        [Bindable("change")]
+        /**
+         *  @copy org.apache.royale.core.IColorModel#color
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+        public function get color():uint
+               {
+                       return IColorModel(model).color;
+               }
+               
+        /**
+         *  @private
+         */
+               public function set color(value:uint):void
+               {
+                IColorModel(model).color = value;
+               }
+
+               /**
+                *  dispatch change event in response to a colorChange event
+                *
+                *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+                */
+               public function textChangeHandler(event:Event):void
+               {
+                       dispatchEvent(new Event(Event.CHANGE));
+               }
+
+       }
+}
diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/ColorSpectrum.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/ColorSpectrum.as
new file mode 100644
index 0000000..e952b6e
--- /dev/null
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/ColorSpectrum.as
@@ -0,0 +1,82 @@
+
+//
+//  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 org.apache.royale.html
+{
+       import org.apache.royale.core.IColorModel;
+       import org.apache.royale.core.UIBase;
+       import org.apache.royale.events.Event;
+
+       /**
+     *  Dispatched when the user changes the color.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.9.6
+     */
+       [Event(name="change", type="org.apache.royale.events.Event")]
+
+    /**
+        *  The ColorSpectrum class is use in a ColorPicker. It defines a base 
color and the spectrum of colors around it,
+        *  ranging from black to transparent, and from that base color to 
white.
+     *
+     *  @toplevel
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.9.6
+     */
+       public class ColorSpectrum extends UIBase
+       {
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+               public function ColorSpectrum()
+               {
+                       super();
+                       model.addEventListener("textChange", textChangeHandler);
+               }
+
+        /**
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+               [Bindable(event="change")]
+               public function get color():uint
+               {
+                       return IColorModel(model).color;
+               }
+
+        /**
+         *  @private
+         */
+               public function set color(value:uint):void
+               {
+                       IColorModel(model).text = value;
+               }
+       }
+}
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IColorModel.as
 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IColorModel.as
new file mode 100644
index 0000000..3af4cdb
--- /dev/null
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IColorModel.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.core
+{
+    /**
+     *  The ITextModel interface describes the minimum set of properties
+     *  available to a control that displays or edits color.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.9.6
+     */
+       public interface ICOlorModel extends IBeadModel
+       {
+        /**
+         *  The color displayed in the control.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.6
+         */
+        function get color():uint;
+        function set color(value:uint):void;
+               
+       }
+}

Reply via email to