[macro] added @:view macro, refactored @:template macro

This commit is contained in:
2018-03-06 15:44:07 +03:00
parent 4a65cef02a
commit a53510d1d4
11 changed files with 243 additions and 198 deletions

View File

@@ -1,29 +1,39 @@
package;
import haxework.gui.ViewBuilder;
import haxework.gui.View;
import haxework.gui.VGroupView;
import haxework.gui.ButtonView;
import haxework.gui.Root;
@:template("form.json")
class FormView extends VGroupView implements ViewBuilder {}
@:template2("form.json")
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;
private function init() {
trace('Init');
}
}
class ViewExample {
public static function main() {
new ViewExample();
}
public static function main() {
new ViewExample();
}
public function new() {
var form = new FormView({listener:this});
Root.bind(form);
trace(form.panel);
trace(form.button1);
trace(form.button2);
trace(form.button3);
}
public function new() {
var form:FormView = new FormView();
Root.bind(form);
trace(form.panel);
trace(form.button1);
trace(form.button2);
trace(form.button3);
}
public function onPress(view:ButtonView):Void {
trace("onPress: " + view.id);
}
public function onPress(view:ButtonView):Void {
trace("onPress: " + view.id);
}
}