mirror of
https://github.com/slint-ui/slint.git
synced 2025-11-02 04:48:27 +00:00
Replace more .60 by .slint
Mainly an automated change with
git grep -O"sed -i 's/\.60/.slint/g'" -w "\.60"
and some manual checks
This commit is contained in:
parent
d706d63ce1
commit
03534039d6
81 changed files with 314 additions and 313 deletions
|
|
@ -1,9 +1,9 @@
|
|||
# Installing or Building with CMake
|
||||
|
||||
SixtyFPS comes with a CMake integration that automates the compilation step of the `.60` markup language files and
|
||||
SixtyFPS comes with a CMake integration that automates the compilation step of the `.slint` markup language files and
|
||||
offers a CMake target for convenient linkage.
|
||||
|
||||
*Note*: We recommend using the Ninja generator of CMake for the most efficient build and `.60` dependency tracking.
|
||||
*Note*: We recommend using the Ninja generator of CMake for the most efficient build and `.slint` dependency tracking.
|
||||
You can select the CMake Ninja backend by passing `-GNinja` or setting the `CMAKE_GENERATOR` environment variable to `Ninja`.
|
||||
|
||||
## Binary Packages
|
||||
|
|
@ -21,7 +21,7 @@ You can download one of our pre-built binaries for Linux or Windows on x86-64 ar
|
|||
After extracting the artifact or running the installer, you can place the `lib` sub-directory into your `CMAKE_PREFIX_PATH` and `find_package(Slint)` should succeed in locating the package.
|
||||
|
||||
In the next section you will learn how to use the installed library in your application
|
||||
and load `.60` UI files.
|
||||
and load `.slint` UI files.
|
||||
|
||||
## Building from Sources
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ exhale_args = {
|
|||
within the :ref:`sixtyfps<namespace_sixtyfps>` namespace and are accessible by including
|
||||
the :code:`sixtyfps.h` header file.
|
||||
|
||||
If you choose to load :code:`.60` files dynamically at run-time, then
|
||||
If you choose to load :code:`.slint` files dynamically at run-time, then
|
||||
you can use the classes in :ref:`sixtyfps::interpreter<namespace_sixtyfps__interpreter>`, starting at
|
||||
:cpp:class:`sixtyfps::interpreter::ComponentCompiler`. You need to include
|
||||
the :code:`sixtyfps_interpreter.h` header file.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Generated code
|
||||
|
||||
The SixtyFPS compiler called by the build system will generate a header file for the root `.60`
|
||||
The SixtyFPS compiler called by the build system will generate a header file for the root `.slint`
|
||||
file. This header file will contain a `class` with the same name as the component.
|
||||
|
||||
This class will have the following public member functions:
|
||||
|
|
@ -27,13 +27,13 @@ This is a smart pointer that owns the actual instance and keeps it alive as long
|
|||
is in scope, similar to `std::shared_ptr<T>`.
|
||||
|
||||
For more complex UIs it is common to supply data in the form of an abstract data model, that is used with
|
||||
[`for` - `in`](markdown/langref.md#repetition) repetitions or [`ListView`](markdown/widgets.md#listview) elements in the `.60` language.
|
||||
[`for` - `in`](markdown/langref.md#repetition) repetitions or [`ListView`](markdown/widgets.md#listview) elements in the `.slint` language.
|
||||
All models in C++ are sub-classes of the {cpp:class}`sixtyfps::Model` and you can sub-class it yourself. For convenience,
|
||||
the {cpp:class}`sixtyfps::VectorModel` provides an implementation that is backed by a `std::vector<T>`.
|
||||
|
||||
## Example
|
||||
|
||||
Let's assume we have this code in our `.60` file
|
||||
Let's assume we have this code in our `.slint` file
|
||||
|
||||
```60
|
||||
SampleComponent := Window {
|
||||
|
|
@ -95,12 +95,12 @@ private:
|
|||
|
||||
## Global Singletons
|
||||
|
||||
In `.60` files it is possible to declare [singletons that are globally available](markdown/langref.md#global-singletons).
|
||||
In `.slint` files it is possible to declare [singletons that are globally available](markdown/langref.md#global-singletons).
|
||||
You can access them from to your C++ code by exporting them and using the `global()` getter function in the
|
||||
C++ class generated for your entry component. Each global singleton creates a class that has getter/setter functions
|
||||
for properties and callbacks, similar to API that's created for your `.60` component, as demonstrated in the previous section.
|
||||
for properties and callbacks, similar to API that's created for your `.slint` component, as demonstrated in the previous section.
|
||||
|
||||
For example the following `.60` markup defines a global `Logic` singleton that's also exported:
|
||||
For example the following `.slint` markup defines a global `Logic` singleton that's also exported:
|
||||
|
||||
```60,ignore
|
||||
export global Logic := {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
Once SixtyFPS is built, you can use it in your CMake application or library target in two steps:
|
||||
|
||||
1. Associate the `.60` files that you'd like to use by calling the `slint_target_sources` cmake command. The first parameter is
|
||||
your application (or library) CMake target, and the parameters following are the names of the `.60` files. This will result in the
|
||||
`.60` files to be compiled into C++ source code.
|
||||
1. Associate the `.slint` files that you'd like to use by calling the `slint_target_sources` cmake command. The first parameter is
|
||||
your application (or library) CMake target, and the parameters following are the names of the `.slint` files. This will result in the
|
||||
`.slint` files to be compiled into C++ source code.
|
||||
2. The generated C++ source code also needs the SixtyFPS run-time library. This dependency is satisfied by linking `Slint::Slint`
|
||||
into your target with the `target_link_libraries` command.
|
||||
|
||||
|
|
@ -26,11 +26,11 @@ FetchContent_Declare(
|
|||
FetchContent_MakeAvailable(SixtyFPS)
|
||||
|
||||
add_executable(my_application main.cpp)
|
||||
slint_target_sources(my_application my_application_ui.60)
|
||||
slint_target_sources(my_application my_application_ui.slint)
|
||||
target_link_libraries(my_application PRIVATE Slint::Slint)
|
||||
```
|
||||
|
||||
Suppose `my_application_ui.60` was a "Hello World" like this:
|
||||
Suppose `my_application_ui.slint` was a "Hello World" like this:
|
||||
|
||||
```60,ignore
|
||||
HelloWorld := Window {
|
||||
|
|
@ -65,7 +65,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
```
|
||||
|
||||
This works because the SixtyFPS compiler translated `my_application_ui.60` to C++ code, in the `my_application_ui.h`
|
||||
This works because the SixtyFPS compiler translated `my_application_ui.slint` to C++ code, in the `my_application_ui.h`
|
||||
header file. That generated code has a C++ class that corresponds to the `HelloWorld` element and has API to create
|
||||
the ui, read or write properties or set callbacks. You can learn more about how this API looks like in general in the
|
||||
[](generated_code.md) section.
|
||||
|
|
@ -73,7 +73,7 @@ the ui, read or write properties or set callbacks. You can learn more about how
|
|||
## Tutorial
|
||||
|
||||
For an in-depth walk-through, you may be interested in reading our walk-through <a href="../tutorial/cpp">SixtyFPS Memory Game Tutorial Tutorial</a>.
|
||||
It will guide you through the `.60` mark-up language and the C++ API by building a little memory game.
|
||||
It will guide you through the `.slint` mark-up language and the C++ API by building a little memory game.
|
||||
|
||||
## Template
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ Welcome to SixtyFPS C++'s documentation!
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:hidden:
|
||||
:caption: C++ / .60 Integration
|
||||
:caption: C++ / .slint Integration
|
||||
|
||||
Overview <overview.md>
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ Welcome to SixtyFPS C++'s documentation!
|
|||
`SixtyFPS <https://sixtyfps.io/>`_ is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications.
|
||||
SixtyFPS C++ is the C++ API to interact with a SixtyFPS UI from C++.
|
||||
|
||||
The .60 Markup Language
|
||||
The .slint Markup Language
|
||||
=======================
|
||||
|
||||
SixtyFPS comes with a markup language that is specifically designed for user interfaces. This language provides a
|
||||
|
|
@ -78,7 +78,7 @@ Check out the `language reference <markdown/langref.html>`_ for more details.
|
|||
Architecture
|
||||
============
|
||||
|
||||
An application is composed of the business logic written in C++ and the `.60` user interface design markup, which
|
||||
An application is composed of the business logic written in C++ and the `.slint` user interface design markup, which
|
||||
is compiled to native code.
|
||||
|
||||
.. image:: https://sixtyfps.io/resources/architecture.drawio.svg
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
.. Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
.. SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
The .60 UI Design Language
|
||||
The .slint UI Design Language
|
||||
==========================
|
||||
|
||||
.. toctree::
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
# Overview
|
||||
|
||||
The following two sections explain how you can integrate your `.60` designs into your
|
||||
C++ application. The entry point is a `.60` file that contains your primary component
|
||||
The following two sections explain how you can integrate your `.slint` designs into your
|
||||
C++ application. The entry point is a `.slint` file that contains your primary component
|
||||
that you instantiate from C++.
|
||||
|
||||
There are two ways in that you can instantiate your `.60` designs in your C++ application,
|
||||
There are two ways in that you can instantiate your `.slint` designs in your C++ application,
|
||||
either by compiling them ahead of time or by dynamically loading them at run-time.
|
||||
|
||||
Once instantiated you feed data into it, for example by setting properties, populating
|
||||
data models or setting up callbacks that are invoked when the user activates certain elements.
|
||||
|
||||
|
||||
## Compiled `.60` designs
|
||||
## Compiled `.slint` designs
|
||||
|
||||
You can choose to compile a `.60` file to C++, which provides the best performance
|
||||
You can choose to compile a `.slint` file to C++, which provides the best performance
|
||||
and lowest memory consumption.
|
||||
|
||||
The `slint_target_sources` cmake command makes the translation automatic
|
||||
|
|
@ -22,13 +22,13 @@ and [generated code](generated_code.md) has an API that allows setting and getti
|
|||
property values, etc. That API will use types from the {ref}`sixtyfps <namespace_sixtyfps>`
|
||||
namespace, for example {cpp:class}`sixtyfps::SharedString` or {cpp:class}`sixtyfps::Color`.
|
||||
|
||||
## Run-time interpreted `.60` designs
|
||||
## Run-time interpreted `.slint` designs
|
||||
|
||||
Instead of compiling `.60` designs to C++, you can also choose to dynamically load `.60`
|
||||
Instead of compiling `.slint` designs to C++, you can also choose to dynamically load `.slint`
|
||||
files at run-time. This is slower than compiling them ahead of time and requires more memory,
|
||||
however it provides more flexibility in your application design.
|
||||
|
||||
The entry point to loading a `.60` file is the {cpp:class}`sixtyfps::interpreter::ComponentCompiler`
|
||||
The entry point to loading a `.slint` file is the {cpp:class}`sixtyfps::interpreter::ComponentCompiler`
|
||||
class in the {ref}`sixtyfps::interpreter <namespace_sixtyfps__interpreter>` namespace.
|
||||
|
||||
With the help of {cpp:class}`sixtyfps::interpreter::ComponentCompiler` you create a {cpp:class}`sixtyfps::interpreter::ComponentDefinition`,
|
||||
|
|
@ -37,16 +37,16 @@ which provides you with information about properties and callbacks that are comm
|
|||
are wrapped in {cpp:class}`sixtyfps::ComponentHandle`. This is a smart pointer that owns the actual instance
|
||||
and keeps it alive as long as at least one {cpp:class}`sixtyfps::ComponentHandle` is in scope, similar to `std::shared_ptr<T>`.
|
||||
|
||||
All property values in `.60` are mapped to {cpp:class}`sixtyfps::interpreter::Value` in C++. This is a
|
||||
All property values in `.slint` are mapped to {cpp:class}`sixtyfps::interpreter::Value` in C++. This is a
|
||||
polymorphic data type that can hold different kinds of values, such as numbers, strings or even data models.
|
||||
|
||||
For more complex UIs it is common to supply data in the form of an abstract data model, that is used with
|
||||
[`for` - `in`](markdown/langref.md#repetition) repetitions or [`ListView`](markdown/widgets.md#listview) elements in the `.60` language.
|
||||
[`for` - `in`](markdown/langref.md#repetition) repetitions or [`ListView`](markdown/widgets.md#listview) elements in the `.slint` language.
|
||||
All models in C++ with the interpreter API are sub-classes of the {cpp:class}`sixtyfps::Model` where the template
|
||||
parameter is {cpp:class}`sixtyfps::interpreter::Value`. Therefore to provide your own data model, you can subclass
|
||||
`sixtyfps::Model<sixtyfps::interpreter::Value>`.
|
||||
|
||||
In `.60` files it is possible to declare [singletons that are globally available](markdown/langref.md#global-singletons).
|
||||
In `.slint` files it is possible to declare [singletons that are globally available](markdown/langref.md#global-singletons).
|
||||
You can access them from to your C++ code by exporting them and using the getter and setter functions on
|
||||
{cpp:class}`sixtyfps::interpreter::ComponentInstance` to change properties and callbacks:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# Type Mappings
|
||||
|
||||
The types used for properties in `.60` design markup each translate to specific types in C++.
|
||||
The types used for properties in `.slint` design markup each translate to specific types in C++.
|
||||
The follow table summarizes the entire mapping:
|
||||
|
||||
| `.60` Type | C++ Type | Note |
|
||||
| `.slint` Type | C++ Type | Note |
|
||||
| --- | --- | --- |
|
||||
| `int` | `int` | |
|
||||
| `float` | `float` | |
|
||||
|
|
@ -20,10 +20,10 @@ The follow table summarizes the entire mapping:
|
|||
|
||||
## Structures
|
||||
|
||||
For user-defined structures in the .60 code, a `class` of the same name is generated with data member
|
||||
For user-defined structures in the .slint code, a `class` of the same name is generated with data member
|
||||
in lexicographic order.
|
||||
|
||||
For example, if you have this structure in the .60 file
|
||||
For example, if you have this structure in the .slint file
|
||||
|
||||
```60,ignore
|
||||
export struct MyStruct := {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue