mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 07:37:24 +00:00
Add public API in the interpreter (Rust/C++) to obtain the list of functions
This commit is contained in:
parent
6f2a6c3f09
commit
37b63e4bd4
4 changed files with 100 additions and 4 deletions
|
@ -886,6 +886,15 @@ public:
|
|||
return callbacks;
|
||||
}
|
||||
|
||||
/// Returns a vector of strings that describe the list of public functions that can be invoked
|
||||
/// using ComponentInstance::invoke.
|
||||
slint::SharedVector<slint::SharedString> functions() const
|
||||
{
|
||||
slint::SharedVector<slint::SharedString> functions;
|
||||
cbindgen_private::slint_interpreter_component_definition_functions(&inner, &functions);
|
||||
return functions;
|
||||
}
|
||||
|
||||
/// Returns the name of this Component as written in the .slint file
|
||||
slint::SharedString name() const
|
||||
{
|
||||
|
@ -929,6 +938,20 @@ public:
|
|||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
/// Returns a vector of the names of the functions of the specified publicly exported global
|
||||
/// singleton. An empty optional is returned if there exists no exported global singleton
|
||||
/// under the specified name.
|
||||
std::optional<slint::SharedVector<slint::SharedString>>
|
||||
global_functions(std::string_view global_name) const
|
||||
{
|
||||
slint::SharedVector<slint::SharedString> names;
|
||||
if (cbindgen_private::slint_interpreter_component_definition_global_functions(
|
||||
&inner, slint::private_api::string_to_slice(global_name), &names)) {
|
||||
return names;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
inline ComponentDefinition ComponentInstance::definition() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue