[macro] added @:view macro, refactored @:template macro
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user