because we don't want the lowered state property to look like we set a property on it.
Also do the ensure_window before because it need to be done before to be assigned
the default color
Some code like this was generated:
`if (*self->checkbox_31.get_checked()).get()`
the remove_parentheses function removed a parentheses that it shouldn't have removed
Commit da169b0e3c surfaced the issue, which
existed earlier:
In such a scenarion the C++ struct has only one member (the sub-component) and it wasn't initialized,
because we never called visit_sub_component.
Fix the dialog test when not inlining, because it declared all these
xxx-clicked aliases and if we don't propagate their usage, they will be
optimized away
focus() is implemented by calling set_focus() on the window with the absolute item
index as a parameter. The
generate_item_indices pass generates local item indicies,
which need to made absolute.
Sadly there exists a gap in the item tree between the root element of a sub-component
and its children. Therefore each sub-component gets two members passed to the constructor,
the tree_index and tree_index_of_first_child.
The former is to be used when the local index is zero (indicates the root).
The latter is used as base for any children.
In a tree like this:
```
SubCompo := Rectangle { Image {} }
MainCompo := Window {
TouchArea {}
SubCompo {}
Text {
Path {}
}
}
```
The path element would have a local item index of 4, which is wrong. Right before the path
there would be the child(ren) of the sub-component, which
were not accounted for.
The variable in C++ sub-components is sometimes unused. We could try to lazily emit it, but
that requires more work and this is distracting :-). This silencing should hopefully also work for gcc.
This reverts commit fde3846392 because it
breaks the gcc build ("error: 'maybe_unused' attribute ignored
[-Werror=attributes]"). Will need a different solution that works for
clang (which warns about m_root_ being unused).
This reverts commit b4a2d0a902.
That was not the correct fix, because we need that for
aliases to global callbacks (these can't be actual two way binding
at runtime)
Calling init on sub-components with self_weak as argument only works after self_weak is
initialized, which happens in create(). So a new init() function for root components is called afterwards.
We never ended up passing the right index but always zero.
Fix by rewriting build_item_tree to be basically the same as build_array_helper,
with two differences:
(1) we maintain absolute and relative children offsets and parent indices
(2) When traversing over the children of an element there are two scenarios: either
the element is a sub-component, in which case we iterate through the children of the root element,
or we can use ElementRc's children directly
We need to maintain the order of declaration and the sub-trees
of children need to be emitted before continuing with the parent.
This fixes the tab widget in the galler.y
There's a check that verifies that the relative item indices match, between what
the item tree building code in the generator sees and the generate_item_indices pass.
The counting of the relative indices was incorrect with regards to the sub-trees.
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.
It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.