mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Add support for select-all(), cut(), copy() and paste() functions on text input elements (#2804)
In the compiler this is still very primitive, but an attempt to start a generic interface. The basic assumption is that all item functions will eventually need access to the window adapter and itemrc. Support for additional arguments is still missing. Also missing is support for the function access via rtti in the interpreter, hence the hardcoding at the moment.
This commit is contained in:
parent
d52f40979c
commit
c428601370
19 changed files with 383 additions and 40 deletions
|
@ -2285,7 +2285,7 @@ fn compile_expression(expr: &llr::Expression, ctx: &EvaluationContext) -> String
|
|||
format!(r#"{}.get()"#, access)
|
||||
}
|
||||
Expression::BuiltinFunctionCall { function, arguments } => {
|
||||
compile_builtin_function_call(*function, arguments, ctx)
|
||||
compile_builtin_function_call(function.clone(), arguments, ctx)
|
||||
}
|
||||
Expression::CallBackCall{ callback, arguments } => {
|
||||
let f = access_member(callback, ctx);
|
||||
|
@ -2762,6 +2762,24 @@ fn compile_builtin_function_call(
|
|||
panic!("internal error: invalid args to ShowPopupWindow {:?}", arguments)
|
||||
}
|
||||
}
|
||||
BuiltinFunction::ItemMemberFunction(name) => {
|
||||
if let [llr::Expression::PropertyReference(pr)] = arguments {
|
||||
let item = access_member(pr, ctx);
|
||||
let item_rc = access_item_rc(pr, ctx);
|
||||
let window = access_window_field(ctx);
|
||||
let native = native_item(pr, ctx);
|
||||
|
||||
let function_name = format!(
|
||||
"slint_{}_{}",
|
||||
native.class_name.to_lowercase(),
|
||||
ident(&name).to_lowercase()
|
||||
);
|
||||
|
||||
format!("{function_name}(&{item}, &{window}.handle(), &{item_rc})")
|
||||
} else {
|
||||
panic!("internal error: invalid args to ItemMemberFunction {:?}", arguments)
|
||||
}
|
||||
}
|
||||
BuiltinFunction::RegisterCustomFontByPath => {
|
||||
if let [llr::Expression::StringLiteral(path)] = arguments {
|
||||
let window = access_window_field(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue