add Color abstract

This commit is contained in:
2019-03-11 17:02:34 +03:00
parent 8c0991adb0
commit 62ddbb683e
16 changed files with 196 additions and 153 deletions

View File

@@ -1,5 +1,5 @@
---
skin: $r:skin:background
skinId: background
geometry.size.stretch: true
views:
- $type: haxework.gui.ImageView
@@ -15,25 +15,25 @@ views:
views:
- id: list_form
$type: haxework.gui.ToggleButtonView
skin: $r:skin:tab
skinId: tab
geometry.padding: [25, 8]
text: List
+onPress: "$code:switcher.change('list_form')"
- id: tail_form
$type: haxework.gui.ToggleButtonView
skin: $r:skin:tab
skinId: tab
geometry.padding: [25, 8]
text: Tail
+onPress: "$code:switcher.change('tail_form')"
- id: data_form
$type: haxework.gui.ToggleButtonView
skin: $r:skin:tab
skinId: tab
geometry.padding: [25, 8]
text: Data
+onPress: "$code:switcher.change('data_form')"
- id: switcher
$type: haxework.gui.frame.FrameSwitcher
skin: $r:skin:panel
skinId: panel
animateFactory: { $class: haxework.animate.SlideAnimate }
+onSwitch: $this:onFrameSwitch
geometry.size.stretch: true
@@ -41,15 +41,15 @@ views:
views:
- id: list_form
$type: demo.form.ListForm
skin: $r:skin:background
skinId: background
geometry.size.stretch: true
- id: tail_form
$type: demo.form.TailForm
skin: $r:skin:background
skinId: background
geometry.size.stretch: true
- id: data_form
$type: demo.form.DataForm
skin: $r:skin:background
skinId: background
geometry.size.stretch: true
- $type: haxework.gui.HGroupView
geometry.size.percent.width: 100
@@ -58,7 +58,7 @@ views:
views:
- $type: haxework.gui.ButtonView
geometry.padding: [25, 8]
skin: $r:skin:button
skinId: button
text: Color
+onPress: "$code:choiceColor()"
# separator
@@ -66,14 +66,14 @@ views:
geometry.size.stretch: true
- $type: haxework.gui.ButtonView
geometry.padding: [25, 8]
skin: $r:skin:button
skinId: button
text: OK
- $type: haxework.gui.ButtonView
geometry.padding: [25, 8]
skin: $r:skin:button
skinId: button
text: Apply
- $type: haxework.gui.ButtonView
geometry.padding: [25, 8]
skin: $r:skin:button
skinId: button
text: Cancel
+onPress: "$code:flash.system.System.exit(0)"

View File

@@ -1,9 +1,7 @@
package demo;
import haxework.gui.utils.ColorUtils;
import haxework.gui.list.ScrollBarSkin;
import haxework.color.ColorUtil;
import haxework.resources.IResources;
import haxework.gui.skin.ISkin;
import haxework.gui.skin.Skin;
import haxework.gui.skin.TextSkin;
@@ -12,39 +10,23 @@ class Theme {
@:provide static var resources:IResources;
public static function setColor(color:Int, textColor:Int = 0xffffff):Void {
var text:ISkin<Dynamic> = new TextSkin(textColor, 16, "Courirer");
var background = Skin.color(0x00000);
var button:SkinSet = [
Skin.buttonColor(color),
text,
];
var tab:SkinSet = [
Skin.tabColor(color),
text,
];
var view:SkinSet = [
Skin.color(color),
Skin.border(textColor),
text,
];
var scroll:SkinSet = [
ScrollBarSkin.vertical(color, ColorUtils.diff(color, 128)),
];
var border = Skin.border(ColorUtils.multiply(color, 1.5), 1, 2);
var text = new TextSkin(textColor, 16, "Courirer");
var background = Skin.color(0x000000);
var border = Skin.border(ColorUtil.multiply(color, 1.5), 1, 2);
resources.skin.put("text0", [
Skin.color(ColorUtils.diff(color, 128)),
new TextSkin(ColorUtils.diff(color, -128), 16, "Courirer"),
Skin.color(ColorUtil.diff(color, 128)),
new TextSkin(ColorUtil.diff(color, -128), 16, "Courirer"),
]);
resources.skin.put("text1", [
Skin.color(ColorUtils.diff(color, 64)),
new TextSkin(ColorUtils.diff(color, -128), 16, "Courirer"),
Skin.color(ColorUtil.diff(color, 64)),
new TextSkin(ColorUtil.diff(color, -128), 16, "Courirer"),
]);
resources.skin.put("text", resources.skin.get("text0"));
resources.skin.put("background", [background]);
resources.skin.put("button", button);
resources.skin.put("tab", tab);
resources.skin.put("view", view);
resources.skin.put("scroll", scroll);
resources.skin.put("button", [Skin.buttonColor(color), text]);
resources.skin.put("tab", [Skin.tabColor(color), text]);
resources.skin.put("view", [Skin.color(color), border, text]);
resources.skin.put("scroll", [Skin.scrollVertical(color, ColorUtil.diff(color, 128))]);
resources.skin.put("border", [border]);
resources.skin.put("panel", [background, border]);
}

View File

@@ -1,5 +1,4 @@
---
skin: $r:skin:background
views:
- $type: haxework.gui.ScrollView
geometry.size.stretch: true
@@ -13,4 +12,4 @@ views:
data: $r:any:data
scroll:
$type: haxework.gui.list.VScrollBarView
skin: $r:skin:scroll
skinId: scroll

View File

@@ -7,7 +7,5 @@ views:
geometry.size.stretch: true
scroll:
$type: haxework.gui.list.VScrollBarView
skin: $r:skin:scroll
geometry.size.height: 100%
geometry.size.width: 10
skinId: scroll
data: $r:any:data50

View File

@@ -13,4 +13,4 @@ views:
data: $r:any:data
scroll:
$type: haxework.gui.list.VScrollBarView
skin: $r:skin:scroll
skinId: scroll