mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-03 18:29:09 +00:00
Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup window, and a `close-to-click` boolean that can be set to false to disable the default behavior.
This commit is contained in:
parent
a0a5294e49
commit
0f54b9599b
20 changed files with 349 additions and 24 deletions
|
@ -39,6 +39,7 @@ pub enum BuiltinFunction {
|
|||
Pow,
|
||||
SetFocusItem,
|
||||
ShowPopupWindow,
|
||||
ClosePopupWindow,
|
||||
/// A function that belongs to an item (such as TextInput's select-all function).
|
||||
ItemMemberFunction(String),
|
||||
/// the "42".to_float()
|
||||
|
@ -123,10 +124,12 @@ impl BuiltinFunction {
|
|||
return_type: Box::new(Type::Void),
|
||||
args: vec![Type::ElementReference],
|
||||
},
|
||||
BuiltinFunction::ShowPopupWindow => Type::Function {
|
||||
return_type: Box::new(Type::Void),
|
||||
args: vec![Type::ElementReference],
|
||||
},
|
||||
BuiltinFunction::ShowPopupWindow | BuiltinFunction::ClosePopupWindow => {
|
||||
Type::Function {
|
||||
return_type: Box::new(Type::Void),
|
||||
args: vec![Type::ElementReference],
|
||||
}
|
||||
}
|
||||
BuiltinFunction::ItemMemberFunction(..) => Type::Function {
|
||||
return_type: Box::new(Type::Void),
|
||||
args: vec![Type::ElementReference],
|
||||
|
@ -225,7 +228,7 @@ impl BuiltinFunction {
|
|||
| BuiltinFunction::Pow
|
||||
| BuiltinFunction::ATan => true,
|
||||
BuiltinFunction::SetFocusItem => false,
|
||||
BuiltinFunction::ShowPopupWindow => false,
|
||||
BuiltinFunction::ShowPopupWindow | BuiltinFunction::ClosePopupWindow => false,
|
||||
BuiltinFunction::ItemMemberFunction(..) => false,
|
||||
BuiltinFunction::StringToFloat | BuiltinFunction::StringIsFloat => true,
|
||||
BuiltinFunction::ColorBrighter
|
||||
|
@ -276,7 +279,7 @@ impl BuiltinFunction {
|
|||
| BuiltinFunction::Pow
|
||||
| BuiltinFunction::ATan => true,
|
||||
BuiltinFunction::SetFocusItem => false,
|
||||
BuiltinFunction::ShowPopupWindow => false,
|
||||
BuiltinFunction::ShowPopupWindow | BuiltinFunction::ClosePopupWindow => false,
|
||||
BuiltinFunction::ItemMemberFunction(..) => false,
|
||||
BuiltinFunction::StringToFloat | BuiltinFunction::StringIsFloat => true,
|
||||
BuiltinFunction::ColorBrighter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue