Commit graph

536 commits

Author SHA1 Message Date
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Olivier Goffart
7a062d23cf Fixup previous commit 2023-06-05 14:14:22 +02:00
don bright
a255aaf8d4 add list of Valid Units to the Invalid Unit error message (#2701) 2023-06-05 14:14:22 +02:00
Simon Hausmann
cad884ff1f Remove unnecessary property declaration in PopupWindow's internal type
We don't need to materialize this property because we only support
constant bindings at the moment.
2023-06-05 13:47:57 +02:00
Simon Hausmann
0f54b9599b Add support for manually closing PopupWindows
This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
2023-06-02 18:07:49 +02:00
Simon Hausmann
a0a5294e49 Fix init callbacks not being invoked for PopupWindow 2023-06-02 18:07:49 +02:00
Olivier Goffart
f7e61fdd37 Fix transparentize to multiply by 1-factor
Also add `[[nodicard]]` in C++
2023-06-02 17:02:08 +02:00
Olivier Goffart
5599bd44e0 Remove Color::opaque
It is not a right name and i don't think it is a so common operation
2023-06-02 17:02:08 +02:00
Olivier Goffart
4845241ebf Rename translucent to transparentize and mixed to mix 2023-06-02 17:02:08 +02:00
Arthur Araruna
64ad1ce357 Add some color and brush manipulation funcs (#2565)
The added functions enable mixing colors and manipulating the opacity
of colors and brushes.

They enable the behavior of some of the available functions from SASS and are
added for future use for adding the Adwaita style (future PR).
2023-06-02 17:02:08 +02:00
Simon Hausmann
c428601370
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.
2023-06-01 16:04:53 +02:00
Florian Blasius
0755af3b6d Change progress property of ProgressIndicator from in-out to out 2023-06-01 12:19:43 +02:00
Florian Blasius
69a0d7e219 Fix some issues with material widgets in horizontal layouts 2023-05-31 20:13:38 +02:00
Simon Hausmann
6b8214c3f9 Add support for italic and bold text in the software renderer's bitmap font path
In the screenshot tests this works by setting SLINT_DEFAULT_FONT to
pointer to a directory, instead of a file. We then load all fonts in
that directory and consider their families the default unless a family
is specified. This way for "Noto Sans" a regular as well as an italic
version is registered in fontdb and returned in the list of font
fallback ids. embed_glyphs in the compiler then embeds those variants
and we find them at run-time.
2023-05-31 18:47:39 +02:00
Simon Hausmann
3cf1b38a48 Add basic support for italic font face selection to Text and TextInput
This is implemented for FemtoVG, Skia, and Qt.
2023-05-31 18:47:39 +02:00
Florian Blasius
52c4f2add9 Fix layout for material switch 2023-05-31 16:13:40 +02:00
Florian Blasius
b4472b9118
Added switch widget (#2798)
* Add material Switch

* Add fluent switch

* Add native Switch and cleanup

* Rebase fix

* Update internal/compiler/widgets/fluent-base/std-widgets-impl.slint

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update examples/gallery/ui/pages/controls_page.slint

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review tweak on gallery layout

* Code review tweak on gallery layout

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-05-31 14:57:23 +02:00
Florian Blasius
9e267bcc94
Add ProgressIndicator widgets (#2792)
* Add material ProgressIndicator and documentation

* Add fluent ProgressIndicator

* Add native ProgressIndicator

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review

* Update internal/compiler/widgets/fluent-base/std-widgets-base.slint

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update changelog

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-05-31 09:57:12 +02:00
Tobias Hunger
1eb8d2875b
Fix warnings in cargo doc output 2023-05-30 10:08:44 +02:00
Florian Blasius
edc60c8ece Add password char to embeded_glpyhs 2023-05-30 09:03:25 +02:00
Simon Hausmann
ed287c55fe Use shared fontdb in the compiler
This eliminates the copy of the fontconfig handling code.
2023-05-23 08:26:03 +02:00
Simon Hausmann
aa005e76ec Unify fontdb versioning across all crates 2023-05-19 10:40:51 +02:00
Florian Blasius
abe558313d
material: improve groupbox visual (#2749) 2023-05-17 17:19:08 +02:00
Olivier Goffart
b847faa027 Typeloader: In case of load error, don't keep invalid files as currently loading
Because we `return None` in case of error before we remove the file from `currently_loading`
we would then await forever next time we try to load that file.

This will cause a deadlock that can be causing #2709
2023-05-15 16:10:35 +02:00
Olivier Goffart
eb88a9ac9c Adjust sizing of the AboutSlint widget 2023-05-09 12:19:18 +02:00
Olivier Goffart
6441968a43 Janitor: Remove trailing spaces in most files 2023-05-04 08:14:28 +02:00
Olivier Goffart
b098234ad4 consistent_styles test: Ignore TabWidgetImpl
We already ignore other internal stuff
2023-05-04 08:01:48 +02:00
Olivier Goffart
df2f76a65b Make the non-native TabWidget fill the parent size when not in layout
Fix #2683
2023-05-04 07:23:04 +02:00
Olivier Goffart
5c4a1746d4 LSP: fix completion of callback arguments 2023-05-03 09:09:01 +02:00
Olivier Goffart
6111b17a7c Proper error when wrong type used in an unary operation
Fixes #2669
2023-05-02 17:41:36 +02:00
Tobias Hunger
bb67122a50 LSP: Remove offset to position mapper 2023-05-02 15:12:01 +02:00
Olivier Goffart
d881a4fb66 Syntax tests: move some tests to another folder
tidy a bit the basic directory
2023-05-02 13:06:50 +02:00
Cole Lawrence
95e00c5621 Support negative numbers in cubic-bezier(...) function 2023-05-02 09:48:32 +02:00
Cole Lawrence
26fbef9cc0 collect_structs: visit function args and returns
Prevent compilation error in the generated code when dealing with
structs only referenced by public functions.

Fixes #2655
2023-04-29 08:24:17 +02:00
Tobias Hunger
cf1984f544 compiler: Add a test for mapping offset to/from line/column
... in SourceFile. Let's hope that this will finally make sure that
this works properly!
2023-04-27 21:07:26 +02:00
Tobias Hunger
31147fecd7 compiler: Fix mapping from offset to line/column in SourceFile 2023-04-27 21:07:26 +02:00
Tobias Hunger
bb3109443a compiler: Allow mapping from line/column to offset
Add a method to the SourceFile so that we can map back from line/column
values to offsets.
2023-04-27 21:07:26 +02:00
Tobias Hunger
43aae1de1c Interpreter: Include the id := in Elements
Include the "id :=" part when highlighting an Element. This places the
cursor at the 'i' now.

Done-with: @ogoffart
2023-04-26 20:49:12 +02:00
Tobias Hunger
bbdd6aeab7 compiler: Ignore leading whitespace when parsing
... and update all out test cases accordingly.
2023-04-26 17:22:13 +02:00
ogoffart
dfd5fc38b3 Bump version number to 1.0.3 2023-04-26 14:04:08 +00:00
ogoffart
53cce5bf44 Bump version number to 1.0.2 2023-04-26 11:33:16 +02:00
Olivier Goffart
ae1fb4c7cf Handle complex forward-focus loops 2023-04-24 18:03:33 +02:00
Olivier Goffart
7e7b9176a7 Don't infinite loop when forwarding focus to self 2023-04-24 18:03:33 +02:00
Olivier Goffart
b9d139fd6e Fix focussing element whose base is focusable
Fixes #2622
2023-04-24 18:03:33 +02:00
Simon Hausmann
6c8fa5f215
Fix duplicated loading/embedding of images (#2612)
For .slint files that are included, we canonicalize the path before
adding it into the import stack, to avoid duplicates. We didn't do that
for images in the global_embedded_resources.

Ensure this by canonicalizing as early as possible.

Fixes #2608
2023-04-21 13:15:22 +02:00
Olivier Goffart
1d3d19536e Use the dlopen feature for fontconfig
closes #2376
2023-04-19 17:25:02 +02:00
Olivier Goffart
621ca4f56c Janitor: update deps 2023-04-19 17:20:51 +02:00
Olivier Goffart
7ef9d9b7ec LSP: complete the first import right before the first component
So this doesn't break the slint! macro (add the import at the beginning
of the rust file)
2023-04-19 17:19:55 +02:00
Olivier Goffart
4076df928d Fix panic when getting the line, column of diagnostic with invalid span
Introduced in cbc0c790a3
2023-04-19 12:35:17 +02:00
Olivier Goffart
cbc0c790a3 Make Disagnostice::line_colunm 1 based
Commit 893983e8d3 "fixed" it to be 0 based as it was
documented. But that's a change of behavior so restore the previous behavior and
document it properly
2023-04-19 11:02:33 +02:00