1#pragma once
2
3/* Generated with cbindgen:0.26.0 */
4
5#include <cstdarg>
6#include <cstdint>
7#include <cstdlib>
8#include <ostream>
9#include <new>
10namespace slint { class Color; class Brush; }
11
12namespace slint {
13namespace cbindgen_private {
14
15using PropertyHandle = uintptr_t;
16
17/// Has the same layout as PropertyHandle
18struct PropertyHandleOpaque {
19 PropertyHandle _0;
20
21 bool operator==(const PropertyHandleOpaque& other) const {
22 return _0 == other._0;
23 }
24 bool operator!=(const PropertyHandleOpaque& other) const {
25 return _0 != other._0;
26 }
27};
28
29/// Opaque type representing the PropertyTracker
30struct PropertyTrackerOpaque {
31 uintptr_t dependencies;
32 uintptr_t dep_nodes;
33 uintptr_t vtable;
34 bool dirty;
35
36 bool operator==(const PropertyTrackerOpaque& other) const {
37 return dependencies == other.dependencies &&
38 dep_nodes == other.dep_nodes &&
39 vtable == other.vtable &&
40 dirty == other.dirty;
41 }
42 bool operator!=(const PropertyTrackerOpaque& other) const {
43 return dependencies != other.dependencies ||
44 dep_nodes != other.dep_nodes ||
45 vtable != other.vtable ||
46 dirty != other.dirty;
47 }
48};
49
50/// Has the same layout as Callback<_>
51struct CallbackOpaque {
52 const void *_0;
53 const void *_1;
54
55 bool operator==(const CallbackOpaque& other) const {
56 return _0 == other._0 &&
57 _1 == other._1;
58 }
59 bool operator!=(const CallbackOpaque& other) const {
60 return _0 != other._0 ||
61 _1 != other._1;
62 }
63};
64
65extern "C" {
66
67/// Initialize the first pointer of the Property. Does not initialize the content.
68/// `out` is assumed to be uninitialized
69void slint_property_init(PropertyHandleOpaque *out);
70
71/// To be called before accessing the value
72void slint_property_update(const PropertyHandleOpaque *handle, void *val);
73
74/// Mark the fact that the property was changed and that its binding need to be removed, and
75/// the dependencies marked dirty.
76/// To be called after the `value` has been changed
77void slint_property_set_changed(const PropertyHandleOpaque *handle, const void *value);
78
79/// Set a binding
80///
81/// The current implementation will do usually two memory allocation:
82/// 1. the allocation from the calling code to allocate user_data
83/// 2. the box allocation within this binding
84/// It might be possible to reduce that by passing something with a
85/// vtable, so there is the need for less memory allocation.
86void slint_property_set_binding(const PropertyHandleOpaque *handle,
87 void (*binding)(void *user_data, void *pointer_to_value),
88 void *user_data,
89 void (*drop_user_data)(void*),
90 bool (*intercept_set)(void *user_data, const void *pointer_to_Value),
91 bool (*intercept_set_binding)(void *user_data, void *new_binding));
92
93/// Set a binding using an already allocated building holder
94///
95void slint_property_set_binding_internal(const PropertyHandleOpaque *handle, void *binding);
96
97/// Returns whether the property behind this handle is marked as dirty
98bool slint_property_is_dirty(const PropertyHandleOpaque *handle);
99
100/// Marks the property as dirty and notifies dependencies.
101void slint_property_mark_dirty(const PropertyHandleOpaque *handle);
102
103/// Destroy handle
104void slint_property_drop(PropertyHandleOpaque *handle);
105
106/// Internal function to set up a property animation to the specified target value for an integer property.
107void slint_property_set_animated_value_int(const PropertyHandleOpaque *handle,
108 int32_t from,
109 int32_t to,
110 const PropertyAnimation *animation_data);
111
112/// Internal function to set up a property animation to the specified target value for a float property.
113void slint_property_set_animated_value_float(const PropertyHandleOpaque *handle,
114 float from,
115 float to,
116 const PropertyAnimation *animation_data);
117
118/// Internal function to set up a property animation to the specified target value for a color property.
119void slint_property_set_animated_value_color(const PropertyHandleOpaque *handle,
120 Color from,
121 Color to,
122 const PropertyAnimation *animation_data);
123
124/// Internal function to set up a property animation between values produced by the specified binding for an integer property.
125void slint_property_set_animated_binding_int(const PropertyHandleOpaque *handle,
126 void (*binding)(void*, int*),
127 void *user_data,
128 void (*drop_user_data)(void*),
129 const PropertyAnimation *animation_data,
130 PropertyAnimation (*transition_data)(void *user_data,
131 uint64_t *start_instant));
132
133/// Internal function to set up a property animation between values produced by the specified binding for a float property.
134void slint_property_set_animated_binding_float(const PropertyHandleOpaque *handle,
135 void (*binding)(void*, float*),
136 void *user_data,
137 void (*drop_user_data)(void*),
138 const PropertyAnimation *animation_data,
139 PropertyAnimation (*transition_data)(void *user_data,
140 uint64_t *start_instant));
141
142/// Internal function to set up a property animation between values produced by the specified binding for a color property.
143void slint_property_set_animated_binding_color(const PropertyHandleOpaque *handle,
144 void (*binding)(void*, Color*),
145 void *user_data,
146 void (*drop_user_data)(void*),
147 const PropertyAnimation *animation_data,
148 PropertyAnimation (*transition_data)(void *user_data,
149 uint64_t *start_instant));
150
151/// Internal function to set up a property animation between values produced by the specified binding for a brush property.
152void slint_property_set_animated_binding_brush(const PropertyHandleOpaque *handle,
153 void (*binding)(void*, Brush*),
154 void *user_data,
155 void (*drop_user_data)(void*),
156 const PropertyAnimation *animation_data,
157 PropertyAnimation (*transition_data)(void *user_data,
158 uint64_t *start_instant));
159
160/// Internal function to set up a state binding on a Property<StateInfo>.
161void slint_property_set_state_binding(const PropertyHandleOpaque *handle,
162 int32_t (*binding)(void*),
163 void *user_data,
164 void (*drop_user_data)(void*));
165
166/// Initialize the first pointer of the PropertyTracker.
167/// `out` is assumed to be uninitialized
168/// slint_property_tracker_drop need to be called after that
169void slint_property_tracker_init(PropertyTrackerOpaque *out);
170
171/// Call the callback with the user data. Any properties access within the callback will be registered.
172/// Any currently evaluated bindings or property trackers will be notified if accessed properties are changed.
173void slint_property_tracker_evaluate(const PropertyTrackerOpaque *handle,
174 void (*callback)(void *user_data),
175 void *user_data);
176
177/// Call the callback with the user data. Any properties access within the callback will be registered.
178/// Any currently evaluated bindings or property trackers will be not notified if accessed properties are changed.
179void slint_property_tracker_evaluate_as_dependency_root(const PropertyTrackerOpaque *handle,
180 void (*callback)(void *user_data),
181 void *user_data);
182
183/// Query if the property tracker is dirty
184bool slint_property_tracker_is_dirty(const PropertyTrackerOpaque *handle);
185
186/// Destroy handle
187void slint_property_tracker_drop(PropertyTrackerOpaque *handle);
188
189/// return the current animation tick for the `animation-tick` function
190uint64_t slint_animation_tick();
191
192/// Initialize the callback.
193/// slint_callback_drop must be called.
194void slint_callback_init(CallbackOpaque *out);
195
196/// Emit the callback
197void slint_callback_call(const CallbackOpaque *sig, const void *arg, void *ret);
198
199/// Set callback handler.
200///
201/// The binding has signature fn(user_data)
202void slint_callback_set_handler(const CallbackOpaque *sig,
203 void (*binding)(void *user_data, const void *arg, void *ret),
204 void *user_data,
205 void (*drop_user_data)(void*));
206
207/// Destroy callback
208void slint_callback_drop(CallbackOpaque *handle);
209
210} // extern "C"
211
212} // namespace cbindgen_private
213} // namespace slint
214

source code of slint/target/debug/build/slint-cpp-d3acc71f258707cf/out/generated_include/slint_properties_internal.h