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> |
10 | |
11 | namespace slint { |
12 | namespace cbindgen_private { |
13 | |
14 | /// The TimerMode specifies what should happen after the timer fired. |
15 | /// |
16 | /// Used by the [`Timer::start()`] function. |
17 | enum class TimerMode : uint8_t { |
18 | /// A SingleShot timer is fired only once. |
19 | SingleShot, |
20 | /// A Repeated timer is fired repeatedly until it is stopped or dropped. |
21 | Repeated, |
22 | }; |
23 | |
24 | extern "C" { |
25 | |
26 | /// Start a timer with the given mode, duration in millisecond and callback. A timer id may be provided (first argument). |
27 | /// A value of -1 for the timer id means a new timer is to be allocated. |
28 | /// The (new) timer id is returned. |
29 | /// The timer MUST be destroyed with slint_timer_destroy. |
30 | uintptr_t slint_timer_start(uintptr_t id, |
31 | TimerMode mode, |
32 | uint64_t duration, |
33 | void (*callback)(void*), |
34 | void *user_data, |
35 | void (*drop_user_data)(void*)); |
36 | |
37 | /// Execute a callback with a delay in millisecond |
38 | void slint_timer_singleshot(uint64_t delay, |
39 | void (*callback)(void*), |
40 | void *user_data, |
41 | void (*drop_user_data)(void*)); |
42 | |
43 | /// Stop a timer and free its raw data |
44 | void slint_timer_destroy(uintptr_t id); |
45 | |
46 | /// Stop a timer |
47 | void slint_timer_stop(uintptr_t id); |
48 | |
49 | /// Restart a repeated timer |
50 | void slint_timer_restart(uintptr_t id); |
51 | |
52 | /// Returns true if the timer is running; false otherwise. |
53 | bool slint_timer_running(uintptr_t id); |
54 | |
55 | } // extern "C" |
56 | |
57 | } // namespace cbindgen_private |
58 | } // namespace slint |
59 | |