added popupmanager & animates

This commit is contained in:
2015-06-30 11:11:10 +03:00
parent 462ee023c3
commit 38ceb7eecb
10 changed files with 240 additions and 37 deletions

58
haxework/gui/popup/PopupView.hx Executable file
View File

@@ -0,0 +1,58 @@
package haxework.gui.popup;
import haxework.net.callback.Callback;
import haxework.net.callback.ICallback;
import haxe.Timer;
import haxework.provider.Provider;
import haxework.dispath.Dispatcher;
import haxework.dispath.IDispatcher;
import haxework.gui.IGroupView;
import haxework.gui.ButtonView;
import haxework.gui.skin.ColorSkin;
import haxework.gui.GuiBuilder;
import haxework.gui.GroupView;
class PopupView extends GroupView {
private var buttonId:String;
private var contentView:IGroupView<Dynamic>;
private var callback:ICallback<String>;
public function new(resource:String, ?key:String = null) {
super();
pWidth = 100;
pHeight = 100;
inLayout = false;
skin = new ColorSkin(0x000000, 0.6);
contentView = GuiBuilder.buildFromAssets(resource, key, {listener:this});
addView(contentView);
}
public function onPress(button:ButtonView) {
this.buttonId = button.id;
close();
}
public function show():ICallback<String> {
Provider.get(PopupManager).show(this);
callback = Callback.build();
return callback;
}
public function close():Void {
Provider.get(PopupManager).close(this);
}
public function onShow():Void {
buttonId = "close";
}
public function onClose():Void {
if (callback != null) {
callback.callSuccess(buttonId);
callback = null;
}
}
}