ohos-arkui-binding 0.2.0

OpenHarmony's arkui binding for rust
Documentation
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
//! Module type::advanced wrappers and related types.

use ohos_arkui_sys::*;

use ohos_enum_derive::EnumFrom;

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_ListItemSwipeActionDirection,
    "ArkUI_ListItemSwipeActionDirection_ARKUI_LIST_ITEM_SWIPE_ACTION_DIRECTION_"
)]
#[cfg(feature = "api-21")]
/// Swipe direction used by list-item swipe actions.
pub enum ListItemSwipeActionDirection {
    Start,
    End,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_GestureRecognizerState,
    "ArkUI_GestureRecognizerState_ARKUI_GESTURE_RECOGNIZER_STATE_"
)]
/// State of a gesture recognizer lifecycle.
pub enum GestureRecognizerState {
    Ready,
    Detecting,
    Pending,
    Blocked,
    Successful,
    Failed,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_TextSpanType, "ArkUI_TextSpanType_ARKUI_TEXT_SPAN_TYPE_")]
#[cfg(feature = "api-22")]
/// Span type contained in rich text.
pub enum TextSpanType {
    Text,
    Image,
    Mixed,
    Default,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_TextResponseType,
    "ArkUI_TextResponseType_ARKUI_TEXT_RESPONSE_TYPE_"
)]
#[cfg(feature = "api-22")]
/// Trigger type that produced a text response.
pub enum TextResponseType {
    RightClick,
    LongPress,
    Select,
    Default,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_NavDestinationState,
    "ArkUI_NavDestinationState_ARKUI_NAV_DESTINATION_STATE_"
)]
/// Lifecycle states for navigation destinations.
pub enum NavDestinationState {
    OnShow,
    OnHide,
    OnAppear,
    OnDisappear,
    OnWillShow,
    OnWillHide,
    OnWillAppear,
    OnWillDisappear,
    OnBackPress,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_RouterPageState,
    "ArkUI_RouterPageState_ARKUI_ROUTER_PAGE_STATE_"
)]
/// Lifecycle states for router pages.
pub enum RouterPageState {
    AboutToAppear,
    AboutToDisappear,
    OnShow,
    OnHide,
    OnBackPress,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_HorizontalAlignment,
    "ArkUI_HorizontalAlignment_ARKUI_HORIZONTAL_ALIGNMENT_"
)]
/// Horizontal alignment values for layout options.
pub enum HorizontalAlignment {
    Start,
    Center,
    End,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_VerticalAlignment,
    "ArkUI_VerticalAlignment_ARKUI_VERTICAL_ALIGNMENT_"
)]
/// Vertical alignment values for layout options.
pub enum VerticalAlignment {
    Top,
    Center,
    Bottom,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_Axis, "ArkUI_Axis_ARKUI_AXIS_")]
/// Direction axis used by scrolling and layout APIs.
pub enum Axis {
    Vertical,
    Horizontal,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_BarrierDirection,
    "ArkUI_BarrierDirection_ARKUI_BARRIER_DIRECTION_"
)]
/// Direction used by relative-layout barriers.
pub enum BarrierDirection {
    Start,
    End,
    Top,
    Bottom,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_SwiperIndicatorType,
    "ArkUI_SwiperIndicatorType_ARKUI_SWIPER_INDICATOR_TYPE_"
)]
/// Indicator style used by swiper components.
pub enum SwiperIndicatorType {
    Dot,
    Digit,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_FontWeight, "ArkUI_FontWeight_ARKUI_FONT_WEIGHT_")]
