Commit graph

1059 commits

Author SHA1 Message Date
Simon Hausmann
05ba16f1d6 Remove the component parameter from GenericWindow::set_focus 2020-11-11 19:18:53 +01:00
Simon Hausmann
a2dadf8fe8 Remove the component parameter from GenericWindow::process_key_input 2020-11-11 19:16:26 +01:00
Simon Hausmann
516680ad5d Fix wasm build 2020-11-11 19:09:56 +01:00
Simon Hausmann
3f0c9c97b7 Remove some component parameters from GenericWindow 2020-11-11 19:06:07 +01:00
Simon Hausmann
64b92df87e Initialize the component in the Window at component creation time
This will allow getting rid of the component as parameter to run()
2020-11-11 19:03:04 +01:00
Simon Hausmann
a09355c634 Begin associating a Window with a component in the run-time 2020-11-11 18:31:52 +01:00
Simon Hausmann
5d744c86c2 Begin passing the VRC<ComponentVTable, Dyn> into the run-time library
First by changing the signature of run() and by adding a self_weak
to the C++ struct.
2020-11-11 18:31:51 +01:00
Simon Hausmann
02904c4014 Simplify signature of Component::run
We don't need to pass the root item anymore since ComponentVTable
has now get_item_ref.
2020-11-11 15:55:03 +01:00
Olivier Goffart
af801b9879 Use the new get_item_ref function instead of visiting the root 2020-11-11 15:04:49 +01:00
Olivier Goffart
7f66ca9584 Add a function in the ComponentVTable to get an ItemRef from an index
Needed to adjust vtable so it can work if the return type has a reference
2020-11-11 14:29:44 +01:00
Olivier Goffart
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +01:00
Olivier Goffart
a1f1fcb3a6 Use VRc<ComponentVTable> in the rust generated code 2020-11-09 14:58:37 +01:00
Olivier Goffart
95c4bac794 Add a dealloc and drop_in_place function to the ComponentVTable 2020-11-06 17:13:01 +01:00
Olivier Goffart
4bbe3362a0 Properties: use a loop instead of a recursion when deleting dependency nodes
to avoid stack overflow
2020-11-05 11:34:26 +01:00
Olivier Goffart
cbfd2637cf Fix crash when an allocation fails 2020-11-05 11:01:52 +01:00
Simon Hausmann
55a291bcbc Fix logic for font handle creation used for caching/hashing
In the rendering backend we cache glyphs indexed by the *actual* font
used. The key is a font_kit::handle::Handle, which can be either a Path
or a Memory buffer.  We eventually load the font into memory, so we get
a font_kit::font::Font and pass that around. When the time comes to get
a key for the hash, we create a new handle from font_kit::font::Font via
handle(), which no more has its path and always creates a memory handle,
causing us to always compute a hash over the font in memory
(*facepalm*). So let's keep the original handle around as font_kit
produces a Handle::Path, which is much faster to hash.
2020-11-05 08:57:42 +01:00
Simon Hausmann
c05b71c4ee Fix default text font size
16 points is a lot, 12 is a lot closer to default system sizes.
We can also pull this out of the style in the future.
2020-11-04 17:39:47 +01:00
Olivier Goffart
f940292182 Rename the builtinf file 2020-11-04 17:11:29 +01:00
Olivier Goffart
281a744e86 Load the builtin from a fake .60 file 2020-11-04 16:56:35 +01:00
Olivier Goffart
ec2f500f69 Use a combobox in the booker example
Also enable the button depending on the order of the string
2020-11-03 18:38:35 +01:00
Olivier Goffart
183f300a85 Implement the temperature converter in the .60 code
A edited signal was required on the line edit
2020-11-03 18:23:37 +01:00
Olivier Goffart
8a95b806c7 Strawman implementation of a combo box 2020-11-03 17:55:49 +01:00
Olivier Goffart
4a182ef4d0 Layout alignment 2020-11-03 12:22:34 +01:00
Olivier Goffart
59707f068c add a enabled property on the line edit 2020-11-02 18:20:01 +01:00
Olivier Goffart
2ece3817cc Make ModelHandle a struct
Last commit broke for structures containing models, because models are not PartialEq.
So we need to implement PartialEq for ModelHandle. Which means a struct needs to
be created
2020-10-31 13:32:19 +01:00
Olivier Goffart
d2255327fe Properties: make sure that the falue is different before marking all dependencies dirty
Fix the animation of the gauge in the printer demo
2020-10-31 12:58:11 +01:00
Olivier Goffart
e4e7ae46f4 Support for for in box layout in the interpreter 2020-10-31 11:24:31 +01:00
Olivier Goffart
d339ead5dd support for within box layouts
Only rust implementation for now
2020-10-30 19:12:48 +01:00
Simon Hausmann
842339f620 Avoid an unusable window due to invalid constraints
With manually placed maximum-width and minimum-width bindings it's
possible to create a layout where the minimum is greater than the maximum.

