Olivier Goffart
b2b5645195
Allow property of type object, and conversion between objects
2020-09-03 08:39:23 +02:00
Olivier Goffart
f1ad78bc25
Qt style support for the rust backend
...
Need to set the SIXTYFPS_STYLE=native env variable while compiling
2020-09-01 12:25:11 +02:00
Olivier Goffart
6d41b1981d
Move the Qt style to a new backend: the Qt backend
...
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow
This also adds a "default" backend, whose goal is to select the proper
backend at compile time
2020-08-31 17:26:04 +02:00
Simon Hausmann
5dbd0b213c
Add support for grid layout padding
2020-08-28 15:06:14 +02:00
Simon Hausmann
7976a4057f
Improve handling of nested layouts
...
We support directly nested layouts, but we did not support indirect
nesting:
GridLayout {
Rectangle {
l2 := GridLayout { ... }
}
}
This patch fixes that by detecting this scenario and merging the layout
info of the element (Rectangle) and the layout inside (l2). This makes
it much easier to create re-usable components that use layouts
themselves and allows placing them in layouts.
2020-08-28 15:06:14 +02:00
Simon Hausmann
2806633254
Minor cleanup for grid layout handling in the interpreter
...
Let's re-use the evaluated spacing from the earlier layout
tree traversal.
2020-08-28 12:55:56 +02:00
Olivier Goffart
80dd7dcb04
Allow to specify the canvas id when creating a new window with wasm
2020-08-26 17:01:17 +02:00
Olivier Goffart
58cdaeb8dd
Update license header to mention that commertial option are available
2020-08-26 13:23:42 +02:00
Simon Hausmann
2823f32692
Apply license headers to all non-binary/non-json sources
2020-08-17 17:55:20 +02:00
Simon Hausmann
3a463fa104
Closes: Free GL resources when destroying items in the interpreter #12
2020-08-13 17:56:18 +02:00
Olivier Goffart
7e1af72a2e
Implement minimum/maximum width/height properties
2020-08-12 14:00:51 +02:00
Simon Hausmann
d3a474af26
Move corelib::Component and friends back into their dedicated component module
2020-08-12 11:39:07 +02:00
Simon Hausmann
b21aa4f9e7
Rename PropertyListenerScope to PropertyTracker
2020-08-12 11:31:33 +02:00
Simon Hausmann
0df86d7eeb
Move corelib::abi::datastructures::Component to corelib
2020-08-12 10:53:03 +02:00
Simon Hausmann
62a8b15f09
Move ItemVTable and frieds to corelib::items
...
To avoid ambiguities regarding the use of FieldOffset, the BuiltinItem
proc-macro uses fully-qualified type names now.
2020-08-12 10:10:51 +02:00
Simon Hausmann
aafb96cb93
Get rid of abi::datastructures::WindowProperties
...
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
9fd7d35b0d
Remove stray scale_factor properties
2020-08-11 15:10:43 +02:00
Simon Hausmann
c1f91e38ca
Move the window scale factor into GraphicsWindow
2020-08-11 13:42:51 +02:00
Simon Hausmann
f2eec61968
Add a window to the top-level component
...
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Olivier Goffart
e013ea6c50
Refactor the interpreter by trying to use FieldOffset insdead of usize for offsets
...
Give a unique identifier lifetime to instance so that they cannot be mixed safely
2020-08-11 10:22:16 +02:00
Olivier Goffart
23fe57827d
Fix event handling in interpreter
...
The type was not right
2020-08-10 17:25:35 +02:00
Olivier Goffart
9af5c0b69d
Slider in Qt style
2020-08-10 16:01:06 +02:00
Olivier Goffart
36243ccdf7
Traverse item front to back for input events
2020-08-10 10:45:02 +02:00
Olivier Goffart
2c276bba63
Handle grabbing in the interpreter
2020-08-07 16:06:49 +02:00
Olivier Goffart
5aa7ee86fe
Use a newtype for VisitChildrenResult instead of just isize
...
Makes the code easier to unserstand
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40
WIP input events
...
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Olivier Goffart
479173c22f
Implement spacing in GridLayout
2020-08-05 15:42:38 +02:00
Simon Hausmann
5dfb9aa875
Fix initialize size of printer demo
...
Map it to 800x600 logical pixels for a better initial look.
This implements respecting the initial values for width/height and tries
to apply them to the window begin created.
The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Olivier Goffart
2dd3cecc5a
Add a SpinBox
2020-08-05 12:56:13 +02:00
Olivier Goffart
894d44e3ac
Correctly print syntax errors in the viewer
...
(instead of panicking because of invalid synstax_node invariant)
2020-08-04 12:59:49 +02:00
Simon Hausmann
4f0bf0b982
Rename dpi to (window) scale_factor
2020-08-04 09:01:30 +02:00
Simon Hausmann
0252d2ac34
Move slice out of abi
2020-08-03 17:41:16 +02:00
Simon Hausmann
9b13b363c3
Move corelib::abi::properties to corelib::properties
...
And the bits that are only there for the C binding are now in an ffi sub-module.
2020-08-03 17:32:28 +02:00
Olivier Goffart
1bfd708784
Change the field_offsets() function to a FIELD_OFFSETS associated const
2020-08-03 16:04:55 +02:00
Simon Hausmann
a662d36dc3
Move ItemTreeNode from datastructures into item_tree
2020-08-03 14:38:08 +02:00
Simon Hausmann
45b02e9a3e
Move the item visitor bits from datastructures into item_tree
2020-08-03 14:10:32 +02:00
Simon Hausmann
b05a11945e
Move datastructures::LayoutInfo into layout
2020-08-03 13:31:43 +02:00
Simon Hausmann
ce7f66320b
Move datastructures::Resource into graphics
...
It's only used for graphics at the moment and used
for image resources.
2020-08-03 12:47:05 +02:00
Olivier Goffart
00c32e9c6d
vtable: remove the convinient type alias from the macro
...
If one really need them, they can be implemented by the user
2020-08-03 11:03:24 +02:00
Simon Hausmann
69beab5957
Rename corelib::abi::primitives to corelib::items
2020-08-03 10:32:03 +02:00
Simon Hausmann
c29791fbaa
Replace a few qualified abi::primitives paths with uses
...
That'll make it easier to do the next rename :-)
2020-08-03 10:13:32 +02:00
Simon Hausmann
480a8470f5
Remove dead code
2020-07-30 19:51:33 +02:00
Simon Hausmann
1265c7f3d1
Fix crash with path layouts in the interpreter
2020-07-30 15:32:24 +02:00
Simon Hausmann
3f58d011c2
Add support for nested grid layouts to the interpreter
2020-07-30 14:46:08 +02:00
Olivier Goffart
9760cf4969
Begin to implement a Flickable
...
The implementation is still very rough and will need to be improved
2020-07-30 14:36:21 +02:00
Simon Hausmann
94433b9bf1
Implement get_property_ref for Layouts in the interpreter
...
We can fetch the Property<> references from the custom_properties hash
by using the property name that was changed in the moving declarations
pass.
2020-07-30 10:24:03 +02:00
Simon Hausmann
e881d89bf9
Get rid of visible x/y properties in GridLayout
...
It doesn't really make sense to have them in the API, the grid layout is
supposed to "own" the surrounding space. That can be an element and then
it should be a (0, 0) and distribute the element's width/height, or in
the future it can be a cell of a grid layout. Then there's an (x/y), but
that's implicit / hidden.
2020-07-29 18:52:22 +02:00
Simon Hausmann
4fccbba29d
Prepare for "virtualizing" the grid layout's width/height
...
Instead of storing the "within" element that we unconditionally take the
"width" and "height" properties from, let's pass through a property
reference expression to the width/height to use. For now that's still
the layout parent's width/height, but with this it can be replaced in
the future to refer to a "virtual" property that belongs to parent cell.
2020-07-29 18:52:22 +02:00
Simon Hausmann
00271a3746
Extend the layout data structure in the compiler to allow nesting
2020-07-29 18:52:22 +02:00
Simon Hausmann
f853843bc4
Store layouts in a common enum and vector
...
That'll make it easier later to allow for nesting them.
2020-07-29 18:52:02 +02:00