/// Font-weight values mapped to ArkUI constants.
pub enum FontWeight {
    #[suffix("W100")]
    W100,
    #[suffix("W200")]
    W200,
    #[suffix("W300")]
    W300,
    #[suffix("W400")]
    W400,
    #[suffix("W500")]
    W500,
    #[suffix("W600")]
    W600,
    #[suffix("W700")]
    W700,
    #[suffix("W800")]
    W800,
    #[suffix("W900")]
    W900,
    Bold,
    Normal,
    Bolder,
    Lighter,
    Medium,
    Regular,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_ListItemSwipeEdgeEffect,
    "ArkUI_ListItemSwipeEdgeEffect_ARKUI_LIST_ITEM_SWIPE_EDGE_EFFECT_"
)]
/// Edge behavior when list-item swipe reaches bounds.
pub enum ListItemSwipeEdgeEffect {
    Spring,
    None,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_ListItemSwipeActionState,
    "ArkUI_ListItemSwipeActionState_ARKUI_LIST_ITEM_SWIPE_ACTION_STATE_"
)]
/// State of list-item swipe action animation.
pub enum ListItemSwipeActionState {
    Collapsed,
    Expanded,
    Actioning,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_NodeAdapterEventType,
    "ArkUI_NodeAdapterEventType_NODE_ADAPTER_EVENT_"
)]
/// Event types emitted by node-adapter callbacks.
pub enum NodeAdapterEventType {
    WillAttachToNode,
    WillDetachFromNode,
    OnGetNodeId,
    OnAddNodeToAdapter,
    OnRemoveNodeFromAdapter,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_PixelRoundCalcPolicy,
    "ArkUI_PixelRoundCalcPolicy_ARKUI_PIXELROUNDCALCPOLICY_"
)]
#[cfg(feature = "api-21")]
/// Policy controlling pixel-rounding calculations.
pub enum PixelRoundCalcPolicy {
    Noforceround,
    Forceceil,
    Forcefloor,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_DialogState, "ArkUI_DialogState_DIALOG_")]
#[cfg(feature = "api-19")]
/// Runtime state of native/custom dialogs.
pub enum DialogState {
    Uninitialized,
    Initialized,
    Appearing,
    Appeared,
    Disappearing,
    Disappeared,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_NodeContentEventType,
    "ArkUI_NodeContentEventType_NODE_CONTENT_EVENT_"
)]
/// Event types emitted by `NodeContent`.
pub enum NodeContentEventType {
    OnAttachToWindow,
    OnDetachFromWindow,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_AnimationFillMode,
    "ArkUI_AnimationFillMode_ARKUI_ANIMATION_FILL_MODE_"
)]
/// Fill behavior outside keyframe/animation active range.
pub enum AnimationFillMode {
    None,
    Forwards,
    Backwards,
    Both,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_AnimationDirection,
    "ArkUI_AnimationDirection_ARKUI_ANIMATION_DIRECTION_"
)]
/// Direction behavior for keyframe animations.
pub enum AnimationDirection {
    Normal,
    Reverse,
    Alternate,
    AlternateReverse,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_NodeDirtyFlag, "ArkUI_NodeDirtyFlag_NODE_")]
/// Dirty flags describing what changed in a node.
pub enum NodeDirtyFlag {
    NeedMeasure,
    NeedLayout,
    NeedRender,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_CoastingAxisEventPhase,
    "ArkUI_CoastingAxisEventPhase_ARKUI_COASTING_AXIS_EVENT_PHASE_"
)]
#[cfg(feature = "api-22")]
/// Phase of coasting-axis events.
pub enum CoastingAxisEventPhase {
    None,
    Begin,
    Update,
    End,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_KeyEventType, "ArkUI_KeyEventType_ARKUI_KEY_EVENT_")]
#[cfg(feature = "api-14")]
/// Key event action type.
pub enum KeyEventType {
    Unknown,
    Down,
    Up,
    LongPress,
    Click,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_KeySourceType, "ArkUI_KeySourceType_ARKUI_KEY_SOURCE_")]
#[cfg(feature = "api-14")]
/// Input source that generated a key event.
pub enum KeySourceType {
    Unknown,
    TypeMouse,
    TypeKeyboard,
    TypeJoystick,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_KeyIntension, "ArkUI_KeyIntension_ARKUI_KEY_INTENSION_")]
