diff --git a/src/main/haxework/view/list/ListView.hx b/src/main/haxework/view/list/ListView.hx index 901b872..be953e8 100755 --- a/src/main/haxework/view/list/ListView.hx +++ b/src/main/haxework/view/list/ListView.hx @@ -180,6 +180,13 @@ class ListView extends GroupView { item.visible = true; item.item_index = index; item.data = filteredData[item.item_index]; + if ( + selected != null && selected.indexOf(item.data) > -1 ? + item.style.add("selected") : + item.style.remove("selected") + ) { + item.style = item.style; + } } } } diff --git a/src/main/haxework/view/theme/StyleId.hx b/src/main/haxework/view/theme/StyleId.hx index 81ed490..ec8928c 100644 --- a/src/main/haxework/view/theme/StyleId.hx +++ b/src/main/haxework/view/theme/StyleId.hx @@ -6,6 +6,18 @@ abstract StyleId(Array) { this = value != null ? value : []; } + public function add(value:String):Bool { + if (this.indexOf(value) == -1) { + this.push(value); + return true; + } + return false; + } + + public inline function remove(value:String):Bool { + return this.remove(value); + } + @:to public inline function toArray():Array { return this; } diff --git a/src/main/haxework/view/theme/Theme.hx b/src/main/haxework/view/theme/Theme.hx index 90c177c..5db1db8 100644 --- a/src/main/haxework/view/theme/Theme.hx +++ b/src/main/haxework/view/theme/Theme.hx @@ -104,6 +104,12 @@ class Theme implements ITheme { register(new Style("text1", [ "skin.background.color" => colors.light.diff(16), ], ["text"])); + register(new Style("text0.selected", [ + "font.color" => colors.active, + ], ["text0"])); + register(new Style("text1.selected", [ + "font.color" => colors.active, + ], ["text1"])); register(new Style("label", [ "geometry.padding" => Box.fromArray([8, 2]), ], ["text"]));