This is an automated email from the ASF dual-hosted git repository.
Harbs 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 f60cf77a44 Add selected property
f60cf77a44 is described below
commit f60cf77a44ce2394e3d41043997c8f470eefa40b
Author: Harbs <[email protected]>
AuthorDate: Tue May 19 12:22:11 2026 +0300
Add selected property
---
.../royale/org/apache/royale/style/IconButton.as | 41 +++++++++++++++++++++-
1 file changed, 40 insertions(+), 1 deletion(-)
diff --git
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IconButton.as
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IconButton.as
index c278f0f91e..020ca4a56a 100644
---
a/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IconButton.as
+++
b/frameworks/projects/Style/src/main/royale/org/apache/royale/style/IconButton.as
@@ -49,7 +49,11 @@ package org.apache.royale.style
{
return element as HTMLButtonElement;
}
-
+ /**
+ * Whether the button is disabled
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
public function get disabled():Boolean
{
COMPILE::SWF
@@ -78,6 +82,11 @@ package org.apache.royale.style
private var _icon:IIcon;
+ /**
+ * The icon to display in the button. Should be an icon that
can be styled with CSS.
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
public function get icon():IIcon
{
return _icon;
@@ -88,10 +97,40 @@ package org.apache.royale.style
_icon = value;
if(disabled)
_icon.toggleAttribute("data-disabled", true);
+ if(selected)
+ _icon.toggleAttribute("data-selected", true);
}
override protected function getTag():String
{
return "button";
}
+
+ private var _selected:Boolean;
+ /**
+ * Whether the button is selected.
+ * This is a separate state from "disabled" and can be used to
indicate an active or toggled state for the button.
+ * @langversion 3.0
+ * @productversion Royale 1.0.0
+ */
+ public function get selected():Boolean
+ {
+ return _selected;
+ }
+
+ public function set selected(value:Boolean):void
+ {
+ if(value != _selected)
+ {
+ _selected = value;
+ toggleAttribute("data-selected", value);
+ if (icon)
+ icon.toggleAttribute("data-selected",
value);
+ COMPILE::JS
+ {
+ element.setAttribute("aria-selected",
value ? "true" : "false");
+ }
+ }
+ }
+
}
}