@effindomv2/fui-rs 0.1.22 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/README.md +12 -0
- package/package.json +1 -1
- package/src/controls/anti_selection_area.rs +0 -18
- package/src/controls/button.rs +14 -42
- package/src/controls/checkbox.rs +7 -0
- package/src/controls/combobox.rs +7 -6
- package/src/controls/context_menu.rs +38 -5
- package/src/controls/dialog.rs +41 -3
- package/src/controls/dropdown.rs +2 -2
- package/src/controls/form.rs +16 -20
- package/src/controls/internal/button_presenter.rs +5 -5
- package/src/controls/internal/checkbox_indicator_presenter.rs +1 -1
- package/src/controls/internal/pressable_labeled_control.rs +21 -7
- package/src/controls/internal/selectable_popup_list.rs +2 -2
- package/src/controls/internal/text_input_core.rs +38 -68
- package/src/controls/internal/text_input_presenter.rs +4 -4
- package/src/controls/mod.rs +11 -4
- package/src/controls/popup.rs +35 -20
- package/src/controls/radio_button.rs +7 -0
- package/src/controls/radio_group.rs +17 -0
- package/src/controls/selection_area.rs +0 -18
- package/src/controls/shared.rs +2 -17
- package/src/controls/switch.rs +7 -0
- package/src/controls/tests.rs +230 -6
- package/src/controls/text_area.rs +28 -142
- package/src/controls/text_editor_surface.rs +167 -0
- package/src/controls/text_input.rs +30 -144
- package/src/lib.rs +26 -20
- package/src/mobile_text_selection_toolbar.rs +2 -2
- package/src/node/core.rs +451 -60
- package/src/node/custom_drawable.rs +20 -0
- package/src/node/flex_box.rs +39 -47
- package/src/node/grid.rs +43 -128
- package/src/node/helpers.rs +34 -43
- package/src/node/image.rs +47 -56
- package/src/node/mod.rs +398 -73
- package/src/node/scroll_bar.rs +6 -0
- package/src/node/scroll_box.rs +8 -21
- package/src/node/scroll_view.rs +144 -13
- package/src/node/svg_node.rs +47 -66
- package/src/node/text_node.rs +358 -79
- package/src/node/virtual_list.rs +17 -0
- package/src/popup_presenter.rs +31 -0
- package/src/text.rs +59 -0
- package/src/text_indices.rs +48 -0
|
@@ -121,6 +121,8 @@ impl ThemeBindable for CustomDrawable {
|
|
|
121
121
|
#[cfg(test)]
|
|
122
122
|
mod tests {
|
|
123
123
|
use super::*;
|
|
124
|
+
use crate::app::Application;
|
|
125
|
+
use crate::ffi::{self, Call};
|
|
124
126
|
|
|
125
127
|
fn assert_flex_box_surface<T: FlexBoxSurface>() {}
|
|
126
128
|
fn assert_theme_bindable<T: ThemeBindable>() {}
|
|
@@ -145,4 +147,22 @@ mod tests {
|
|
|
145
147
|
drop(drawable);
|
|
146
148
|
invalidator.mark_dirty();
|
|
147
149
|
}
|
|
150
|
+
|
|
151
|
+
#[test]
|
|
152
|
+
fn custom_drawable_requests_focus_through_node_trait() {
|
|
153
|
+
ffi::test::reset();
|
|
154
|
+
let drawable = CustomDrawable::new(|_| {});
|
|
155
|
+
drawable.focusable(true, 0);
|
|
156
|
+
Application::mount(drawable.clone());
|
|
157
|
+
let handle = drawable.handle().raw();
|
|
158
|
+
ffi::test::take_calls();
|
|
159
|
+
|
|
160
|
+
drawable.focus_now();
|
|
161
|
+
|
|
162
|
+
let calls = ffi::test::take_calls();
|
|
163
|
+
assert!(calls.iter().any(
|
|
164
|
+
|call| matches!(call, Call::RequestFocus { handle: requested } if *requested == handle)
|
|
165
|
+
));
|
|
166
|
+
Application::unmount();
|
|
167
|
+
}
|
|
148
168
|
}
|
package/src/node/flex_box.rs
CHANGED
|
@@ -476,18 +476,7 @@ impl FlexBox {
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
pub fn focusable(&self, enabled: bool, tab_index: i32) -> &Self {
|
|
479
|
-
|
|
480
|
-
self.retained_node_ref().require_interactive();
|
|
481
|
-
}
|
|
482
|
-
let mut core = self.core.borrow_mut();
|
|
483
|
-
core.behavior.focusable = Some((enabled, tab_index));
|
|
484
|
-
let interactive = core.behavior.enabled && core.behavior.inherited_enabled;
|
|
485
|
-
let has_built_handle = core.handle != NodeHandle::INVALID;
|
|
486
|
-
drop(core);
|
|
487
|
-
if has_built_handle {
|
|
488
|
-
ui::set_focusable(self.handle().raw(), interactive && enabled, tab_index);
|
|
489
|
-
self.notify_retained_mutation();
|
|
490
|
-
}
|
|
479
|
+
Node::focusable(self, enabled, tab_index);
|
|
491
480
|
self
|
|
492
481
|
}
|
|
493
482
|
|
|
@@ -607,54 +596,38 @@ impl FlexBox {
|
|
|
607
596
|
self
|
|
608
597
|
}
|
|
609
598
|
|
|
610
|
-
pub
|
|
611
|
-
self
|
|
612
|
-
if self.has_built_handle() {
|
|
613
|
-
ui::set_semantic_disabled(self.handle().raw(), true, disabled);
|
|
614
|
-
self.notify_retained_mutation();
|
|
615
|
-
}
|
|
599
|
+
pub fn semantic_disabled(&self, disabled: bool) -> &Self {
|
|
600
|
+
Node::semantic_disabled(self, disabled);
|
|
616
601
|
self
|
|
617
602
|
}
|
|
618
603
|
|
|
619
604
|
pub fn semantic_checked(&self, state: SemanticCheckedState) -> &Self {
|
|
620
|
-
self
|
|
605
|
+
Node::semantic_checked(self, state);
|
|
621
606
|
self
|
|
622
607
|
}
|
|
623
608
|
|
|
624
|
-
pub
|
|
625
|
-
self
|
|
626
|
-
if self.has_built_handle() {
|
|
627
|
-
ui::set_semantic_selected(self.handle().raw(), true, selected);
|
|
628
|
-
self.notify_retained_mutation();
|
|
629
|
-
}
|
|
609
|
+
pub fn semantic_selected(&self, selected: bool) -> &Self {
|
|
610
|
+
Node::semantic_selected(self, selected);
|
|
630
611
|
self
|
|
631
612
|
}
|
|
632
613
|
|
|
633
614
|
pub fn semantic_value_range(&self, value_now: f32, value_min: f32, value_max: f32) -> &Self {
|
|
634
|
-
self
|
|
635
|
-
Some((value_now, value_min, value_max));
|
|
615
|
+
Node::semantic_value_range(self, value_now, value_min, value_max);
|
|
636
616
|
self
|
|
637
617
|
}
|
|
638
618
|
|
|
639
619
|
pub fn semantic_orientation(&self, orientation: Orientation) -> &Self {
|
|
640
|
-
self
|
|
620
|
+
Node::semantic_orientation(self, orientation);
|
|
641
621
|
self
|
|
642
622
|
}
|
|
643
623
|
|
|
644
624
|
pub fn request_semantic_announcement(&self) -> &Self {
|
|
645
|
-
self
|
|
646
|
-
.borrow_mut()
|
|
647
|
-
.behavior
|
|
648
|
-
.request_semantic_announcement = true;
|
|
625
|
+
Node::request_semantic_announcement(self);
|
|
649
626
|
self
|
|
650
627
|
}
|
|
651
628
|
|
|
652
629
|
pub fn visibility(&self, visibility: Visibility) -> &Self {
|
|
653
|
-
self
|
|
654
|
-
if self.has_built_handle() {
|
|
655
|
-
ui::set_visibility(self.handle().raw(), visibility as u32);
|
|
656
|
-
self.notify_retained_layout_mutation();
|
|
657
|
-
}
|
|
630
|
+
Node::visibility(self, visibility);
|
|
658
631
|
self
|
|
659
632
|
}
|
|
660
633
|
|
|
@@ -725,28 +698,48 @@ impl FlexBox {
|
|
|
725
698
|
|
|
726
699
|
pub fn flex_basis(&self, basis: f32) -> &Self {
|
|
727
700
|
self.core.borrow_mut().behavior.flex_basis = Some(basis);
|
|
701
|
+
if self.has_built_handle() {
|
|
702
|
+
ui::set_flex_basis(self.handle().raw(), basis);
|
|
703
|
+
self.notify_retained_layout_mutation();
|
|
704
|
+
}
|
|
728
705
|
self
|
|
729
706
|
}
|
|
730
707
|
|
|
731
708
|
pub fn justify_content(&self, justify: JustifyContent) -> &Self {
|
|
732
709
|
self.host_style_layers.borrow_mut().local.justify_content = Some(justify);
|
|
733
710
|
self.core.borrow_mut().behavior.justify_content = Some(justify);
|
|
711
|
+
if self.has_built_handle() {
|
|
712
|
+
ui::set_justify_content(self.handle().raw(), justify as u32);
|
|
713
|
+
self.notify_retained_mutation();
|
|
714
|
+
}
|
|
734
715
|
self
|
|
735
716
|
}
|
|
736
717
|
|
|
737
718
|
pub fn align_items(&self, align: AlignItems) -> &Self {
|
|
738
719
|
self.host_style_layers.borrow_mut().local.align_items = Some(align);
|
|
739
720
|
self.core.borrow_mut().behavior.align_items = Some(align);
|
|
721
|
+
if self.has_built_handle() {
|
|
722
|
+
ui::set_align_items(self.handle().raw(), align as u32);
|
|
723
|
+
self.notify_retained_mutation();
|
|
724
|
+
}
|
|
740
725
|
self
|
|
741
726
|
}
|
|
742
727
|
|
|
743
728
|
pub fn align_self(&self, align: AlignSelf) -> &Self {
|
|
744
729
|
self.core.borrow_mut().behavior.align_self = Some(align);
|
|
730
|
+
if self.has_built_handle() {
|
|
731
|
+
ui::set_align_self(self.handle().raw(), align as u32);
|
|
732
|
+
self.notify_retained_mutation();
|
|
733
|
+
}
|
|
745
734
|
self
|
|
746
735
|
}
|
|
747
736
|
|
|
748
737
|
pub fn margin(&self, left: f32, top: f32, right: f32, bottom: f32) -> &Self {
|
|
749
738
|
self.core.borrow_mut().behavior.margin = Some((left, top, right, bottom));
|
|
739
|
+
if self.has_built_handle() {
|
|
740
|
+
ui::set_margin(self.handle().raw(), left, top, right, bottom);
|
|
741
|
+
self.notify_retained_layout_mutation();
|
|
742
|
+
}
|
|
750
743
|
self
|
|
751
744
|
}
|
|
752
745
|
|
|
@@ -989,11 +982,19 @@ impl FlexBox {
|
|
|
989
982
|
|
|
990
983
|
pub fn flex_wrap(&self, wrap: FlexWrap) -> &Self {
|
|
991
984
|
self.core.borrow_mut().behavior.flex_wrap = Some(wrap);
|
|
985
|
+
if self.has_built_handle() {
|
|
986
|
+
ui::set_flex_wrap(self.handle().raw(), wrap as u32);
|
|
987
|
+
self.notify_retained_layout_mutation();
|
|
988
|
+
}
|
|
992
989
|
self
|
|
993
990
|
}
|
|
994
991
|
|
|
995
992
|
pub fn clip_to_bounds(&self, clip: bool) -> &Self {
|
|
996
993
|
self.core.borrow_mut().behavior.clip_to_bounds = Some(clip);
|
|
994
|
+
if self.has_built_handle() {
|
|
995
|
+
ui::set_clip_to_bounds(self.handle().raw(), clip);
|
|
996
|
+
self.notify_retained_mutation();
|
|
997
|
+
}
|
|
997
998
|
self
|
|
998
999
|
}
|
|
999
1000
|
|
|
@@ -1007,16 +1008,7 @@ impl FlexBox {
|
|
|
1007
1008
|
self
|
|
1008
1009
|
}
|
|
1009
1010
|
|
|
1010
|
-
pub fn
|
|
1011
|
-
self.core.borrow_mut().behavior.is_shared_size_scope = enabled;
|
|
1012
|
-
if self.has_built_handle() {
|
|
1013
|
-
ui::set_is_shared_size_scope(self.handle().raw(), enabled);
|
|
1014
|
-
self.notify_retained_layout_mutation();
|
|
1015
|
-
}
|
|
1016
|
-
self
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
pub fn on_click(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
1011
|
+
pub fn on_pointer_click(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
1020
1012
|
self.core.borrow_mut().handlers.pointer_click = Some(Rc::new(handler));
|
|
1021
1013
|
self.retained_node_ref().require_interactive();
|
|
1022
1014
|
self
|
package/src/node/grid.rs
CHANGED
|
@@ -55,11 +55,8 @@ impl Node for Grid {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
fn build_self(&self) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
&self.props.borrow(),
|
|
61
|
-
self.base.core.borrow().behavior.clone(),
|
|
62
|
-
);
|
|
58
|
+
self.base.build_self();
|
|
59
|
+
apply_grid_props(self.handle(), &self.props.borrow());
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
fn build_children(&self) {
|
|
@@ -69,6 +66,14 @@ impl Node for Grid {
|
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
impl Grid {
|
|
69
|
+
pub fn shared_size_scope<T: Node>(target: &T, enabled: bool) {
|
|
70
|
+
let node = target.retained_node_ref();
|
|
71
|
+
node.set_shared_size_scope(enabled);
|
|
72
|
+
if target.has_built_handle() {
|
|
73
|
+
target.notify_retained_layout_mutation();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
pub(crate) fn downgrade(&self) -> WeakFlexBox {
|
|
73
78
|
self.base.downgrade()
|
|
74
79
|
}
|
|
@@ -88,112 +93,6 @@ impl Grid {
|
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
pub fn width(&self, width: f32, unit: Unit) -> &Self {
|
|
92
|
-
self.props.borrow_mut().width = Some((width, unit));
|
|
93
|
-
if self.has_built_handle() {
|
|
94
|
-
ui::set_width(self.handle().raw(), width, unit as u32);
|
|
95
|
-
self.notify_retained_layout_mutation();
|
|
96
|
-
}
|
|
97
|
-
self
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
pub fn width_len(&self, length: Length) -> &Self {
|
|
101
|
-
let (width, unit) = length;
|
|
102
|
-
self.width(width, unit)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
pub fn height(&self, height: f32, unit: Unit) -> &Self {
|
|
106
|
-
self.props.borrow_mut().height = Some((height, unit));
|
|
107
|
-
if self.has_built_handle() {
|
|
108
|
-
ui::set_height(self.handle().raw(), height, unit as u32);
|
|
109
|
-
self.notify_retained_layout_mutation();
|
|
110
|
-
}
|
|
111
|
-
self
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
pub fn height_len(&self, length: Length) -> &Self {
|
|
115
|
-
let (height, unit) = length;
|
|
116
|
-
self.height(height, unit)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
pub fn bg_color(&self, color: u32) -> &Self {
|
|
120
|
-
self.props.borrow_mut().bg_color = Some(color);
|
|
121
|
-
if self.has_built_handle() {
|
|
122
|
-
ui::set_bg_color(self.handle().raw(), color);
|
|
123
|
-
self.notify_retained_mutation();
|
|
124
|
-
}
|
|
125
|
-
self
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
pub fn padding(&self, left: f32, top: f32, right: f32, bottom: f32) -> &Self {
|
|
129
|
-
self.props.borrow_mut().padding = Some((left, top, right, bottom));
|
|
130
|
-
if self.has_built_handle() {
|
|
131
|
-
ui::set_padding(self.handle().raw(), left, top, right, bottom);
|
|
132
|
-
self.notify_retained_layout_mutation();
|
|
133
|
-
}
|
|
134
|
-
self
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
pub fn corner_radius(&self, radius: f32) -> &Self {
|
|
138
|
-
self.base.corner_radius(radius);
|
|
139
|
-
self
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
pub fn corners(&self, tl: f32, tr: f32, br: f32, bl: f32) -> &Self {
|
|
143
|
-
self.base.corners(tl, tr, br, bl);
|
|
144
|
-
self
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
pub fn cursor(&self, style: CursorStyle) -> &Self {
|
|
148
|
-
self.base.cursor(style);
|
|
149
|
-
self
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
pub fn interactive(&self, interactive: bool) -> &Self {
|
|
153
|
-
self.base.interactive(interactive);
|
|
154
|
-
self
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
pub fn semantic_role(&self, role: SemanticRole) -> &Self {
|
|
158
|
-
self.base.semantic_role(role);
|
|
159
|
-
self
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
pub fn semantic_label(&self, label: impl Into<String>) -> &Self {
|
|
163
|
-
self.base.semantic_label(label);
|
|
164
|
-
self
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
pub(crate) fn semantic_disabled(&self, disabled: bool) -> &Self {
|
|
168
|
-
self.base.semantic_disabled(disabled);
|
|
169
|
-
self
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
pub fn on_pointer_down(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
173
|
-
self.base.on_pointer_down(handler);
|
|
174
|
-
self
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
pub fn on_pointer_up(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
178
|
-
self.base.on_pointer_up(handler);
|
|
179
|
-
self
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
pub fn on_pointer_enter(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
183
|
-
self.base.on_pointer_enter(handler);
|
|
184
|
-
self
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
pub fn on_pointer_leave(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
188
|
-
self.base.on_pointer_leave(handler);
|
|
189
|
-
self
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
pub fn on_pointer_cancel(&self, handler: impl Fn(&mut PointerEventArgs) + 'static) -> &Self {
|
|
193
|
-
self.base.on_pointer_cancel(handler);
|
|
194
|
-
self
|
|
195
|
-
}
|
|
196
|
-
|
|
197
96
|
pub fn columns<I>(&self, tracks: I) -> &Self
|
|
198
97
|
where
|
|
199
98
|
I: IntoIterator<Item = GridTrack>,
|
|
@@ -226,23 +125,6 @@ impl Grid {
|
|
|
226
125
|
self
|
|
227
126
|
}
|
|
228
127
|
|
|
229
|
-
pub fn child<T: Node>(&self, child: &T) -> &Self {
|
|
230
|
-
self.append_child(child);
|
|
231
|
-
self
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
pub fn children<I, C>(&self, children: I) -> &Self
|
|
235
|
-
where
|
|
236
|
-
I: IntoIterator<Item = C>,
|
|
237
|
-
C: Into<Child>,
|
|
238
|
-
{
|
|
239
|
-
for child in children {
|
|
240
|
-
self.retained_node_ref()
|
|
241
|
-
.append_child_ref(&child.into().node_ref);
|
|
242
|
-
}
|
|
243
|
-
self
|
|
244
|
-
}
|
|
245
|
-
|
|
246
128
|
pub fn column_shared_size_group(&self, index: u32, group: impl Into<String>) -> &Self {
|
|
247
129
|
let group = group.into();
|
|
248
130
|
let mut props = self.props.borrow_mut();
|
|
@@ -263,6 +145,10 @@ impl Grid {
|
|
|
263
145
|
self
|
|
264
146
|
}
|
|
265
147
|
|
|
148
|
+
pub fn clear_column_shared_size_group(&self, index: u32) -> &Self {
|
|
149
|
+
self.column_shared_size_group(index, "")
|
|
150
|
+
}
|
|
151
|
+
|
|
266
152
|
pub fn row_shared_size_group(&self, index: u32, group: impl Into<String>) -> &Self {
|
|
267
153
|
let group = group.into();
|
|
268
154
|
let mut props = self.props.borrow_mut();
|
|
@@ -283,6 +169,10 @@ impl Grid {
|
|
|
283
169
|
self
|
|
284
170
|
}
|
|
285
171
|
|
|
172
|
+
pub fn clear_row_shared_size_group(&self, index: u32) -> &Self {
|
|
173
|
+
self.row_shared_size_group(index, "")
|
|
174
|
+
}
|
|
175
|
+
|
|
286
176
|
pub fn place_child<T: Node>(
|
|
287
177
|
&self,
|
|
288
178
|
child: &T,
|
|
@@ -307,3 +197,28 @@ impl Grid {
|
|
|
307
197
|
self
|
|
308
198
|
}
|
|
309
199
|
}
|
|
200
|
+
|
|
201
|
+
impl HasFlexBoxRoot for Grid {
|
|
202
|
+
fn flex_box_root(&self) -> &FlexBox {
|
|
203
|
+
&self.base
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
impl ThemeBindable for Grid {
|
|
208
|
+
fn theme_binding_node(&self) -> NodeRef {
|
|
209
|
+
self.retained_node_ref()
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
fn weak_theme_target(&self) -> Box<dyn Fn() -> Option<Self>> {
|
|
213
|
+
let base = self.base.downgrade();
|
|
214
|
+
let props = Rc::downgrade(&self.props);
|
|
215
|
+
let placements = Rc::downgrade(&self.placements);
|
|
216
|
+
Box::new(move || {
|
|
217
|
+
Some(Self {
|
|
218
|
+
base: base.upgrade()?,
|
|
219
|
+
props: props.upgrade()?,
|
|
220
|
+
placements: placements.upgrade()?,
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
}
|
package/src/node/helpers.rs
CHANGED
|
@@ -47,7 +47,7 @@ pub fn column() -> FlexBox {
|
|
|
47
47
|
root
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
pub fn portal() ->
|
|
50
|
+
pub fn portal() -> Portal {
|
|
51
51
|
let root = FlexBox::default();
|
|
52
52
|
root.clip_to_bounds(false).portal(true);
|
|
53
53
|
root
|
|
@@ -100,6 +100,18 @@ pub(crate) fn apply_flex_box_props(
|
|
|
100
100
|
if let Some((height, unit)) = props.height {
|
|
101
101
|
ui::set_height(handle.raw(), height, unit as u32);
|
|
102
102
|
}
|
|
103
|
+
if let Some((value, unit)) = props.min_width {
|
|
104
|
+
ui::set_min_width(handle.raw(), value, unit as u32);
|
|
105
|
+
}
|
|
106
|
+
if let Some((value, unit)) = props.max_width {
|
|
107
|
+
ui::set_max_width(handle.raw(), value, unit as u32);
|
|
108
|
+
}
|
|
109
|
+
if let Some((value, unit)) = props.min_height {
|
|
110
|
+
ui::set_min_height(handle.raw(), value, unit as u32);
|
|
111
|
+
}
|
|
112
|
+
if let Some((value, unit)) = props.max_height {
|
|
113
|
+
ui::set_max_height(handle.raw(), value, unit as u32);
|
|
114
|
+
}
|
|
103
115
|
if let Some(style) = props.box_style {
|
|
104
116
|
ui::set_box_style(
|
|
105
117
|
handle.raw(),
|
|
@@ -175,6 +187,18 @@ pub(crate) fn apply_text_props(handle: NodeHandle, props: &TextProps, behavior:
|
|
|
175
187
|
if let Some((height, unit)) = props.height {
|
|
176
188
|
ui::set_height(handle.raw(), height, unit as u32);
|
|
177
189
|
}
|
|
190
|
+
if let Some((value, unit)) = props.min_width {
|
|
191
|
+
ui::set_min_width(handle.raw(), value, unit as u32);
|
|
192
|
+
}
|
|
193
|
+
if let Some((value, unit)) = props.max_width {
|
|
194
|
+
ui::set_max_width(handle.raw(), value, unit as u32);
|
|
195
|
+
}
|
|
196
|
+
if let Some((value, unit)) = props.min_height {
|
|
197
|
+
ui::set_min_height(handle.raw(), value, unit as u32);
|
|
198
|
+
}
|
|
199
|
+
if let Some((value, unit)) = props.max_height {
|
|
200
|
+
ui::set_max_height(handle.raw(), value, unit as u32);
|
|
201
|
+
}
|
|
178
202
|
if props.has_font {
|
|
179
203
|
ui::set_font(handle.raw(), props.font_id, props.font_size);
|
|
180
204
|
}
|
|
@@ -226,21 +250,12 @@ pub(crate) fn apply_text_props(handle: NodeHandle, props: &TextProps, behavior:
|
|
|
226
250
|
if let Some(caret_color) = props.caret_color {
|
|
227
251
|
ui::set_caret_color(handle.raw(), caret_color);
|
|
228
252
|
}
|
|
253
|
+
if let Some((start, end)) = props.selection_range_bytes {
|
|
254
|
+
ui::set_text_selection_range(handle.raw(), start, end);
|
|
255
|
+
}
|
|
229
256
|
}
|
|
230
257
|
|
|
231
|
-
pub(crate) fn apply_grid_props(handle: NodeHandle, props: &GridProps
|
|
232
|
-
if let Some((width, unit)) = props.width {
|
|
233
|
-
ui::set_width(handle.raw(), width, unit as u32);
|
|
234
|
-
}
|
|
235
|
-
if let Some((height, unit)) = props.height {
|
|
236
|
-
ui::set_height(handle.raw(), height, unit as u32);
|
|
237
|
-
}
|
|
238
|
-
if let Some(color) = props.bg_color {
|
|
239
|
-
ui::set_bg_color(handle.raw(), color);
|
|
240
|
-
}
|
|
241
|
-
if let Some((left, top, right, bottom)) = props.padding {
|
|
242
|
-
ui::set_padding(handle.raw(), left, top, right, bottom);
|
|
243
|
-
}
|
|
258
|
+
pub(crate) fn apply_grid_props(handle: NodeHandle, props: &GridProps) {
|
|
244
259
|
ui::grid_set_columns(handle.raw(), &props.columns, &props.column_types);
|
|
245
260
|
ui::grid_set_rows(handle.raw(), &props.rows, &props.row_types);
|
|
246
261
|
for (index, group) in &props.column_shared_size_groups {
|
|
@@ -249,16 +264,9 @@ pub(crate) fn apply_grid_props(handle: NodeHandle, props: &GridProps, behavior:
|
|
|
249
264
|
for (index, group) in &props.row_shared_size_groups {
|
|
250
265
|
ui::grid_set_row_shared_size_group(handle.raw(), *index, group);
|
|
251
266
|
}
|
|
252
|
-
apply_behavior(handle, behavior);
|
|
253
267
|
}
|
|
254
268
|
|
|
255
|
-
pub(crate) fn apply_image_props(handle: NodeHandle, props: &ImageProps
|
|
256
|
-
if let Some((width, unit)) = props.width {
|
|
257
|
-
ui::set_width(handle.raw(), width, unit as u32);
|
|
258
|
-
}
|
|
259
|
-
if let Some((height, unit)) = props.height {
|
|
260
|
-
ui::set_height(handle.raw(), height, unit as u32);
|
|
261
|
-
}
|
|
269
|
+
pub(crate) fn apply_image_props(handle: NodeHandle, props: &ImageProps) {
|
|
262
270
|
if let Some((left, top, right, bottom)) = props.image_nine {
|
|
263
271
|
ui::set_image_nine(
|
|
264
272
|
handle.raw(),
|
|
@@ -279,16 +287,9 @@ pub(crate) fn apply_image_props(handle: NodeHandle, props: &ImageProps, behavior
|
|
|
279
287
|
props.max_aniso,
|
|
280
288
|
);
|
|
281
289
|
}
|
|
282
|
-
apply_behavior(handle, behavior);
|
|
283
290
|
}
|
|
284
291
|
|
|
285
|
-
pub(crate) fn apply_svg_props(handle: NodeHandle, props: &SvgProps
|
|
286
|
-
if let Some((width, unit)) = props.width {
|
|
287
|
-
ui::set_width(handle.raw(), width, unit as u32);
|
|
288
|
-
}
|
|
289
|
-
if let Some((height, unit)) = props.height {
|
|
290
|
-
ui::set_height(handle.raw(), height, unit as u32);
|
|
291
|
-
}
|
|
292
|
+
pub(crate) fn apply_svg_props(handle: NodeHandle, props: &SvgProps) {
|
|
292
293
|
ui::set_svg(
|
|
293
294
|
handle.raw(),
|
|
294
295
|
props.svg_id,
|
|
@@ -296,10 +297,6 @@ pub(crate) fn apply_svg_props(handle: NodeHandle, props: &SvgProps, behavior: No
|
|
|
296
297
|
props.sampling_kind,
|
|
297
298
|
props.max_aniso,
|
|
298
299
|
);
|
|
299
|
-
if let Some(opacity) = props.opacity {
|
|
300
|
-
ui::set_layer_effect(handle.raw(), opacity, 0.0, 0);
|
|
301
|
-
}
|
|
302
|
-
apply_behavior(handle, behavior);
|
|
303
300
|
}
|
|
304
301
|
|
|
305
302
|
pub(crate) fn apply_scroll_view_props(
|
|
@@ -321,12 +318,6 @@ pub(crate) fn apply_scroll_view_props(
|
|
|
321
318
|
if let Some((height, unit)) = props.height {
|
|
322
319
|
ui::set_height(handle.raw(), height, unit as u32);
|
|
323
320
|
}
|
|
324
|
-
if let Some(color) = props.bg_color {
|
|
325
|
-
ui::set_bg_color(handle.raw(), color);
|
|
326
|
-
}
|
|
327
|
-
if let Some((left, top, right, bottom)) = props.padding {
|
|
328
|
-
ui::set_padding(handle.raw(), left, top, right, bottom);
|
|
329
|
-
}
|
|
330
321
|
ui::set_scroll_enabled(handle.raw(), props.enable_scroll_x, props.enable_scroll_y);
|
|
331
322
|
ui::set_smooth_scrolling(handle.raw(), props.smooth_scrolling);
|
|
332
323
|
if let Some(friction) = props.friction {
|
|
@@ -365,6 +356,9 @@ pub(crate) fn apply_behavior(handle: NodeHandle, behavior: NodeBehavior) {
|
|
|
365
356
|
if let Some(selected) = behavior.semantic_selected {
|
|
366
357
|
ui::set_semantic_selected(handle.raw(), true, selected);
|
|
367
358
|
}
|
|
359
|
+
if let Some(expanded) = behavior.semantic_expanded {
|
|
360
|
+
ui::set_semantic_expanded(handle.raw(), true, expanded);
|
|
361
|
+
}
|
|
368
362
|
if let Some((value_now, value_min, value_max)) = behavior.semantic_value_range {
|
|
369
363
|
ui::set_semantic_value_range(handle.raw(), true, value_now, value_min, value_max);
|
|
370
364
|
}
|
|
@@ -435,7 +429,4 @@ pub(crate) fn apply_behavior(handle: NodeHandle, behavior: NodeBehavior) {
|
|
|
435
429
|
if behavior.track_semantic_disabled_from_enabled {
|
|
436
430
|
ui::set_semantic_disabled(handle.raw(), true, !effective_enabled);
|
|
437
431
|
}
|
|
438
|
-
if behavior.request_semantic_announcement {
|
|
439
|
-
ui::request_semantic_announcement(handle.raw());
|
|
440
|
-
}
|
|
441
432
|
}
|