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/// Marks the property as dirty and notifies dependencies.
104void slint_property_set_constant(const PropertyHandleOpaque *handle);
105
106/// Destroy handle
107void slint_property_drop(PropertyHandleOpaque *handle);
108
109/// Internal function to set up a property animation to the specified target value for an integer property.
110void slint_property_set_animated_value_int(const PropertyHandleOpaque *handle,
111 int32_t from,
112 int32_t to,
113 const PropertyAnimation *animation_data);
114
115/// Internal function to set up a property animation to the specified target value for a float property.
116void slint_property_set_animated_value_float(const PropertyHandleOpaque *handle,
117 float from,
118 float to,
119 const PropertyAnimation *animation_data);
120
121/// Internal function to set up a property animation to the specified target value for a color property.
122void slint_property_set_animated_value_color(const PropertyHandleOpaque *handle,
123 Color from,
124 Color to,
125 const PropertyAnimation *animation_data);
126
127/// Internal function to set up a property animation to the specified target value for a brush property.
128void slint_property_set_animated_value_brush(const PropertyHandleOpaque *handle,
129 const Brush *from,
130 const Brush *to,
131 const PropertyAnimation *animation_data);
132
133/// Internal function to set up a property animation between values produced by the specified binding for an integer property.
134void slint_property_set_animated_binding_int(const PropertyHandleOpaque *handle,
135 void (*binding)(void*, int*),
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 float property.
143void slint_property_set_animated_binding_float(const PropertyHandleOpaque *handle,
144 void (*binding)(void*, float*),
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 color property.
152void slint_property_set_animated_binding_color(const PropertyHandleOpaque *handle,
153 void (*binding)(void*, Color*),
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 property animation between values produced by the specified binding for a brush property.
161void slint_property_set_animated_binding_brush(const PropertyHandleOpaque *handle,
162 void (*binding)(void*, Brush*),
163 void *user_data,
164 void (*drop_user_data)(void*),
165 const PropertyAnimation *animation_data,
166 PropertyAnimation (*transition_data)(void *user_data,
167 uint64_t *start_instant));
168
169/// Internal function to set up a state binding on a Property<StateInfo>.
170void slint_property_set_state_binding(const PropertyHandleOpaque *handle,
171 int32_t (*binding)(void*),
172 void *user_data,
173 void (*drop_user_data)(void*));
174
175/// Initialize the first pointer of the PropertyTracker.
176/// `out` is assumed to be uninitialized
177/// slint_property_tracker_drop need to be called after that
178void slint_property_tracker_init(PropertyTrackerOpaque *out);
179
180/// Call the callback with the user data. Any properties access within the callback will be registered.
181/// Any currently evaluated bindings or property trackers will be notified if accessed properties are changed.
182void slint_property_tracker_evaluate(const PropertyTrackerOpaque *handle,
183 void (*callback)(void *user_data),
184 void *user_data);
185
186/// Call the callback with the user data. Any properties access within the callback will be registered.
187/// Any currently evaluated bindings or property trackers will be not notified if accessed properties are changed.
188void slint_property_tracker_evaluate_as_dependency_root(const PropertyTrackerOpaque *handle,
189 void (*callback)(void *user_data),
190 void *user_data);
191
192/// Query if the property tracker is dirty
193bool slint_property_tracker_is_dirty(const PropertyTrackerOpaque *handle);
194
195/// Destroy handle
196void slint_property_tracker_drop(PropertyTrackerOpaque *handle);
197
198/// Construct a ChangeTracker
199void slint_change_tracker_construct(ChangeTracker *ct);
200
201/// Drop a ChangeTracker
202void slint_change_tracker_drop(ChangeTracker *ct);
203
204/// initialize the change tracker
205void slint_change_tracker_init(const ChangeTracker *ct,
206 void *user_data,
207 void (*drop_user_data)(void *user_data),
208 bool (*eval_fn)(void *user_data),
209 void (*notify_fn)(void *user_data));
210
211/// return the current animation tick for the `animation-tick` function
212uint64_t slint_animation_tick();
213
214/// Initialize the callback.
215/// slint_callback_drop must be called.
216void slint_callback_init(CallbackOpaque *out);
217
218/// Emit the callback
219void slint_callback_call(const CallbackOpaque *sig, const void *arg, void *ret);
220
221/// Set callback handler.
222///
223/// The binding has signature fn(user_data)
224void slint_callback_set_handler(const CallbackOpaque *sig,
225 void (*binding)(void *user_data, const void *arg, void *ret),
226 void *user_data,
227 void (*drop_user_data)(void*));
228
229/// Destroy callback
230void slint_callback_drop(CallbackOpaque *handle);
231
232} // extern "C"
233
234} // namespace cbindgen_private
235} // namespace slint
236

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