diff --git a/haxework/gui/ButtonView.hx b/haxework/gui/ButtonView.hx index b7bffce..23e138a 100755 --- a/haxework/gui/ButtonView.hx +++ b/haxework/gui/ButtonView.hx @@ -63,7 +63,7 @@ class ButtonView extends LabelView { } private function pressCaller(listener:ButtonViewListener):Void { - listener.onPress(this); + try {listener.onPress(this);} catch (error:Dynamic) L.e("onPress", "", error); } private function set_disabled(value:Bool):Bool { diff --git a/haxework/gui/IView.hx b/haxework/gui/IView.hx index c9a5156..c5e2075 100755 --- a/haxework/gui/IView.hx +++ b/haxework/gui/IView.hx @@ -10,10 +10,12 @@ typedef Content = { var x(default,default):Float; var y(default,default):Float; var visible(default,default):Bool; + var mouseEnabled(default,default):Bool; #else var x(get,set):Float; var y(get,set):Float; var visible(get,set):Bool; + var mouseEnabled(get,set):Bool; #end } @@ -54,6 +56,7 @@ interface IView { public var visible(default, set):Bool; public var index(default, set):Int; + public var mouseEnabled(default, set):Bool; public function update():Void; public function invalidate():Void; diff --git a/haxework/gui/TextView.hx b/haxework/gui/TextView.hx index 84e8260..bce5a5f 100755 --- a/haxework/gui/TextView.hx +++ b/haxework/gui/TextView.hx @@ -184,4 +184,8 @@ class TextView extends SpriteView implements ITextView { } } + override private function set_mouseEnabled(value:Bool):Bool { + textField.mouseEnabled = value; + return super.set_mouseEnabled(value); + } } diff --git a/haxework/gui/View.hx b/haxework/gui/View.hx index 84a901a..2979016 100755 --- a/haxework/gui/View.hx +++ b/haxework/gui/View.hx @@ -53,6 +53,7 @@ class View implements IView { public var visible(default, set):Bool; public var index(default, set):Int; + public var mouseEnabled(default, set):Bool = true; public function new(content:C) { id = Type.getClassName(Type.getClass(this)) + counter++; @@ -271,6 +272,14 @@ class View implements IView { } return index; } + + private function set_mouseEnabled(value:Bool):Bool { + if (mouseEnabled != value) { + mouseEnabled = value; + if (content != null) content.mouseEnabled = mouseEnabled; + } + return mouseEnabled; + } } diff --git a/haxework/gui/layout/DefaultLayout.hx b/haxework/gui/layout/DefaultLayout.hx index fb753ed..e75c1d4 100755 --- a/haxework/gui/layout/DefaultLayout.hx +++ b/haxework/gui/layout/DefaultLayout.hx @@ -36,12 +36,16 @@ class DefaultLayout implements ILayout { private function setViewWidth(group:IGroupView, view:IView):Void { if (view.widthType == SizeType.PERCENT) { view.w = view.pWidth / 100 * (group.width - view.leftMargin - view.rightMargin - group.leftPadding - group.rightPadding); + } else if (group.contentSize && group.width < view.width) { + group.width = view.width; } } private function setViewHeight(group:IGroupView, view:IView):Void { if (view.heightType == SizeType.PERCENT) { view.h = view.pHeight / 100 * (group.height - view.topMargin - view.bottomMargin - group.topPadding - group.bottomPadding); + } else if (group.contentSize && group.height < view.height) { + group.height = view.height; } } diff --git a/haxework/gui/layout/HorizontalLayout.hx b/haxework/gui/layout/HorizontalLayout.hx index d7931d1..9ffd73a 100755 --- a/haxework/gui/layout/HorizontalLayout.hx +++ b/haxework/gui/layout/HorizontalLayout.hx @@ -28,7 +28,7 @@ class HorizontalLayout extends DefaultLayout { } if (group.contentSize) { - group.width = fixedSize + group.leftPadding + group.rightPadding; + group.width = Math.max(group.width, fixedSize + group.leftPadding + group.rightPadding); group.height = maxHeight + group.topPadding + group.bottomPadding; } diff --git a/haxework/gui/layout/VerticalLayout.hx b/haxework/gui/layout/VerticalLayout.hx index c654aac..a98aed1 100755 --- a/haxework/gui/layout/VerticalLayout.hx +++ b/haxework/gui/layout/VerticalLayout.hx @@ -28,7 +28,7 @@ class VerticalLayout extends DefaultLayout { if (group.contentSize) { group.width = maxWidth + group.leftPadding + group.rightPadding; - group.height = fixedSize + group.topPadding + group.bottomPadding; + group.height = Math.max(group.height, fixedSize + group.topPadding + group.bottomPadding); } leftSize -= fixedSize; diff --git a/haxework/gui/skin/ButtonColorSkin.hx b/haxework/gui/skin/ButtonColorSkin.hx index 5ac92df..4a18bb1 100755 --- a/haxework/gui/skin/ButtonColorSkin.hx +++ b/haxework/gui/skin/ButtonColorSkin.hx @@ -8,11 +8,13 @@ import flash.display.Sprite; class ButtonColorSkin implements ISkin { public var color(default, set_color):Int; + public var alpha(default, default):Float; private var colors:Map; private var disable:Int; - public function new(?color:Int = 0xffffff) { + public function new(?color:Int = 0xffffff, ?alpha:Float = 1.0) { this.color = color; + this.alpha = alpha; } private function set_color(value:Int):Int { @@ -28,7 +30,7 @@ class ButtonColorSkin implements ISkin { var color:Int = view.disabled ? disable : colors.get(view.state); var graphics:Graphics = view.content.graphics; graphics.clear(); - graphics.beginFill(color); + graphics.beginFill(color, alpha); graphics.drawRect(0, 0, view.width, view.height); graphics.endFill(); } diff --git a/haxework/net/order/OrderSupplier.hx b/haxework/net/order/OrderSupplier.hx index 1f246e8..54abfa9 100755 --- a/haxework/net/order/OrderSupplier.hx +++ b/haxework/net/order/OrderSupplier.hx @@ -77,7 +77,7 @@ class OrderSupplier implements IOrderSupplier { var c:Class = clazz; return if (c == BitmapData) { var loader:ILoader = untyped new ImageLoader(); - loader.timeout = 5000; //ToDo: hardcode timeout for loading images + loader.timeout = 7000; //ToDo: hardcode timeout for loading images loader; } else { throw "Unsupported order: " + c;