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