[macro] add StyleMacro

This commit is contained in:
2019-07-16 11:44:32 +03:00
parent 5faa179116
commit d52d8ff4f3
26 changed files with 373 additions and 91 deletions

View File

@@ -9,18 +9,16 @@ import haxework.view.geometry.SizeSet;
import haxework.view.group.IGroupView;
import haxework.view.skin.ISkin;
import haxework.view.theme.ITheme;
import haxework.view.theme.StyleId;
class View<C:DisplayObject> implements IView<C> {
@:style class View<C:DisplayObject> implements IView<C> {
private static var counter:Int = 0;
public static var updater(default, null):ViewUpdater = new ViewUpdater();
@:provide var theme:ITheme;
public var geometry(default, default):Geometry;
public var skin(default, set):ISkin<Dynamic>;
public var style(default, set):StyleId;
@:style public var geometry(default, default):Geometry;
@:style public var skin(default, default):ISkin<Dynamic>;
public var id(default, default):String;
@@ -56,7 +54,11 @@ class View<C:DisplayObject> implements IView<C> {
geometry = new Geometry();
visible = true;
index = -1;
skin = null;
}
private function onStyle():Void {
toUpdate();
toRedraw();
}
public function toRedraw():Void {
@@ -118,22 +120,13 @@ class View<C:DisplayObject> implements IView<C> {
return y;
}
private function set_skin(value:ISkin<Dynamic>):ISkin<Dynamic> {
// ToDo:
/*private function set_skin(value:ISkin<Dynamic>):ISkin<Dynamic> {
this.skin = value;
toRedraw();
return this.skin;
}
private function set_style(value:StyleId):StyleId {
if (value != null && style != value) {
style = value;
if (theme != null) {
theme.bind(style, this);
}
}
return style;
}
*/
private function set_visible(value:Bool):Bool {
if (visible != value) {
visible = value;