1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
// Copyright © SixtyFPS GmbH <info@slint-ui.com>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
//! This module contains all enums exposed in the .slint language.
// NOTE: when changing the documentation of enums, you need to update
// the markdown file with `cargo xtask enumdocs`
// cSpell: ignore combobox enumdocs evenodd grabbable horizontalbox horizontallayout nesw spinbox standardbutton standardtableview verticalbox verticallayout
/// Call a macro with every enum exposed in the .slint language
///
/// ## Example
/// ```rust
/// macro_rules! print_enums {
/// ($( $(#[$enum_doc:meta])* enum $Name:ident { $( $(#[$value_doc:meta])* $Value:ident,)* })*) => {
/// $(println!("{} => [{}]", stringify!($Name), stringify!($($Value),*));)*
/// }
/// }
/// i_slint_common::for_each_enums!(print_enums);
/// ```
#[macro_export]
macro_rules! for_each_enums {
($macro:ident) => {
$macro element.
enum TextHorizontalAlignment {
/// The text will be aligned with the left edge of the containing box.
Left,
/// The text will be horizontally centered within the containing box.
Center,
/// The text will be aligned to the right of the containing box.
Right,
}
/// This enum describes the different types of alignment of text along the vertical axis of a [`Text`](elements.md#text) element.
enum TextVerticalAlignment {
/// The text will be aligned to the top of the containing box.
Top,
/// The text will be vertically centered within the containing box.
Center,
/// The text will be aligned to the bottom of the containing box.
Bottom,
}
/// This enum describes the how the text wrap if it is too wide to fit in the [`Text`](elements.md#text) width.
enum TextWrap {
/// The text won't wrap, but instead will overflow.
NoWrap,
/// The text will be wrapped at word boundaries.
WordWrap,
}
/// This enum describes the how the text appear if it is too wide to fit in the [`Text`](elements.md#text) width.
enum TextOverflow {
/// The text will simply be clipped.
Clip,
/// The text will be elided with `…`.
Elide,
}
/// This enum describes whether an event was rejected or accepted by an event handler.
enum EventResult {
/// The event is rejected by this event handler and may then be handled by the parent item
Reject,
/// The event is accepted and won't be processed further
Accept,
}
/// This enum describes the different ways of deciding what the inside of a shape described by a path shall be.
enum FillRule {
/// The ["nonzero" fill rule as defined in SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule#nonzero).
Nonzero,
/// The ["evenodd" fill rule as defined in SVG](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule#evenodd)
Evenodd,
}
/// Use this enum to add standard buttons to a [`Dialog`](elements.md#dialog). The look and positioning
/// of these [`StandardButton`](widgets.md#standardbutton)s depends on the environment
/// (OS, UI environment, etc.) the application runs in.
enum StandardButtonKind {
/// A "OK" button that accepts a [`Dialog`](elements.md#dialog), closing it when clicked.
Ok,
/// A "Cancel" button that rejects a [`Dialog`](elements.md#dialog), closing it when clicked.
Cancel,
/// A "Apply" button that should accept values from a
/// [`Dialog`](elements.md#dialog) without closing it.
Apply,
/// A "Close" button, which should close a [`Dialog`](elements.md#dialog) without looking at values.
Close,
/// A "Reset" button, which should reset the [`Dialog`](elements.md#dialog) to its initial state.
Reset,
/// A "Help" button, which should bring up context related documentation when clicked.
Help,
/// A "Yes" button, used to confirm an action.
Yes,
/// A "No" button, used to deny an action.
No,
/// A "Abort" button, used to abort an action.
Abort,
/// A "Retry" button, used to retry a failed action.
Retry,
/// A "Ignore" button, used to ignore a failed action.
Ignore,
}
/// This enum represents the value of the `dialog-button-role` property which can be added to
/// any element within a [`Dialog`](elements.md#dialog) to put that item in the button row, and its exact position
/// depends on the role and the platform.
enum DialogButtonRole {
/// This isn't a button meant to go into the bottom row
None,
/// This is the role of the main button to click to accept the dialog. e.g. "Ok" or "Yes"
Accept,
/// This is the role of the main button to click to reject the dialog. e.g. "Cancel" or "No"
Reject,
/// This is the role of the "Apply" button
Apply,
/// This is the role of the "Reset" button
Reset,
/// This is the role of the "Help" button
Help,
/// This is the role of any other button that performs another action.
Action,
}
/// The enum reports what happened to the `PointerEventButton` in the event
enum PointerEventKind {
/// The action was cancelled.
Cancel,
/// The button was pressed.
Down,
/// The button was released.
Up,
}
/// This enum describes the different types of buttons for a pointer event,
/// typically on a mouse or a pencil.
#[non_exhaustive]
enum PointerEventButton {
/// A button that is none of left, right or middle. For example
/// this is used for a fourth button on a mouse with many buttons.
Other,
/// The left button.
Left,
/// The right button.
Right,
/// The center button.
Middle,
}
/// This enum represents different types of mouse cursors. It's a subset of the mouse cursors available in CSS.
/// For details and pictograms see the [MDN Documentation for cursor](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#values).
/// Depending on the backend and used OS unidirectional resize cursors may be replaced with bidirectional ones.
enum MouseCursor {
/// The systems default cursor.
Default,
/// No cursor is displayed.
None,
//context_menu,
/// A cursor indicating help information.
Help,
/// A pointing hand indicating a link.
Pointer,
/// The program is busy but can still be interacted with.
Progress,
/// The program is busy.
Wait,
//cell,
/// A crosshair.
Crosshair,
/// A cursor indicating selectable text.
Text,
//vertical_text,
/// An alias or shortcut is being created.
Alias,
/// A copy is being created.
Copy,
/// Something is to be moved.
Move,
/// Something can't be dropped here.
NoDrop,
/// An action isn't allowed
NotAllowed,
/// Something is grabbable.
Grab,
/// Something is being grabbed.
Grabbing,
//all_scroll,
/// Indicating that a column is resizable horizontally.
ColResize,
/// Indicating that a row is resizable vertically.
RowResize,
/// Unidirectional resize north.
NResize,
/// Unidirectional resize east.
EResize,
/// Unidirectional resize south.
SResize,
/// Unidirectional resize west.
WResize,
/// Unidirectional resize north-east.
NeResize,
/// Unidirectional resize north-west.
NwResize,
/// Unidirectional resize south-east.
SeResize,
/// Unidirectional resize south-west.
SwResize,
/// Bidirectional resize east-west.
EwResize,
/// Bidirectional resize north-south.
NsResize,
/// Bidirectional resize north-east-south-west.
NeswResize,
/// Bidirectional resize north-west-south-east.
NwseResize,
//zoom_in,
//zoom_out,
}
/// This enum defines how the source image shall fit into an [`Image`](elements.md#image) element.
enum ImageFit {
/// Scales and stretches the source image to fit the width and height of the [`Image`](elements.md#image) element.
Fill,
/// The source image is scaled to fit into the [`Image`](elements.md#image) element's dimension while preserving the aspect ratio.
Contain,
/// The source image is scaled to cover into the [`Image`](elements.md#image) element's dimension while preserving the aspect ratio. If the aspect ratio of the source image doesn't match the element's one, then the image will be clipped to fit.
Cover,
}
/// This enum specifies how the source image will be scaled.
enum ImageRendering {
/// The image is scaled with a linear interpolation algorithm.
Smooth,
/// The image is scaled with the nearest neighbor algorithm.
Pixelated,
}
/// This enum is used to define the type of the input field. Currently this only differentiates between
/// text and password inputs but in the future it could be expanded to also define what type of virtual keyboard
/// should be shown, for example.
enum InputType {
/// The default value. This will render all characters normally
Text,
/// This will render all characters with a character that defaults to "*"
Password,
}
/// Enum representing the [alignment](../concepts/layouting.md#alignment) property of a
/// [`HorizontalBox`](widgets.md#horizontalbox), a [`VerticalBox`](widgets.md#verticalbox),
/// a [`HorizontalLayout`, or `VerticalLayout`](elements.md#verticallayout-and-horizontallayout).
enum LayoutAlignment {
/// Use the minimum size of all elements in a layout, distribute remaining space
/// based on `*-stretch` among all elements.
Stretch,
/// Use the preferred size for all elements, distribute remaining space evenly before the
/// first and after the last element.
Center,
/// Use the preferred size for all elements, put remaining space after the last element.
Start,
/// Use the preferred size for all elements, put remaining space before the first
/// element.
End,
/// Use the preferred size for all elements, distribute remaining space evenly between
/// elements.
SpaceBetween,
/// Use the preferred size for all elements, distribute remaining space evenly before the
/// first element, after the last element and between elements.
SpaceAround,
}
/// PathEvent is a low-level data structure describing the composition of a path. Typically it is
/// generated at compile time from a higher-level description, such as SVG commands.
enum PathEvent {
/// The beginning of the path.
Begin,
/// A straight line on the path.
Line,
/// A quadratic bezier curve on the path.
Quadratic,
/// A cubic bezier curve on the path.
Cubic,
/// The end of the path that remains open.
EndOpen,
/// The end of a path that is closed.
EndClosed,
}
/// This enum represents the different values for the `accessible-role` property, used to describe the
/// role of an element in the context of assistive technology such as screen readers.
enum AccessibleRole {
/// The element isn't accessible.
None,
/// The element is a [`Button`](widgets.md#button) or behaves like one.
Button,
/// The element is a [`CheckBox`](widgets.md#checkbox) or behaves like one.
Checkbox,
/// The element is a [`ComboBox`](widgets.md#combobox) or behaves like one.
Combobox,
/// The element is a [`Slider`](widgets.md#slider) or behaves like one.
Slider,
/// The element is a [`SpinBox`](widgets.md#spinbox) or behaves like one.
Spinbox,
/// The element is a [`Tab`](widgets.md#tabwidget) or behaves like one.
Tab,
/// The role for a [`Text`](elements.md#text) element. It's automatically applied.
Text,
}
/// This enum represents the different values of the `sort-order` property.
/// It's used to sort a [`StandardTableView`](widgets.md#standardtableview) by a column.
enum SortOrder {
/// The column is unsorted.
Unsorted,
/// The column is sorted in ascending order.
Ascending,
/// The column is sorted in descending order.
Descending,
}
];
};
}