[macro] update template parser

This commit is contained in:
2019-02-07 12:24:13 +03:00
parent 9182210001
commit eeb659622c
7 changed files with 74 additions and 69 deletions

View File

@@ -21,6 +21,14 @@ class FormView extends VGroupView {
trace("init");
list.data = [for (i in 0...100) StringTools.hex(Math.floor(Math.random() * 1e9))];
}
private function onPress(view:ButtonView):Void {
trace('onPress: ${view.id}');
}
private function onItemSelect(item:IListItemView<String>):Void {
trace('onItemSelect: ${item.data}');
}
}
class ViewExample {
@@ -36,17 +44,5 @@ class ViewExample {
trace(form.button1);
trace(form.button2);
trace(form.button3);
form.button1.onPress.connect(onPress);
form.button2.onPress.connect(onPress);
form.button3.onPress.connect(onPress);
form.list.onItemSelect.connect(onItemSelect);
}
private function onPress(view:ButtonView):Void {
trace('onPress: ${view.id}');
}
private function onItemSelect(item:IListItemView<String>):Void {
trace('onItemSelect: ${item.data}');
}
}

View File

@@ -2,30 +2,27 @@
$type: haxework.gui.VGroupView
paddings: 20
layoutMargin: 10
# skin:
# $type: haxework.gui.skin.ColorSkin
# color: 0xff0000
skin: [ $type: [haxework.gui.skin.Skin.color, 0xff0000] ]
views:
- id: list
$type: haxework.gui.list.VListView<String>
factory: $class:haxework.gui.list.LabelListItem
+onItemSelect: $this:onItemSelect
factory: { $class: haxework.gui.list.LabelListItem }
pWidth: 100
pHeight: 100
leftMargin: 5
rightMargin: 10
scroll:
$type: haxework.gui.list.VScrollView
width: 10
pHeight: 100
skin: [ "$class:haxework.gui.list.ScrollSkin.vertical(0xcccccc,0x555555)" ]
skin: [$class:haxework.gui.skin.Skin.color(0xffffff)]
skin: [ $type: [haxework.gui.list.ScrollSkin.vertical, 0xcffcc, 0x55cc55] ]
skin: [ $type: [haxework.gui.skin.Skin.color, 0xffffff] ]
- $type: haxework.gui.SpriteView
vAlign: BOTTOM
width: 50
height: 50
leftMargin: 5
rightMargin: 10
skin: [$class:haxework.gui.skin.Skin.color(0x0000ff)]
skin: [ $type: [haxework.gui.skin.Skin.color, 0x0000ff] ]
- id: panel
$type: haxework.gui.HGroupView
layoutHAlign: RIGHT
@@ -33,32 +30,28 @@ views:
height: 30
paddings: 3
layoutMargin: 3
skin: [$class:haxework.gui.skin.Skin.color(0xffff00)]
skin: [ $type: [haxework.gui.skin.Skin.color, 0xffff00] ]
views:
- id: button1
$type: haxework.gui.ButtonView
+onPress: $this:onPress
width: 100
pHeight: 100
skin: [$class:haxework.gui.skin.ButtonSkin.color(0xcc0000)]
# skin:
# $type: haxework.gui.skin.ButtonColorSkin
# color: 0xcc0000
skin: [ $type: [haxework.gui.skin.ButtonSkin.color, 0xcc0000] ]
text: Text1
- id: button2
$type: haxework.gui.ButtonView
+onPress: $this:onPress
contentSize: true
# skin:
# $type: haxework.gui.skin.ButtonColorSkin
# color: 0x00cc00
skin: [ $type: [haxework.gui.skin.ButtonSkin.color, 0x00cc00] ]
text: Text2
fontFamily: Georgia
fontColor: 0xffffff
- id: button3
$type: haxework.gui.ButtonView
+onPress: $this:onPress
contentSize: true
# skin:
# $type: haxework.gui.skin.ButtonColorSkin
# color: 0x00cccc
skin: [ $type: [haxework.gui.skin.ButtonSkin.color, 0x00cccc] ]
text: Text 3333333333 ddd
fontFamily: Tahoma
fontColor: 0xff0000