mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-18 19:22:18 +00:00
To implement an external Slint library, the types and components implemented in the .slint files needs to be exposed through the Rust crate. A simple example example/app-library is added to demonstrate how to use this feature. CC #7060
32 lines
799 B
Text
32 lines
799 B
Text
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import { Button, VerticalBox } from "std-widgets.slint";
|
|
import { BLogicA, BLogicAAPI } from "@BLogicA";
|
|
import { BLogicB, BLogicBAPI } from "@BLogicB";
|
|
|
|
export component AppWindow inherits Window {
|
|
callback update-blogic-data();
|
|
|
|
VerticalBox {
|
|
BLogicA {}
|
|
BLogicB {}
|
|
Button {
|
|
text: "Crank me up!";
|
|
clicked => {
|
|
BLogicBAPI.crank-it({ magic-number: 42, cranks: [ "delta", "alfta", "sorta", "coso", "tokyo", "denia" ]});
|
|
}
|
|
}
|
|
Text {
|
|
text:BLogicBAPI.status;
|
|
}
|
|
}
|
|
|
|
Timer {
|
|
interval: 1s;
|
|
running: true;
|
|
triggered => {
|
|
root.update-blogic-data();
|
|
}
|
|
}
|
|
}
|