This commit is contained in:
3wc 2023-07-30 23:09:48 +01:00
parent 17b1273c6e
commit e4552b8213

View File

@ -1,39 +1,35 @@
@:uiComp("view")
// Naming scheme of component classes can be customized with domkit.Macros.registerComponentsPath();
class ViewComp extends h2d.Flow implements h2d.domkit.Object {
static var SRC =
<view class="mybox" min-width="200" content-halign={align}>
static var SRC = <view class="mybox" min-width="200" content-halign={align}>
<text text={"Rewild"}/>
for( i in icons )
<bitmap src={i} id="icons[]"/>
</view>;
public function new(align:h2d.Flow.FlowAlign,icons:Array<h2d.Tile>,?parent) {
public function new(align:h2d.Flow.FlowAlign, icons:Array<h2d.Tile>, ?parent) {
super(parent);
initComponent();
}
}
@:uiComp("button")
class ButtonComp extends h2d.Flow implements h2d.domkit.Object {
static var SRC = <button>
<text public id="labelTxt" />
</button>
public var label(get, set): String;
function get_label() return labelTxt.text;
public var label(get, set):String;
function get_label()
return labelTxt.text;
function set_label(s) {
labelTxt.text = s;
return s;
}
public function new( ?parent ) {
public function new(?parent) {
super(parent);
initComponent();
enableInteractive = true;
@ -52,13 +48,11 @@ class ButtonComp extends h2d.Flow implements h2d.domkit.Object {
};
}
public dynamic function onClick() {
}
public dynamic function onClick() {}
}
@:uiComp("container")
class ContainerComp extends h2d.Flow implements h2d.domkit.Object {
static var SRC = <container>
<view(align,[]) id="view"/>
<button public id="btn"/>
@ -70,14 +64,11 @@ class ContainerComp extends h2d.Flow implements h2d.domkit.Object {
super(parent);
initComponent();
}
}
//PARAM=-lib domkit
// PARAM=-lib domkit
class Main extends hxd.App {
var center : h2d.Flow;
var center:h2d.Flow;
var style = null;
override function init() {
@ -122,6 +113,4 @@ class Main extends hxd.App {
#end
new Main();
}
}