ribir_macros 0.0.1-alpha.2

Ribir is a framework for building modern native/wasm cross-platform user interface applications.
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
builtin! {
  PerformedLayoutListener {
    #[doc="action perform after widget performed layout."]
    on_performed_layout: Box<dyn for<'r> FnMut(LifeCycleCtx<'r>)>,
    #[doc= "return an observable stream of the performed layout event."]
    performed_layout_stream: LifecycleSubject,
  }

  PointerDownListener {
    #[doc="specify the event handler for the pointer down event in bubble phase."]
    on_pointer_down: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer down event in bubble phase."]
    fn pointer_down_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerDownCaptureListener {
    #[doc="specify the event handler for the pointer down event in capture phase."]
    on_pointer_down_capture: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer down event in capture phase."]
    fn pointer_down_capture_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerUpListener {
    #[doc="specify the event handler for the pointer up event in bubble phase."]
    on_pointer_up: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer up event in bubble phase."]
    fn pointer_up_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerUpCaptureListener {
    #[doc="specify the event handler for the pointer up event in capture phase."]
    on_pointer_up_capture: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer up event in capture phase."]
    fn pointer_up_capture_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerMoveListener {
    #[doc="specify the event handler for the pointer move event in bubble phase."]
    on_pointer_move: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer move event in bubble phase."]
    fn pointer_move_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerMoveCaptureListener {
    #[doc="specify the event handler for the pointer move event in capture phase."]
    on_pointer_move_capture: impl FnMut(&mut PointerEvent),
    #[doc="return an observable stream of the pointer move event in bubble phase."]
    fn pointer_move_capture_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  TapListener {
    #[doc="specify the event handler for the pointer tap event in bubble phase."]
    on_tap: impl FnMut(&mut PointerEvent),
    #[doc="specify the event handler for the pointer double tap event in bubble phase."]
    on_double_tap: Box<dyn for<'r> FnMut(&'r mut PointerEvent)>,
    #[doc="specify the event handler for the pointer triple tap event in bubble phase."]
    on_triple_tap: Box<dyn for<'r> FnMut(&'r mut PointerEvent)>,
    #[doc="specify the event handler for the pointer `x` times tap event in bubble phase."]
    on_x_times_tap: (usize, Box<dyn for<'r> FnMut(&'r mut PointerEvent)>),

    #[doc= "return an observable stream of the pointer tap event in bubble phase."]
    fn tap_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,

    #[doc=" Return an observable stream of double tap event in bubble phase."]
    fn double_tap_stream(
      &self,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,

    #[doc="Return an observable stream of tripe tap event in bubble phase."]
    fn triple_tap_stream(
      &self,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,

    #[doc=" Return an observable stream of x-tap event that user tapped 'x' \
    times in the specify duration `dur` in bubble phase."]
    fn x_times_tap_stream(
      &self,
      x: usize,
      dur: Duration,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,
  }

  TapCaptureListener {
    #[doc="specify the event handler for the pointer tap event in capture phase."]
    on_tap_capture: impl FnMut(&mut PointerEvent),
    #[doc="specify the event handler for the pointer double tap event in capture phase."]
    on_double_tap_capture: Box<dyn for<'r> FnMut(&'r mut PointerEvent)>,
    #[doc="specify the event handler for the pointer triple tap event in capture phase."]
    on_triple_tap_capture: Box<dyn for<'r> FnMut(&'r mut PointerEvent)>,
    #[doc="specify the event handler for the pointer `x` times tap event in capture phase."]
    on_x_times_tap_capture: (usize, Box<dyn for<'r> FnMut(&'r mut PointerEvent)>),
    
    #[doc= "return an observable stream of the pointer tap event in capture phase."]
    fn tap_capture_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,

    #[doc="return an observable stream of double tap event in capture phase."]
    fn double_tap_capture_stream(
      &self,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,

    #[doc="Return an observable stream of tripe tap event in capture phase."]
    fn triple_tap_capture_stream(
      &self,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,

    #[doc=" Return an observable stream of x-tap event that user tapped 'x' \
    times in the specify duration `dur` in capture phase."]
    fn x_times_tap_capture_stream(
      &self,
      x: usize,
      dur: Duration,
    ) -> FilterMapOp<
      MutRefItemSubject<'static, PointerEvent, ()>,
      impl FnMut(&mut PointerEvent) -> Option<&mut PointerEvent>,
      &mut PointerEvent,
    >,
  }

  PointerCancelListener {
    #[doc="specify the event handler to process pointer cancel event."]
    on_pointer_cancel: impl FnMut(&mut PointerEvent),
    #[doc= "return an observable stream of the pointer cancel event"]
    fn pointer_cancel_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerEnterListener {
    #[doc="specify the event handler when pointer enter this widget."]
    on_pointer_enter: impl FnMut(&mut PointerEvent),
    #[doc= "return an observable stream of the pointer enter event"]
    fn pointer_enter_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  PointerLeaveListener {
    #[doc="specify the event handler when pointer leave this widget."]
    on_pointer_leave: impl FnMut(&mut PointerEvent),
    #[doc= "return an observable stream of the pointer leave event"]
    fn pointer_leave_stream(&self) -> MutRefItemSubject<'static, PointerEvent, ()>,
  }

  FocusNode {
    #[doc="Indicates whether the widget should automatically get focus when the window loads."]
    auto_focus: bool,
    #[doc="indicates that widget can be focused, and where it participates in \
          sequential keyboard navigation (usually with the Tab key, hence the name."]
    tab_index: i16,
  }

  RequestFocus{
    #[doc="request the this node to be focused."]
    fn request_focus(&self),
    #[doc="removes the focus from this node."]
    fn unfocus(&self),
  }

  FocusListener {
    #[doc="specify the event handler to process focus event."]
    on_focus: impl FnMut(&mut FocusEvent),
    #[doc= "return an observable stream of the pointer focus event"]
    fn focus_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  BlurListener {
    #[doc="specify the event handler to process blur event."]
    on_blur: impl FnMut(&mut FocusEvent),
    #[doc= "return an observable stream of the pointer blur event"]
    fn blur_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  FocusInListener {
    #[doc="specify the event handler to process focusin event in bubble phase."]
    on_focus_in: impl FnMut(&mut FocusEvent),
    #[doc="return an observable stream of the pointer focus-in event in bubble phase."]
    fn focus_in_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  FocusInCaptureListener {
    #[doc="specify the event handler to process focusin event in capture phase."]
    on_focus_in_capture: impl FnMut(&mut FocusEvent),
    #[doc="return an observable stream of the pointer focus-in event in capture phase."]
    fn focus_in_capture_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  FocusOutListener{
    #[doc="specify the event handler to process focusout event in bubble phase."]
    on_focus_out: impl FnMut(&mut FocusEvent),
    #[doc="return an observable stream of the pointer focus-out event in bubble phase."]
    fn focus_out_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  FocusOutCaptureListener {
    #[doc="specify the event handler to process focusout event in capture phase."]
    on_focus_out_capture: impl FnMut(&mut FocusEvent),
    #[doc="return an observable stream of the pointer focus-out event in capture phase."]
    fn focus_out_capture_stream(&self) -> MutRefItemSubject<'static, FocusEvent, ()>,
  }

  HasFocus {
    #[doc="return if the widget has focus."]
    fn has_focus(&self) -> bool,
  }

  KeyDownListener {
    #[doc="specify the event handler when keyboard press down in bubble phase."]
    on_key_down: impl FnMut(&mut KeyboardEvent),
    #[doc="return an observable stream of the key down event in bubble phase."]
    fn key_down_stream(&self) -> MutRefItemSubject<'static, KeyboardEvent, ()>,
  }

  KeyDownCaptureListener {
    #[doc="specify the event handler when keyboard press down in capture phase."]
    on_key_down_capture: impl FnMut(&mut KeyboardEvent),
    #[doc="return an observable stream of the key down event in capture phase."]
    fn key_down_capture_stream(&self) -> MutRefItemSubject<'static, KeyboardEvent, ()>,
  }

  KeyUpListener {
    #[doc="specify the event handler when a key is released in bubble phase."]
    on_key_up: impl FnMut(&mut KeyboardEvent),
    #[doc="return an observable stream of the key up event in bubble phase."]
    fn key_up_stream(&self) -> MutRefItemSubject<'static, KeyboardEvent, ()>,
  }

  KeyUpCaptureListener {
    #[doc="specify the event handler when a key is released in capture phase."]
    on_key_up_capture: impl FnMut(&mut KeyboardEvent),
    #[doc="return an observable stream of the key up event in capture phase."]
    fn key_up_capture_stream(&self) -> MutRefItemSubject<'static, KeyboardEvent, ()>,
  }

  CharsListener {
    #[doc="specify the event handler when received unicode characters in bubble phase."]
    on_chars: impl FnMut(&mut CharsEvent),
    #[doc="return an observable stream of the chars event in bubble phase."]
    fn chars_stream(&self) -> MutRefItemSubject<'static, CharsEvent, ()>,
  }

  CharsCaptureListener {
    #[doc="specify the event handler when received unicode characters in capture phase."]
    on_chars_capture: impl FnMut(&mut CharsEvent),
    #[doc="return an observable stream of the chars event in capture phase."]
    fn chars_capture_stream(&self) -> MutRefItemSubject<'static, CharsEvent, ()>,
  }

  WheelListener {
    #[doc="specify the event handler when user moving a mouse wheel or similar input device in bubble phase."]
    on_wheel: impl FnMut(&mut WheelEvent),
    #[doc="return an observable stream of the wheel event in bubble phase."]
    fn key_down_stream(&self) -> MutRefItemSubject<'static, WheelEvent, ()>,
  }

  WheelCaptureListener {
    #[doc="specify the event handler when user moving a mouse wheel or similar input device in capture phase."]
    on_wheel_capture: impl FnMut(&mut WheelEvent),
    #[doc="return an observable stream of the wheel event in capture phase."]
    fn wheel_capture_stream(&self) -> MutRefItemSubject<'static, WheelEvent, ()>,
  }

  MouseHover {
    #[doc="return if the pointer is hover on the widget"]
    fn mouse_hover(&self) -> bool,
  }

  PointerPressed {
    #[doc="return if the widget is pressed"]
    fn pointer_pressed(&self) -> bool,
  }

  FittedBox {
    #[doc=" set how its child should be resized to its box."]
    box_fit: BoxFit,
  }

  BoxDecoration {
    #[doc="specify the background of the widget box."]
    background: Brush,
    #[doc="specify the border of the widget which draw above the background"]
    border: Border,
    #[doc= "specify how rounded the corners have of the widget."]
    border_radius: Radius,
  }

  Padding {
    #[doc="set the padding area on all four sides of a widget."]
    padding: EdgeInsets
  }

  LayoutBox {
    #[doc= "return the rect after layout of the widget"]
    fn layout_rect(&self) -> Rect,
    #[doc= "return the position relative to parent after layout of the widget"]
    fn layout_pos(&self) -> Point,
    #[doc= "return the size after layout of the widget"]
    fn layout_size(&self) -> Size,
    #[doc= "return the left position relative parent after layout of the widget"]
    fn layout_left(&self) -> f32,
    #[doc= "return the top position relative parent after layout of the widget"]
    fn layout_top(&self) -> f32,
    #[doc= "return the width after layout of the widget"]
    fn layout_width(&self) -> f32,
    #[doc= "return the height after layout of the widget"]
    fn layout_height(&self) -> f32,
  }

  Cursor {
    #[doc="assign cursor to the widget."]
    cursor: CursorIcon
  }

  Margin {
    #[doc="expand space around widget wrapped."]
    margin: impl EdgeInsets,
  }

  ScrollableWidget {
    #[doc= "enumerate to describe which direction allow widget to scroll."]
    scrollable: Scrollable,
    #[doc= "specify the scroll position of this widget, also means that the host widget scrollable."]
    scroll_pos: Point,
    #[doc= "return the scroll view of the scrollable widget"]
    fn scroll_view_size(&self) -> Size,
    #[doc= "return the content widget size of the scrollable widget."]
    fn scroll_content_size(&self) -> Size,
    #[doc= "jump to the special position."]
    fn jump_to(&mut self, left_top: Point)
  }

  TransformWidget {
    #[doc="A widget that applies a transformation its child. Doesn't change size, only apply painting"]
    transform: Transform
  }

  HAlignWidget {
    #[doc="describe how widget align to its box in x-axis."]
    h_align: HAlign,
  }

  VAlignWidget {
    #[doc="describe how widget align to its box in y-axis."]
    v_align: VAlign,
  }

  LeftAnchor {
    #[doc="use to anchor child constraints with the left edge of parent widget."]
    left_anchor: PositionUnit,
  }

  RightAnchor {
    #[doc="use to anchor child constraints with the right edge of parent widget."]
    right_anchor: PositionUnit,
  }

  TopAnchor {
    #[doc="use to anchor child constraints with the top edge of parent widget"]
    top_anchor: PositionUnit,
  }

  BottomAnchor {
    #[doc="use to anchor child constraints with the bottom edge of parent widget."]
    bottom_anchor: PositionUnit,
  }

  Visibility {
    #[doc="Whether to show or hide a child"]
    visible: bool
  }

  Opacity {
    #[doc="Opacity is the degree to which content behind an element is hidden, and is the opposite of transparency."]
    opacity: f32
  }

  MountedListener {
    #[doc="action perform after widget be added to the widget tree."]
    on_mounted: Box<dyn for<'r> FnMut(LifeCycleCtx<'r>, MountedType)>,
    #[doc= "return an observable stream of the widget mounted event"]
    mounted_stream: LifecycleSubject,
  }

  DisposedListener {
    #[doc="action perform after widget remove from widget tree."]
    on_disposed: Box<dyn for<'r> FnMut(LifeCycleCtx<'r>, DisposedType)>,
    #[doc= "return an observable stream of the widget disposed event"]
    disposed_stream: LifecycleSubject,
  }

  DelayDropWidget {
    #[doc= "The widget delay the drop of its child until the field delay_drop_until is false, but not affect its dispose event emit time. It's useful to ensure the disappear-animate display fully."]
    delay_drop_until: bool,
  }
}