mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
add dialog_info/warn/confirm/toast fscript wrapper
This commit is contained in:
parent
a7b1272d19
commit
d997d4ad2c
@ -46,6 +46,10 @@
|
||||
text="Choose File Save"/>
|
||||
<button focusable="true" on:click="var file=choose_folder('./');print(file)"
|
||||
text="Choose Folder"/>
|
||||
<button focusable="true" on:click="var ret = dialog_info('awtk','hello');print(ret)" text="Info"/>
|
||||
<button focusable="true" on:click="var ret = dialog_warn('awtk','hello');print(ret)" text="Warn"/>
|
||||
<button focusable="true" on:click="var ret = dialog_confirm('awtk','hello');print(ret)" text="Confirm"/>
|
||||
<button focusable="true" on:click="var ret = dialog_toast('awtk',2000);print(ret)" text="Toast"/>
|
||||
<button focusable="true" on:click="quit()" text="Quit"/>
|
||||
</view>
|
||||
</window>
|
||||
|
@ -1,7 +1,9 @@
|
||||
# 最新动态
|
||||
|
||||
2022/07/20
|
||||
* add fscript wrapper for file dialog
|
||||
* 增加文件选择对话框的函数。
|
||||
* 增加文件选择对话框的函数的fscript包装。
|
||||
* 增加了dialog_info/warn/confirm/toast等函数的fscript包装。
|
||||
|
||||
2022/07/19
|
||||
* 完善demoui的字符串(感谢兆坤提供补丁)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "base/main_loop.h"
|
||||
#include "base/window.h"
|
||||
#include "base/locale_info.h"
|
||||
#include "base/dialog.h"
|
||||
#include "base/object_widget.h"
|
||||
#include "base/widget_factory.h"
|
||||
#include "base/window_manager.h"
|
||||
@ -695,6 +696,30 @@ static ret_t func_choose_file_for_save(fscript_t* fscript, fscript_args_t* args,
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_dialog_info(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 2, RET_BAD_PARAMS);
|
||||
value_set_bool(result, dialog_info(value_str(args->args), value_str(args->args + 1)) == RET_OK);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_dialog_warn(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 2, RET_BAD_PARAMS);
|
||||
value_set_bool(result, dialog_warn(value_str(args->args), value_str(args->args + 1)) == RET_OK);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_dialog_confirm(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 2, RET_BAD_PARAMS);
|
||||
value_set_bool(result, dialog_confirm(value_str(args->args), value_str(args->args + 1)) == RET_OK);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t func_dialog_toast(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 2, RET_BAD_PARAMS);
|
||||
value_set_bool(result, dialog_toast(value_str(args->args), value_uint32(args->args + 1)) == RET_OK);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
FACTORY_TABLE_BEGIN(s_ext_widget)
|
||||
FACTORY_TABLE_ENTRY("open", func_window_open)
|
||||
FACTORY_TABLE_ENTRY("close", func_window_close)
|
||||
@ -740,6 +765,10 @@ FACTORY_TABLE_ENTRY("choose_files", func_choose_files)
|
||||
FACTORY_TABLE_ENTRY("choose_file", func_choose_file)
|
||||
FACTORY_TABLE_ENTRY("choose_folder", func_choose_folder)
|
||||
FACTORY_TABLE_ENTRY("choose_file_for_save", func_choose_file_for_save)
|
||||
FACTORY_TABLE_ENTRY("dialog_info", func_dialog_info)
|
||||
FACTORY_TABLE_ENTRY("dialog_warn", func_dialog_warn)
|
||||
FACTORY_TABLE_ENTRY("dialog_confirm", func_dialog_confirm)
|
||||
FACTORY_TABLE_ENTRY("dialog_toast", func_dialog_toast)
|
||||
|
||||
FACTORY_TABLE_END()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user