You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/03/03 11:37:42 UTC

[royale-asjs] branch develop updated: jewel iconbutton: set icon to the left or right position

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 96f6643  jewel iconbutton: set icon to the left or right position
96f6643 is described below

commit 96f6643c158f8f219bf74f9e5fd7a6f488cd4d32
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Mar 3 12:37:35 2019 +0100

    jewel iconbutton: set icon to the left or right position
---
 .../royale/org/apache/royale/jewel/IconButton.as   | 36 +++++++++++++++++++---
 .../org/apache/royale/jewel/IconTextInput.as       |  2 +-
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
index 49c3146..a6ce7b2 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconButton.as
@@ -103,11 +103,7 @@ package org.apache.royale.jewel
 
             toggleClass(iconClass, (_icon != null));
             
-            COMPILE::JS
-            {
-                // insert the icon before the text
-                addElementAt(_icon, 0);
-            }
+            setIconPosition();
 
             COMPILE::SWF
             {
@@ -116,6 +112,36 @@ package org.apache.royale.jewel
             }
         }
 
+        private var _rightPosition:Boolean;
+        /**
+		 *  icon's position regarding the text content 
+         *  Can be false ("left") or true ("right"). defaults to false ("left")
+         *  Optional
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.6
+		 */
+        public function get rightPosition():Boolean
+        {
+            return _rightPosition;
+        }
+        public function set rightPosition(value:Boolean):void
+        {
+            _rightPosition = value;
+            if(_icon)
+                setIconPosition();
+        }
+        
+        public function setIconPosition():void
+        {
+            COMPILE::JS
+            {
+            addElementAt(_icon, rightPosition? numElements : 0);
+            }
+        }
+
         /**
 		 * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 		 * @royaleignorecoercion org.apache.royale.html.util.addElementToWrapper
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconTextInput.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconTextInput.as
index b9ae3a7..7e550de 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconTextInput.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/IconTextInput.as
@@ -86,7 +86,7 @@ package org.apache.royale.jewel
         private var _rightPosition:Boolean;
         /**
 		 *  icon's position regarding the text content 
-         *  Can be "left" or "right". defaults to "left"
+         *  Can be false ("left") or true ("right"). defaults to false ("left")
          *  Optional
 		 *
 		 *  @langversion 3.0