Commit graph

131 commits

Author SHA1 Message Date
Olivier Goffart
094287697a Add a FocusScope
C++ part not working because the Callback with arguments are not yet supported with C++
2021-01-20 10:00:19 +01:00
Simon Hausmann
5f265ffc09 Split up ComponentWindow::run() into show(), hide() and sixtyfps::run_event_loop()
This allows creating multiple windows for example, and it will allow for
showing windows in those tests that require a mapped window.

As a bonus, the run() function on generated components is not consuming
anymore.
2021-01-19 09:50:22 +01:00
Olivier Goffart
090039094f C++: rename component_type to static_vtable
Then there is no reference to "component" in vtable.h
2021-01-14 09:39:21 +01:00
Olivier Goffart
dfa25b96f7 Rename SharedArray to SharedVector 2020-12-18 10:26:07 +01:00
Simon Hausmann
625978fe1a WIP: Add an image-fit property to Image/ClippedImage 2020-12-15 10:26:54 +01:00
Olivier Goffart
a949570c57 Timer in C++ 2020-12-10 13:08:58 +01:00
Olivier Goffart
564d6a0744 Fix Popup in C++ 2020-12-01 10:24:37 +01:00
Olivier Goffart
8a64f10e84 Remove ComponentVtable::input_event
And the custom handling of the mouse grabber
2020-11-24 16:23:37 +01:00
Olivier Goffart
0c97b4f296 More use of the ItemRc 2020-11-24 13:42:34 +01:00
Simon Hausmann
3d85e45ec3 Add support for source clipping to the Image element
This allows rendering only a sub-rectangle of the original image, which
we can use right away in the sliding puzzle demo.
2020-11-23 15:46:59 +01:00
Olivier Goffart
08fe5f6c72 Add a Clip 2020-11-20 15:45:45 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Simon Hausmann
78fae068dd Use ComponentRc during item tree traversal
This is in preparation for allowing the run-time / items to clone VRc's
of the component.

ComponentVTable functions like visit_children_item contine to take a
ComponentRefPin as "self" parameter type, as a VRc would not be
supported by rust right now. That means the implementation then uses
self_weak to obtain a strong self-reference.
2020-11-19 17:04:01 +01:00
Simon Hausmann
9c9e6c7563 Clean up C++ repeated component creation
Centralize the self_weak setup to be emitted only once, in the create()
function. create() is now always emitted and equipped with a parent
parameter, for non-root components. This allows slightly simplifying the
generic repeater code.
2020-11-19 16:41:26 +01:00
Simon Hausmann
1608d66ee8 Fix warning about missing virtual destructor
We'd never call/need it, but clang keeps complaining about it.
2020-11-19 15:33:26 +01:00
Olivier Goffart
3fce3e6f1b Get rid of the component in the C++ ComponentWindow::run 2020-11-19 13:42:52 +01:00
Olivier Goffart
c50fc6f51c More work on state properties with transitions
C++ set the proper binding for StateInfo state binding
2020-11-19 13:31:18 +01:00
Olivier Goffart
cfa9413861 More work on the state binding for transition:
When there is a transition, turn the state property into a property of StateInfo

Not yet implemented for C++
2020-11-19 12:43:28 +01:00
Simon Hausmann
9c998c9e56 Add an into_dyn helper function to C++ VRc
This will be used in more places in the future, so centralize the ugly re-interpret cast.
2020-11-18 15:00:52 +01:00
Simon Hausmann
a2839e03c2 Cpp: Add a self_weak to repeated components
The main struct has it, and sub-components should have it, too.
2020-11-18 12:00:30 +01:00
Simon Hausmann
7a5113ece1 Free graphics resources without item tree traversal 2020-11-18 08:49:57 +01:00
Simon Hausmann
54ee7b3556 Cpp: Give each generated component a ComponentWindow
That's a counted reference to the window in the run-time and avoids the need to do the parent->parent->window dance.
2020-11-16 16:59:57 +01:00
Simon Hausmann
c258a907f0 Simplify event loop start-up
Move the layout constraint tracker into the window where we can apply
the constraints right before drawing, instead of doing that from within
the event loop. This allows to remove the component parameter from the
run function.
2020-11-12 15:04:48 +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
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
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
3194dd21ca Expose VRc to the C++ API
(Not yet in use in the code gen)
2020-11-10 12:43:19 +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
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
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Olivier Goffart
356cd8c3ee Fix compileation with clang
The operator== must be in the same namespace as the struct for ADL to work proprerly
2020-11-01 16:09:42 +01:00
Olivier Goffart
cc85aa818d C++: implements operator== for StandardListViewItem 2020-11-01 15:56:19 +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
4a702243d1 Fix C++ layouts 2020-10-27 08:16:02 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
e4e601de83 Draw the frame properly around the native scrollview 2020-10-16 10:45:17 +02:00
Simon Hausmann
48602c3b5c Fix MSVC warning about #pragma GCC
Only use the pragma with GCC and Clang
2020-10-13 23:00:12 +02:00
Simon Hausmann
a37d42fa0e Add an init function to the Item vtable
This will be called by the run-time and will allow items to set up
bindings that rely on internals that should not be exposed to the
compiler/runtime.
2020-10-12 16:49:44 +02:00
Olivier Goffart
d8f7139f48 Fix Native StandardListView with C++ 2020-10-08 17:18:22 +02:00
Olivier Goffart
58b176d10c ListView in C++
This make sure the layout is correct, but does not implement the
optimization to only instentiate visible items
2020-10-05 11:32:43 +02:00
Olivier Goffart
6d9af3449a C++ model for the todo example in C++ 2020-09-30 18:30:19 +02:00
Olivier Goffart
f01977ca06 Fix removing from model in C++ 2020-09-30 18:17:15 +02:00
Simon Hausmann
9ad8968529 Add support for the initial_focus synthetic property
Setting it will translate to a set_focus_item call in the constructor.

This implements parts of #55
2020-09-30 15:11:01 +02:00
Olivier Goffart
2050f08f1e Ability to make change to the model property 2020-09-30 15:04:32 +02:00
Olivier Goffart
f4f4775a19 Refactor the C++ Repeater to do the same as the Rust one 2020-09-29 14:20:43 +02:00
Olivier Goffart
6662e1ff00 Proper Scrollbar on the native style 2020-09-28 18:13:13 +02:00
Olivier Goffart
6dd0d178a0 Rename ScrollArea to ScrollView 2020-09-28 10:52:29 +02:00