[view] add ConfirmView
This commit is contained in:
21
src/main/haxework/view/popup/ConfirmView.hx
Normal file
21
src/main/haxework/view/popup/ConfirmView.hx
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/main/haxework/view/popup/ConfirmView.yaml
Normal file
34
src/main/haxework/view/popup/ConfirmView.yaml
Normal 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')
|
||||||
Reference in New Issue
Block a user