In the unlikely event of that happening, swap min/max so that the window
is resizeable. Otherwise at least on macOS the window manager tries to
apply both and the window funnily jumps.
2020-10-30 14:23:53 +01:00
Simon Hausmann
178d83b305 Fix wrong initial window size on macOS/Windows and endless repaints
Setting the size will trigger a repaint, even if it didn't change.
2020-10-30 14:23:24 +01:00
Olivier Goffart
a4b476bdf3 implement Component::layout_info in C++ 2020-10-29 19:08:52 +01:00
Olivier Goffart
f855b18fb0 Implement min/max size restriction on the window
(Implemented in the interpreter only for now)
2020-10-29 19:08:52 +01:00
Olivier Goffart
5face45c51 Rename Component::compute_layout to apply_layout
And pass the expected rectangle.
This is currently not used yet but will be needed when we can have
repeated elements within a box layout
2020-10-29 19:08:52 +01:00
Olivier Goffart
aabd13b5a9 Adjust the ugly style default stretches 2020-10-27 07:24:04 +01:00
Olivier Goffart
a4671502ab Allow to speccify a fixed width/height in the layout by setting the height or width 2020-10-26 19:09:01 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
7ff0b4b73f Vertical layout 2020-10-26 14:19:12 +01:00
Olivier Goffart
aeade826fe New runtime implementation for the box layout
Currently only horizontal layout is supported
2020-10-26 14:19:12 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
9f08492258 Make sure that the ListView is not scrolled when there is enough room for all contents
Fixes #93
2020-10-21 09:47:33 +02:00
Simon Hausmann
a98da9ecc9 Draw rounded rectangles with anti-aliasing
Draw rounded rectangles using a distance function. This removes the need
to use lyon to tesselate the rounded corners and as a bonus it gives
anti-aliased borders.
2020-10-21 09:35:35 +02:00
Simon Hausmann
0f10202ff0 Partially implement row/colspans via cell distribution
This patch distributes the constraints evenly to the occupied cells.
That is not entirely correct, but it's an improvement for the appearance
of the todo app.
2020-10-20 18:06:58 +02:00
Olivier Goffart
bb332b56ca Fix Display for SharedString
It shoud not add the quotes
2020-10-20 14:43:17 +02:00
Simon Hausmann
1887b37af7 Remove premultiply_alpha from ARGBColor again
It's not safe to use with ARGBColor<u8> because of overflows, so instead let's
use it in the place where we need it and where the precision is given.
2020-10-19 18:45:33 +02:00
Olivier Goffart
1de39e5769 String concatenation 2020-10-19 18:37:15 +02:00
Simon Hausmann
6dd08b2109 Fix color blending when using the alpha channel
Given choice of ONE_MINUS_SRC_ALPHA blending function, we assume not
only that textures are pre-multiplied with their alpha (see commit
bf396ad578), the same applies also to
flat colors.

This fixes blending such as this:

    App := Window {
        Text {
            text: "Hello World";
        }
        Rectangle {
            color: #ff335588;
            width: 100%;
            height: 100%;
        }
    }
2020-10-19 17:21:03 +02:00
Olivier Goffart
b60567d7f2 Qt style: Use an QImage that is backed by a SharedArray
This way we have one copy less of the data
2020-10-19 11:35:57 +02:00
Olivier Goffart
14198052ac ArrayModel support in JS 2020-10-17 13:33:22 +02:00
Simon Hausmann
a695d551da Small typo fix 2020-10-16 14:59:58 +02:00
Olivier Goffart
58193ff1c3 Fix resizing of listview should recompute the layout 2020-10-16 11:09:12 +02:00