#[cfg(feature = "api-14")]
/// Key intention semantic mapped by ArkUI.
pub enum KeyIntension {
    Unknown,
    Up,
    Down,
    Left,
    Right,
    Select,
    Escape,
    Back,
    Forward,
    Menu,
    Home,
    PageUp,
    PageDown,
    ZoomOut,
    ZoomIn,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaPlayPause,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaFastForward,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaFastPlayback,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaNext,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaPrevious,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    MediaMute,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    VolumeUp,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    VolumeDown,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    Call,
    #[prefix("ArkUI_KeyIntension_ARKUI_KEY_INTENTION_")]
    Camera,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_TransitionEdge, "ArkUI_TransitionEdge_ARKUI_TRANSITION_EDGE_")]
/// Edge used by movement transition effects.
pub enum TransitionEdge {
    Top,
    Bottom,
    Start,
    End,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_NodeCustomEventType,
    "ArkUI_NodeCustomEventType_ARKUI_NODE_CUSTOM_EVENT_"
)]
/// Event types emitted by custom node callbacks.
pub enum NodeCustomEventType {
    OnMeasure,
    OnLayout,
    OnDraw,
    OnForegroundDraw,
    OnOverlayDraw,
    #[cfg(feature = "api-20")]
    OnDrawFront,
    #[cfg(feature = "api-20")]
    OnDrawBehind,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_LengthMetricUnit,
    "ArkUI_LengthMetricUnit_ARKUI_LENGTH_METRIC_UNIT_"
)]
/// Length units supported by metric-based APIs.
pub enum LengthMetricUnit {
    Default,
    Px,
    Vp,
    Fp,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_DragStatus, "ArkUI_DragStatus_ARKUI_DRAG_STATUS_")]
/// Real-time drag status in drag lifecycle events.
pub enum DragStatus {
    Unknown,
    Started,
    Ended,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_DragPreviewScaleMode,
    "ArkUI_DragPreviewScaleMode_ARKUI_DRAG_PREVIEW_SCALE_"
)]
/// Scaling mode for drag preview rendering.
pub enum DragPreviewScaleMode {
    Auto,
    Disabled,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_LevelMode, "ArkUI_LevelMode_ARKUI_LEVEL_MODE_")]
#[cfg(feature = "api-19")]
/// Level mode used by ArkUI rendering/effect APIs.
pub enum LevelMode {
    Overlay,
    Embedded,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_ImmersiveMode, "ArkUI_ImmersiveMode_ARKUI_IMMERSIVE_MODE_")]
#[cfg(feature = "api-19")]
/// Immersive mode behavior for system UI overlays.
pub enum ImmersiveMode {
    Default,
    Extend,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_ShadowStyle, "ArkUI_ShadowStyle_ARKUI_SHADOW_STYLE_")]
#[cfg(feature = "api-19")]
/// Predefined shadow style presets.
pub enum ShadowStyle {
    OuterDefaultXs,
    OuterDefaultSm,
    OuterDefaultMd,
    OuterDefaultLg,
    OuterFloatingSm,
    OuterFloatingMd,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(ArkUI_BlurStyle, "ArkUI_BlurStyle_ARKUI_BLUR_STYLE_")]
#[cfg(feature = "api-19")]
/// Blur style presets for background/foreground blur.
pub enum BlurStyle {
    Thin,
    Regular,
    Thick,
    BackgroundThin,
    BackgroundRegular,
    BackgroundThick,
    BackgroundUltraThick,
    None,
    ComponentUltraThin,
    ComponentThin,
    ComponentRegular,
    ComponentThick,
    ComponentUltraThick,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_KeyboardAvoidMode,
    "ArkUI_KeyboardAvoidMode_ARKUI_KEYBOARD_AVOID_MODE_"
)]
#[cfg(feature = "api-19")]
/// Keyboard avoidance behavior for focused content.
pub enum KeyboardAvoidMode {
    Default,
    None,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, EnumFrom)]
#[config(
    ArkUI_HoverModeAreaType,
    "ArkUI_HoverModeAreaType_ARKUI_HOVER_MODE_AREA_TYPE_"
)]
#[cfg(feature = "api-19")]
/// Area type used by hover-mode APIs.
pub enum HoverModeAreaType {
    Top,
    Bottom,
}