Commit graph

146 commits

Author SHA1 Message Date
Simon Hausmann
06a19e59ad
slint: Change Platform.os to return a new enum OperatingSystemType (#8679)
* slint: Change Platform.os to return a new enum OperatingSystemType

cc #8631
2025-06-12 14:25:16 +02:00
Avery Townsend
8c4ccabf7d
Expose FocusReason to .slint as an argument in focus-event-changed and add focus-gained and focus-lost callbacks (#8569)
This exposes FocusReason to .slint, and adds it as an argument to focus-event-changed callback on FocusScope to close #8387. It also adds two new callbacks, focus-gained and focus-lost, which are identical to focus-event-changed but are only invoked on focus gain or loss respectively.

In addition to this, it removes the FocusEventReason::AccessKit variant, replacing it with the mouse variant to hopefully make AccessKit more compatible with any Slint code that will use FocusEventReason.

Finally, I added two tests based on focus_change_event.slint, one for testing the FocusEventReason argument and another for testing the new callbacks.

close #8387

ChangeLog: Added `focus-gained` and `focus-lost` callback to FocusScope.  Pass an `FocusReason` enum to the FocusScope callbacks
2025-06-04 09:51:26 +02:00
Simon Hausmann
f983cf0b19 Add Platform.os as well as a rudimentary test 2025-05-06 13:06:27 +02:00
Simon Hausmann
904bc56e62 Introduce Platform.style-name
This replaces the previously hidden `StyleMetrics.style-name` that was only accessible for internal use.
2025-05-06 13:06:27 +02:00
Montel Laurent
4cd6f92013
Hide action when widget is disabled
ChangeLog: TextEdit/LineEdit : disable context menu action when the widget is disabled or read-only
ChangeLog: Added ContextMenuArea::enabled
2025-05-02 13:20:46 +02:00
Simon Hausmann
8761eaadeb
Move Palette.style-name to internal protected StyleMetrics.style-name (#8200)
This is only exposed when internal types are exposed (such as in the lsp).

The plan is to make this public under a new name/global after the release.

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-04-19 10:20:52 +02:00
Joshua Goins
d1f2fef430
Menu: Add enabled property (#8145)
By default it's enabled, of course. This property is not only added to
MenuItem, but Menu as well - since they can be nested. It's also
possible to select a disabled item, but it's hard to modify that since
it's logic is written in Slint. You should be prevented from activating
it with a tap or key press at least.

See #7791
2025-04-15 08:08:11 +02:00
Tobias Hunger
e1b85bbb93 component-container: Accept focus
So that we can pass the focus into the container when it first
shows.

I thought this would be super complex to do property! What a
nice surprise:-)

Fixes: #4055
2025-04-09 09:37:28 +02:00
Nigel Breslaw
538f8bde19
Allow checking at runtime about the current theme (#8049)
Although std-widgets provides many properties that adapt to the current theme users who would like to go beyond these properties and do theme dependent changes are limited. One option would be to add even more properties to the Palette, however this would potentially bloat the object, it's not obvious what properties users care about and this approach doesn't scale. In many cases developers could simply create their own properties if they knew what the current runtime theme was.

This simple change allows an app to know what the current theme is and present theme appropriate UI's.
2025-04-04 14:44:14 +03:00
Olivier Goffart
e5289af154 Introduce MenuSeparator
Fixes #7790
2025-04-02 11:50:45 +02:00
Olivier Goffart
6010cf724c Hover on MenuBar should activate menu if a menu is already open
Fixes #7822
2025-03-31 14:06:24 +02:00
Olivier Goffart
fa650ed5ec Allow to have builtin item function to return a value
This does some refactoring to allow builtin item functions to return a
value:
 - builtin member functions are no longer BuiltinFunction, but they are
   just normal NamedReference
 - Move special case for them in the LLR/eval
2025-03-31 14:06:24 +02:00
Olivier Goffart
39191e5acd
Menu API changes
`ContextMenu` -> `ContextMenuArea`

`ContextMenu` must have a `Menu` child.
`MenuItem` can no longer be put dirrectly in `MenuBar` and can no longer
have children
`Menu` is used now for sub menus
2025-02-21 16:03:47 +01:00
Olivier Goffart
c0b72cad2f
ContextMenu: show submenu on hover after a timeout
This means that the parent menu still get the mouse events

Also add the ability to close the menu programmatically
2025-02-07 13:27:32 +01:00
Olivier Goffart
2846c35055
TextInput: implement page up/down
CC #474
2025-02-06 14:52:28 +01:00
Olivier Goffart
98e8386aee
MenuBar/ContextMenu: hide the entries interface
This can only be used internally by the style to implement the actual
ContextMenu

Only the declarative `MenuItem` interface is exposed.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-01-25 11:06:31 +01:00
Olivier Goffart
c0fe0be643 Add the MenuItem Element type to be added to MenuBar and ContextMenu 2025-01-23 22:02:08 +01:00
Simon Hausmann
0d723953f9 Add support for line caps in Path Strokes
ChangeLog: Added `Path::stroke-line-cap` property.

Fixes #4676
2025-01-20 22:28:45 +01:00
Olivier Goffart
28e54175f6 Work on the ContextMenu
- Add the `entries` property in the ContextMenu
 - Make right click on the ContextMenu show the menu
 - Use the proper technique to register ContextMenu and MenuBar as
   experimental (same as ComponentContainer)
2025-01-16 20:21:06 +01:00
Simon Hausmann
c764da4aab
Add property to toggle anti-aliasing on Path elements (#7308)
This enables working around bugs in GPU drivers. Especially the GC7000UL
plus its driver on imx8mp has been observed to sometimes horribly degrade in
performance when Skia renders anti-aliased paths (when a function like
`gcoSURF_BlitCPU` shows up at the top of `perf` that's a bad sign).
2025-01-10 10:28:01 +01:00
Benny Sjoestrand
5ef4aace4c Implement full-screen property for slint Window item
Make it possible to programatically to switch to full-screen mode
via a new property in the Windows item.
The SLINT_FULLSCREEN environment variable will default set this
property to true. However settings this property in the slint code
will override the SLINT_FULLSCREEN.

Fixes #6665
2024-12-16 09:52:40 +01:00
FloVanGH
e0ad561c86
widgets: added key-pressed and key-released callbacks to all text input components (#7081)
* widgets: removed rejected event
* widgets: added key-pressed, key-released callbacks to text input components
* Update docs/astro/src/content/docs/reference/std-widgets/lineedit.mdx
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-12-12 16:20:45 +00:00
Olivier Goffart
a3dad45f0b Accessibility: rename a few properties after API review:
- Rename `accessible-selectable` and `accessible-selected` to `accessible-item-{selectable,selected}`.
   Because the property is for items in list rather than eg Text
 - Rename `accessible-position-in-set` to `accessible-item-index`.
 - Rename `accessible-size-of-set` to `accessible-item-count` and move
   the property to the container element rather than the item itself
2024-12-07 08:25:42 +01:00
asuper0
387220227d
Add step property to Slider (#6981)
Closes #4549

ChangedLog: Slider: added `step` property
2024-12-05 11:50:08 +01:00
FloVanGH
0d1412afc5
removed skip-taskbar property from window (#6982) 2024-12-03 10:07:36 +00:00
FloVanGH
901afde11f
api review: callback parameters and properties name adjustements 2024-12-02 16:22:39 +00:00
Olivier Goffart
459fad7528 Janitor: fix comments in builtins.slint
The compiler is using StyleMetrics
2024-12-02 11:08:35 +01:00
FloVanGH
712f930897
windows: added skip_taskbar (#6911)
* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/backends/winit/winitwindowadapter.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/src/content/docs/reference/window/window.mdx

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-11-27 09:55:11 +00:00
Olivier Goffart
6e91b9bc91 Give name to the builtin element's callback argument 2024-11-21 09:53:17 +01:00
Olivier Goffart
f225f79d49 compiler: Put the argument names in the Type
That simplifies things a bit and will allow to have names for builtin callback and functions
2024-11-21 09:53:17 +01:00
Olivier Goffart
5bd20def0e Experimental support for MenuBar
Introduces `MenuBar{ ... }` that can be put in a Window
2024-11-20 09:25:37 +01:00
FloVanGH
5ea05e18af
std-widgets: added horizontal-alignment to SpinBox (#6778) 2024-11-15 08:05:57 +00:00
Arnold Loubriat
97219c21bf Add the accessible-size-of-set property 2024-10-30 15:54:01 +08:00
Ryan Naddy
58efd5312b
Added rejected to TextInput (#6649) 2024-10-25 17:24:47 +02:00
FloVanGH
14c7910d49
PopupWindow: added close-policy property (#6614)
* Update api/cpp/include/slint_window.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update docs/reference/src/language/builtins/elements.md

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

* Update internal/core/window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/eval.rs

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

* Update internal/backends/qt/qt_window.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/interpreter/dynamic_item_tree.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update internal/compiler/passes/materialize_fake_properties.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2024-10-24 09:27:39 +00:00
Renato Araujo Oliveira Filho
1e4de3fe0c
Implement ScrollBarPolicy property for ScrollView (#6442)
ChangeLog: ScrollView: added  vertical-bar-policy and horizontal-bar-policy

Fixes: #3552
Fixes: #5578
2024-10-08 17:02:17 +02:00
FloVanGH
fd9807515f
TextInput: use selection colors from palette (#6381)
* Update internal/compiler/builtins.slint

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>

---------

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-09-30 10:56:22 +00:00
Florian Blasius
71d1d814ce Revert "TextInput: use selection colors from palette"
This reverts commit 044518ee81.
2024-09-30 08:43:41 +02:00
Florian Blasius
044518ee81 TextInput: use selection colors from palette 2024-09-30 08:41:41 +02:00
Josh Wood
6a131e2648
Added PropertyAnimation.direction property for controlling animation direction (#6261)
Closes #6260

ChangeLog: Added property for controlling animation direction
2024-09-24 19:55:24 +02:00
Simon Hausmann
cd2b738c7a Rename SwipeGestureRecognizer to SwipeGestureHandler
The origin of this proposal is the name of the `swipe-left`, etc.
directional, boolean properties. They're missing another verb in their
name. In principle the right choice would be "recognize". That is what
the type name suggests, that's the term the documentation uses, so the
code should read `recognize-swipe-left: true;`. However that is a long
word. "Handle" is a verb that's simpler. It's also more generic (that's
a downside), but it's otherwise short enough to make things look
"right":

```
SwipeGestureHandler {
    handle-swipe-left: true;
    swiped => { something.naviate-left(); }
}
```

Therefore this patch proposes to rename the type to SwipeGestureHandler
and prefixes the boolean directional properties with "handle".
2024-09-18 16:37:27 +02:00
Olivier Goffart
0c8a9fcefb Fix compiler panic when accessing path.commands in expressions
Fixes #5564
2024-09-10 13:36:09 +02:00
Olivier Goffart
5663ddd9cc
SwipeGestureRecognizer (#6005) 2024-09-09 14:40:55 +02:00
Olivier Goffart
a9f526491a Timer Element
Closes #5724
2024-08-16 16:36:38 +02:00
Olivier Goffart
35a6e7bde5 Split Text item into SimpleText and ComplexText
SimpleText has all the most common properties and is half the size
2024-07-05 12:51:25 +02:00
Olivier Goffart
7c93c7438b Rename resize-border => resize-border-width 2024-07-05 12:50:16 +02:00
Luc Fauvel
44a537d902
Implemented resizing for non-decorated winit windows (#5026)
Fixes #5023

* Implemented resizing for non-decorated winit windows

* Fixed formatting

* Changed direction match to use a tuple, reduced resize border size, returned after handling resize

* Added is resizable check for before resizing winit window

* Added resize-border property to window

* Formatted code

* Change resize-border from float to length
2024-06-06 11:17:05 +02:00
Simon Hausmann
d183498c4e Add support for step-size to SpinBox rendered by the Qt style
Fixes #5325
2024-05-31 09:45:29 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00