1 | #pragma once |
2 | // This file is auto-generated from api/cpp/cbindgen.rs |
3 | #include "slint_builtin_structs.h" |
4 | #include "slint_enums_internal.h" |
5 | namespace slint::cbindgen_private { |
6 | enum class KeyEventType : uint8_t; |
7 | /// The `KeyboardModifiers` struct provides booleans to indicate possible modifier keys on a keyboard, such as Shift, Control, etc. |
8 | /// It is provided as part of `KeyEvent`'s `modifiers` field. |
9 | /// |
10 | /// Keyboard shortcuts on Apple platforms typically use the Command key (⌘), such as Command+C for "Copy". On other platforms |
11 | /// the same shortcut is typically represented using Control+C. To make it easier to develop cross-platform applications, on macOS, |
12 | /// Slint maps the Command key to the control modifier, and the Control key to the meta modifier. |
13 | /// |
14 | /// On Windows, the Windows key is mapped to the meta modifier. |
15 | struct KeyboardModifiers { |
16 | /// Indicates the Alt key on a keyboard. |
17 | bool alt; |
18 | /// Indicates the Control key on a keyboard, except on macOS, where it is the Command key (⌘). |
19 | bool control; |
20 | /// Indicates the Shift key on a keyboard. |
21 | bool shift; |
22 | /// Indicates the Control key on macos, and the Windows key on Windows. |
23 | bool meta; |
24 | /// \private |
25 | friend bool operator==(const KeyboardModifiers&, const KeyboardModifiers&) = default; |
26 | /// \private |
27 | friend bool operator!=(const KeyboardModifiers&, const KeyboardModifiers&) = default; |
28 | }; |
29 | /// Represents a Pointer event sent by the windowing system. |
30 | /// This structure is passed to the `pointer-event` callback of the `TouchArea` element. |
31 | struct PointerEvent { |
32 | /// The button that was pressed or released |
33 | PointerEventButton button; |
34 | /// The kind of the event |
35 | PointerEventKind kind; |
36 | /// The keyboard modifiers pressed during the event |
37 | KeyboardModifiers modifiers; |
38 | /// \private |
39 | friend bool operator==(const PointerEvent&, const PointerEvent&) = default; |
40 | /// \private |
41 | friend bool operator!=(const PointerEvent&, const PointerEvent&) = default; |
42 | }; |
43 | /// Represents a Pointer scroll (or wheel) event sent by the windowing system. |
44 | /// This structure is passed to the `scroll-event` callback of the `TouchArea` element. |
45 | struct PointerScrollEvent { |
46 | /// The amount of pixel in the horizontal direction |
47 | float delta_x; |
48 | /// The amount of pixel in the vertical direction |
49 | float delta_y; |
50 | /// The keyboard modifiers pressed during the event |
51 | KeyboardModifiers modifiers; |
52 | /// \private |
53 | friend bool operator==(const PointerScrollEvent&, const PointerScrollEvent&) = default; |
54 | /// \private |
55 | friend bool operator!=(const PointerScrollEvent&, const PointerScrollEvent&) = default; |
56 | }; |
57 | /// This structure is generated and passed to the key press and release callbacks of the `FocusScope` element. |
58 | struct KeyEvent { |
59 | /// The unicode representation of the key pressed. |
60 | SharedString text; |
61 | /// The keyboard modifiers active at the time of the key press event. |
62 | KeyboardModifiers modifiers; |
63 | /// This field is set to true for key press events that are repeated, |
64 | /// i.e. the key is held down. It's always false for key release events. |
65 | bool repeat; |
66 | /// Indicates whether the key was pressed or released |
67 | KeyEventType event_type; |
68 | /// If the event type is KeyEventType::UpdateComposition or KeyEventType::CommitComposition, |
69 | /// then this field specifies what part of the current text to replace. |
70 | /// Relative to the offset of the pre-edit text within the text input element's text. |
71 | std::tuple<int32_t, int32_t, int32_t> replacement_range; |
72 | /// If the event type is KeyEventType::UpdateComposition, this is the new pre-edit text |
73 | SharedString preedit_text; |
74 | /// The selection within the preedit_text |
75 | std::tuple<int32_t, int32_t, int32_t> preedit_selection; |
76 | /// The new cursor position, when None, the cursor is put after the text that was just inserted |
77 | std::pair<int32_t, int32_t> cursor_position; |
78 | std::pair<int32_t, int32_t> anchor_position; |
79 | /// \private |
80 | friend bool operator==(const KeyEvent&, const KeyEvent&) = default; |
81 | /// \private |
82 | friend bool operator!=(const KeyEvent&, const KeyEvent&) = default; |
83 | }; |
84 | using slint::StandardListViewItem; |
85 | /// This is used to define the column and the column header of a TableView |
86 | struct TableColumn { |
87 | /// The title of the column header |
88 | SharedString title; |
89 | /// The minimum column width (logical length) |
90 | float min_width; |
91 | /// The horizontal column stretch |
92 | float horizontal_stretch; |
93 | /// Sorts the column |
94 | SortOrder sort_order; |
95 | /// the actual width of the column (logical length) |
96 | float width; |
97 | /// \private |
98 | friend bool operator==(const TableColumn&, const TableColumn&) = default; |
99 | /// \private |
100 | friend bool operator!=(const TableColumn&, const TableColumn&) = default; |
101 | }; |
102 | /// Value of the state property |
103 | /// A state is just the current state, but also has information about the previous state and the moment it changed |
104 | struct StateInfo { |
105 | /// The current state value |
106 | int32_t current_state; |
107 | /// The previous state |
108 | int32_t previous_state; |
109 | /// The instant in which the state changed last |
110 | uint64_t change_time; |
111 | /// \private |
112 | friend bool operator==(const StateInfo&, const StateInfo&) = default; |
113 | /// \private |
114 | friend bool operator!=(const StateInfo&, const StateInfo&) = default; |
115 | }; |
116 | } |
117 | |