[view] add ConfirmView

This commit is contained in:
2020-02-07 17:02:56 +03:00
parent a311dc1c19
commit 284593e82c
2 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package haxework.view.popup;
import haxework.view.form.LabelView;
import haxework.view.text.TextView;
import promhx.Promise;
@:template class ConfirmView extends PopupView<Bool> {
@:view var header:LabelView;
@:view var message:TextView;
public function new() {
super();
}
public static function confirm(message:String):Promise<Bool> {
var result = new ConfirmView();
result.message.text = message;
return result.show();
}
}

View File

@@ -0,0 +1,34 @@
---
view:
$type: haxework.view.group.VGroupView
geometry.width: 400
geometry.height: 200
geometry.padding: 10
geometry.hAlign: center
geometry.vAlign: middle
style: frame
views:
- $type: haxework.view.group.HGroupView
geometry.width: 100%
layout.margin: 10
views:
- id: header
$type: haxework.view.form.LabelView
- id: message
$type: haxework.view.form.LabelView
font.align: CENTER
layout.hAlign: center
layout.vAlign: middle
geometry.width: 100%
geometry.height: 100%
- $type: haxework.view.group.HGroupView
geometry.width: 100%
layout.hAlign: center
layout.margin: 10
views:
- $type: haxework.view.form.ButtonView
text: Yes
+onPress: ~close(true)
- $type: haxework.view.form.ButtonView
text: No
+onPress: ~reject('no')