Commit graph

371 commits

Author SHA1 Message Date
Olivier Goffart
116648ffcf C++ Platform: remove the experimental namespace 2023-07-27 13:22:22 +02:00
Tobias Hunger
d47d52bf52 ItemVTable::init(...): Take an ItemRc so that the itan can know where in the Item Tree it is located 2023-07-27 12:04:16 +02:00
Olivier Goffart
3054ecfb71
C++ platform API: move the dispatch_* function on the Window like in rust 2023-07-26 16:03:05 +02:00
Simon Hausmann
af97435463 Replace show()/hide() in the WindowAdapter with set_visible(bool)
This makes for a smaller interface.
2023-07-26 13:53:45 +02:00
Simon Hausmann
835510c7f6 C++ platform API: Remove const qualified from request_redraw() 2023-07-26 13:25:36 +02:00
Olivier Goffart
51d8a15164 C++ platform: make the max_buffer_age an enum
Copying the Rust enum instead of using cbindgen because we would need to
create a new header just for it for bublic types generated in the
platform namespace. I've also put it in the SoftwareRenderer class since
the equivalent enum is in the software_renderer module in Rust.
2023-07-26 11:28:45 +02:00
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
68a255b1d2 C++: Make the SkiaRenderer constructor explicit
As discussed in API review
2023-07-25 19:16:44 +02:00
Olivier Goffart
69a11f7dbc C++: Platform::register_platform -> platform::set_platform 2023-07-25 17:38:20 +02:00
Olivier Goffart
42bb2bf705 C++: some changes to the Platform API 2023-07-25 17:38:20 +02:00
Simon Hausmann
7d136b6568 Remove the window parameter from the render() function of all the renderers
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
Simon Hausmann
507428b03e
Simplify FemtoVG and Skia renderer API (#3153)
Fold show() into the first time render() is invoked,
and hide() into the Drop implementation.
2023-07-25 17:17:40 +02:00
Olivier Goffart
2a56e25788
C++: rename PlatformEvent to Platform::Task 2023-07-25 16:15:35 +02:00
Olivier Goffart
3137bfe775 C++ Rgb565Pixel 2023-07-25 15:24:59 +02:00
Simon Hausmann
7893ec3fd4 C++: Improve type-safety of NativeWindowHandle API on macOS
Replace void* with forward-declared NSView/NSWindow in NativeWindowHandle::from_appkit
2023-07-25 15:19:56 +02:00
Olivier Goffart
3a2359f107 C++ Pointer dispatch API 2023-07-25 14:03:40 +02:00
Simon Hausmann
5c0d88b71e C++: Rename SoftwareRenderer::render_rgb565 to just render() and overload the Rgb8Pixel variant 2023-07-24 14:25:49 +02:00
Florian Blasius
8ce2620aaa
Added cpp ReverseModel (#3132) 2023-07-24 11:32:45 +02:00
Olivier Goffart
3a420d5769 C++ platform: return the updated region from the render function 2023-07-24 09:44:36 +02:00
Simon Hausmann
cc36915241 Add RGB565 rendering function to the C++ software renderer 2023-07-21 09:16:20 +02:00
Simon Hausmann
917cecff85 Add support for embedding bitmap fonts in C++ 2023-07-20 16:20:51 +02:00
Olivier Goffart
81bb6e2c70 C++ platform: duration_until_next_timer_update and change return type of duration_since_start 2023-07-20 10:58:33 +02:00
Olivier Goffart
de532d372a C++ experimental platform event loop 2023-07-20 10:26:09 +02:00
Olivier Goffart
7cffad2c3f C++: add a STD feature enabled by default 2023-07-18 12:44:20 +02:00
Olivier Goffart
a1bf77383f
C++: Add a mechanism to #define features that are enabled (#3103) 2023-07-18 11:49:00 +02:00
Simon Hausmann
a8c07d64c5 doc: Fix grammar of slint_interpreter::ComponentDefinition::properties() C++ docs 2023-07-17 15:52:42 +02:00
Olivier Goffart
3fabff9a0c C++ Platform: allow to override the duration_since_start 2023-07-14 16:12:12 +02:00
Simon Hausmann
3565023a15 Improve error handling in C++ Skia Renderer API
- Don't try to create a GLX context when we only have an XCB window handle,
  XLib is required for that.
- Make it possible to create a NativeWindowHandle from Xlib data types.

Fixes #2978
2023-07-14 15:33:03 +02:00
Simon Hausmann
59d869cb84 Fix missing invocation of init() on Items with C++
In Rust, register_component in the run-time library is called unconditionally and
invokes init(). The window adapter is an optional
parameter.

In C++, we'd call register_component only if we had a window adapter, which meant
that we're missing init calls().

Amends cd9994306e
2023-07-14 13:09:45 +02:00
Simon Hausmann
d8fe052cde Fix bad red markup in C++ slint::Model docs
Revert da95051 and fix the link in the substitution instead.

Fixes #2992
2023-07-10 10:13:42 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
69567b49ef C++: fix the signature of Size
otherwise compiler complains that "long unsigned int" != "int" on 32bit
2023-07-05 21:48:01 +02:00
Olivier Goffart
331e5713c2 C++: Use a static_assert to detect Slint version mismatch
cc #2909 , #223

New message:
```
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: error: static assertion failed: This file was generated with Slint compiler version 1.1.1, but the Slint library used is 1.1.0. The version numbers must match exactly.
    6 | static_assert(1 == SLINT_VERSION_MAJOR && 1 == SLINT_VERSION_MINOR && 1 == SLINT_VERSION_PATCH, "This file was generated with Slint compiler version 1.1.1, but the Slint library used is " SLINT_VERSION_STRING ". The version numbers must match exactly.");
/home/olivier/slint/build2/examples/gallery/gallery.h:6:73: note: the comparison reduces to ‘(1 == 0)’
```

Previous message:
```
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: conversion from ‘VersionCheckHelper<[...],[...],0>’ to non-scalar type ‘VersionCheckHelper<[...],[...],1>’ requested
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/olivier/slint/build2/examples/printerdemo/cpp/printerdemo.h:12218:161: error: could not convert ‘slint::private_api::VersionCheckHelper<1, 1, 0>()’ from ‘VersionCheckHelper<[...],[...],0>’ to ‘VersionCheckHelper<[...],[...],1>’
12218 | [[maybe_unused]] constexpr slint::private_api::VersionCheckHelper<1, 1, 1> THE_SAME_VERSION_MUST_BE_USED_FOR_THE_COMPILER_AND_THE_RUNTIME = slint::private_api::VersionCheckHelper<SLINT_VERSION_MAJOR, SLINT_VERSION_MINOR, SLINT_VERSION_PATCH>();
      |                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                                                                                                 |
      |                                                                                                                                                                 VersionCheckHelper<[...],[...],0>
```
2023-06-28 14:16:52 +02:00
Simon Hausmann
83ccd07a88
C++: Add slint::Window::scale_factor() getter (#3004)
Fixes #3003
2023-06-28 13:24:40 +02:00
Simon Hausmann
d1daa8dbe4 doc: Document coordinate system expectations for borrowed textures 2023-06-26 12:49:22 +02:00
Simon Hausmann
aa41277df1 Improve safety notes on the slint::Image texture import functions
Elaborate how to call this function safely, and copy the same description to the C++ docs.
2023-06-22 22:31:51 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Simon Hausmann
cd9994306e Create the window adapter lazily in C++ 2023-06-13 15:13:42 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Olivier Goffart
723a4477d6 C++: prospective fix for warning in CI on windows 2023-06-06 14:23:02 +02:00
Olivier Goffart
cf746ddf8d WIP: formatting implementation of translate in rust and C++ 2023-06-05 16:34:59 +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
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
Simon Hausmann
e7320607a3 Remove BorrowedOpenGLTexture from the public API again and just provide a factory function in slint::Image 2023-06-01 15:56:55 +02:00
Simon Hausmann
084ff70079 C++: Improve reliability of comparison operator of slint::Image
Call into the Rust implementation, so that we have to maintain only one
implementation.
2023-06-01 15:56:55 +02:00