[gui] udpate skins and dispatchers
This commit is contained in:
@@ -5,5 +5,6 @@
|
||||
-main ViewExample.hx
|
||||
--macro haxework.parser.Parser.auto()
|
||||
|
||||
-swf-header 800:600:30:000000
|
||||
-swf target/ViewExample.swf
|
||||
#-as3 target
|
||||
#-as3 target
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
package;
|
||||
|
||||
import haxework.gui.View;
|
||||
import flash.display.Sprite;
|
||||
import haxework.gui.list.ListView.IListItemView;
|
||||
import haxework.gui.list.VListView;
|
||||
import haxework.gui.IView;
|
||||
import haxework.gui.VGroupView;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.Root;
|
||||
|
||||
|
||||
@:template2("form.json")
|
||||
@:template("form.yaml")
|
||||
class FormView extends VGroupView {
|
||||
@:view public var panel(default, null):View;
|
||||
@:view public var button1(default, null):View;
|
||||
@:view public var button2(default, null):View;
|
||||
@:view public var button3(default, null):View;
|
||||
@:view public var list(default, null):VListView<String>;
|
||||
@:view public var panel(default, null):IView<Sprite>;
|
||||
@:view public var button1(default, null):ButtonView;
|
||||
@:view public var button2(default, null):ButtonView;
|
||||
@:view public var button3(default, null):ButtonView;
|
||||
|
||||
private function init() {
|
||||
trace('Init');
|
||||
trace("init");
|
||||
list.data = [for (i in 0...100) StringTools.hex(Math.floor(Math.random() * 1e9))];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +36,17 @@ 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);
|
||||
}
|
||||
|
||||
public function onPress(view:ButtonView):Void {
|
||||
trace("onPress: " + view.id);
|
||||
private function onPress(view:ButtonView):Void {
|
||||
trace('onPress: ${view.id}');
|
||||
}
|
||||
}
|
||||
|
||||
private function onItemSelect(item:IListItemView<String>):Void {
|
||||
trace('onItemSelect: ${item.data}');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
{
|
||||
"@type":"haxework.gui.VGroupView",
|
||||
"paddings":20,
|
||||
"layoutMargin":10,
|
||||
"skin":{"@type":"haxework.gui.skin.ColorSkin", "color":"0xff0000"},
|
||||
"views":[
|
||||
{
|
||||
"@type":"haxework.gui.SpriteView",
|
||||
"pWidth":100,
|
||||
"pHeight":100,
|
||||
"leftMargin":5,
|
||||
"rightMargin":10,
|
||||
"skin":{"@type":"haxework.gui.skin.ColorSkin", "color":"0x00ff00"}
|
||||
},
|
||||
{
|
||||
"@type":"haxework.gui.SpriteView",
|
||||
"vAlign":"BOTTOM",
|
||||
"width":50,
|
||||
"height":50,
|
||||
"leftMargin":5,
|
||||
"rightMargin":10,
|
||||
"skin":{"@type":"haxework.gui.skin.ColorSkin", "color":"0x0000ff"}
|
||||
},
|
||||
{
|
||||
"id":"panel",
|
||||
"@type":"haxework.gui.HGroupView",
|
||||
"layoutHAlign":"RIGHT",
|
||||
"pWidth":100,
|
||||
"height":30,
|
||||
"paddings":3,
|
||||
"layoutMargin":3,
|
||||
"skin":{"@type":"haxework.gui.skin.ColorSkin", "color":"0xffff00"},
|
||||
"views":[
|
||||
{
|
||||
"id":"button1",
|
||||
"@type":"haxework.gui.ButtonView",
|
||||
"width":100,
|
||||
"pHeight":100,
|
||||
"skin":{"@type":"haxework.gui.skin.ButtonColorSkin", "color":"0xcc0000"},
|
||||
"text":"Text1"
|
||||
},
|
||||
{
|
||||
"id":"button2",
|
||||
"@type":"haxework.gui.ButtonView",
|
||||
"contentSize":true,
|
||||
"skin":{"@type":"haxework.gui.skin.ButtonColorSkin", "color":"0x00cc00"},
|
||||
"text":"Text2",
|
||||
"fontFamily":"Georgia",
|
||||
"fontColor":"0xffffff"
|
||||
},
|
||||
{
|
||||
"id":"button3",
|
||||
"@type":"haxework.gui.ButtonView",
|
||||
"contentSize":true,
|
||||
"skin":{"@type":"haxework.gui.skin.ButtonColorSkin", "color":"0x00cccc"},
|
||||
"text":"Text 3333333333 ddd",
|
||||
"fontFamily":"Tahoma",
|
||||
"fontColor":"0xff0000"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
64
samples/01-view/src/form.yaml
Normal file
64
samples/01-view/src/form.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
$type: haxework.gui.VGroupView
|
||||
paddings: 20
|
||||
layoutMargin: 10
|
||||
# skin:
|
||||
# $type: haxework.gui.skin.ColorSkin
|
||||
# color: 0xff0000
|
||||
views:
|
||||
- id: list
|
||||
$type: haxework.gui.list.VListView<String>
|
||||
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)]
|
||||
- $type: haxework.gui.SpriteView
|
||||
vAlign: BOTTOM
|
||||
width: 50
|
||||
height: 50
|
||||
leftMargin: 5
|
||||
rightMargin: 10
|
||||
skin: [$class:haxework.gui.skin.Skin.color(0x0000ff)]
|
||||
- id: panel
|
||||
$type: haxework.gui.HGroupView
|
||||
layoutHAlign: RIGHT
|
||||
pWidth: 100
|
||||
height: 30
|
||||
paddings: 3
|
||||
layoutMargin: 3
|
||||
skin: [$class:haxework.gui.skin.Skin.color(0xffff00)]
|
||||
views:
|
||||
- id: button1
|
||||
$type: haxework.gui.ButtonView
|
||||
width: 100
|
||||
pHeight: 100
|
||||
skin: [$class:haxework.gui.skin.ButtonSkin.color(0xcc0000)]
|
||||
# skin:
|
||||
# $type: haxework.gui.skin.ButtonColorSkin
|
||||
# color: 0xcc0000
|
||||
text: Text1
|
||||
- id: button2
|
||||
$type: haxework.gui.ButtonView
|
||||
contentSize: true
|
||||
# skin:
|
||||
# $type: haxework.gui.skin.ButtonColorSkin
|
||||
# color: 0x00cc00
|
||||
text: Text2
|
||||
fontFamily: Georgia
|
||||
fontColor: 0xffffff
|
||||
- id: button3
|
||||
$type: haxework.gui.ButtonView
|
||||
contentSize: true
|
||||
# skin:
|
||||
# $type: haxework.gui.skin.ButtonColorSkin
|
||||
# color: 0x00cccc
|
||||
text: Text 3333333333 ddd
|
||||
fontFamily: Tahoma
|
||||
fontColor: 0xff0000
|
||||
3
samples/01-view/test.sh
Normal file
3
samples/01-view/test.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
. /opt/sdk/haxe/3.4.7/activate
|
||||
haxe build.hxml && flashplayerdebugger target/ViewExample.swf
|
||||
Reference in New Issue
Block a user