| 1 | // Copyright © SixtyFPS GmbH <info@slint.dev> |
| 2 | // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0 |
| 3 | |
| 4 | export global MyGlobal { |
| 5 | in-out property <string> global-prop: "This is global" ; |
| 6 | callback global-callback(string) -> string; |
| 7 | public function minus-one(value: int) { |
| 8 | return value - 1; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | export global SecondGlobal { |
| 13 | out property <string> second: "second" ; |
| 14 | } |
| 15 | |
| 16 | export struct MyData { |
| 17 | name: string, |
| 18 | age: int, |
| 19 | } |
| 20 | |
| 21 | struct Secret-Struct { |
| 22 | balance: int, |
| 23 | } |
| 24 | |
| 25 | export { Secret-Struct as Public-Struct } |
| 26 | |
| 27 | export component App inherits Window { |
| 28 | in-out property <string> hello: "World" ; |
| 29 | callback say-hello(string) -> string; |
| 30 | callback say_hello_again(string) -> string; |
| 31 | |
| 32 | callback invoke-say-hello(string) -> string; |
| 33 | invoke-say-hello(arg) => { |
| 34 | return self.say-hello(arg); |
| 35 | } |
| 36 | |
| 37 | callback invoke-say-hello-again(string) -> string; |
| 38 | invoke-say-hello-again(arg) => { |
| 39 | return self.say-hello-again(arg); |
| 40 | } |
| 41 | |
| 42 | callback invoke-global-callback(string) -> string; |
| 43 | invoke-global-callback(arg) => { |
| 44 | return MyGlobal.global-callback(arg); |
| 45 | } |
| 46 | |
| 47 | public function plus-one(value: int) { |
| 48 | return value + 1; |
| 49 | } |
| 50 | |
| 51 | Rectangle { |
| 52 | color: red; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | component Diag inherits Window { } |
| 57 | |
| 58 | export { Diag as MyDiag } |
| 59 | |