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
// 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.
/// 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);
/// ```
// NOTE: the documentation for .slint enum is in builtin_elements.md
#[macro_export]
macro_rules! for_each_enums {
($macro:ident) => {
$macro![
enum StandardButtonKind {
ok,
cancel,
apply,
close,
reset,
help,
yes,
no,
abort,
retry,
ignore,
}
enum DialogButtonRole {
none,
accept,
reject,
apply,
reset,
action,
help,
}
enum PointerEventKind {
cancel,
down,
up,
}
enum PointerEventButton {
none,
left,
right,
middle,
}
enum MouseCursor {
default,
none,
//context_menu,
help,
pointer,
progress,
wait,
//cell,
crosshair,
text,
//vertical_text,
alias,
copy,
r#move,
no_drop,
not_allowed,
grab,
grabbing,
//all_scroll,
col_resize,
row_resize,
n_resize,
e_resize,
s_resize,
w_resize,
ne_resize,
nw_resize,
se_resize,
sw_resize,
ew_resize,
ns_resize,
nesw_resize,
nwse_resize,
//zoom_in,
//zoom_out,
}
enum ImageFit {
fill,
contain,
cover,
}
enum ImageRendering {
smooth,
pixelated,
}
enum FillRule {
nonzero,
evenodd,
}
/// This enum defines the input type in a text input which for now only distinguishes a normal
/// input from a password input
enum InputType {
/// This type is used for a normal text input
text,
/// This type is used for password inputs where the characters are represented as *'s
password,
}
enum TextHorizontalAlignment {
left,
center,
right,
}
enum TextVerticalAlignment {
top,
center,
bottom,
}
enum TextWrap {
no_wrap,
word_wrap,
}
enum TextOverflow {
clip,
elide,
}
/// Enum representing the alignment property of a BoxLayout or HorizontalLayout
enum LayoutAlignment {
stretch,
center,
start,
end,
space_between,
space_around,
}
/// 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.
end_open,
/// The end of a path that is closed.
end_closed,
}
/// What is returned from the event handler
enum EventResult {
reject,
accept,
}
/// This enum defines the different kinds of key events that can happen.
enum KeyEventType {
/// A key on a keyboard was pressed.
KeyPressed,
/// A key on a keyboard was released.
KeyReleased,
}
];
};
}
/// add an underscore to a C++ keyword used as an enum
pub fn cpp_escape_keyword(kw: &str) -> &str {
match kw {
"default" => "default_",
other => other,
}
}