rust_widgets 2.1.0

Pure Rust cross-platform native GUI library with hardware-adaptive rendering, 60+ widgets, touch/gesture support, i18n, and SVG-pipeline-accurate output
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
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
// SPDX-FileCopyrightText: Copyright (c) 2026 Mike Li/Mikewolfli/Wei Li(mikewolfli@163.com)
// SPDX-License-Identifier: MIT

#[cfg(full_widgets)]
use crate::core::Color;
#[cfg(full_widgets)]
use crate::core::Point;
use crate::core::Rect;
#[cfg(full_widgets)]
use crate::widget::special_widgets::freeform_shape::ShapePath;
use crate::widget::*;
use std::boxed::Box;

/// Applies a caller-supplied label to a freshly built widget.
///
/// # Why this exists
///
/// 136 of the 155 constructors in this file take `_text` and discard it, so a
/// caller that passed a title got a control with no text at all — a real defect
/// masked by the fact that the old platform path stored the string separately.
/// Now that the widget owns its state, the label has to reach the widget.
///
/// The write goes through the property contract rather than each type's own setter,
/// because the property name differs (`text` for a button, `title` for a window or
/// group box). Going through the contract keeps this helper independent of the
/// concrete type, and a type that exposes neither name is simply left alone — the
/// label is genuinely not part of that control's contract.
fn label(geometry: Rect, text: &str, widget: Box<dyn Widget>) -> Box<dyn Widget> {
    if text.is_empty() {
        return widget;
    }
    let mut widget = widget;
    let value = crate::widget::capability::CapabilityValue::String(text.to_string());
    // Whichever spelling the control publishes wins; none being known means the
    // control has no label concept, which is not an error.
    for property in crate::control_backend::custom::LABEL_PROPERTY_NAMES {
        if crate::widget::capability::widget_property_set(widget.as_mut(), property, value.clone())
            .is_ok()
        {
            return widget;
        }
    }
    let _ = geometry;
    widget
}

/// Creates a push button. `text` becomes the button's label.
pub fn create_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(Button::new(text.to_string(), geometry))
}

/// Creates a static text label showing `text`.
pub fn create_label(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(Label::new(text.to_string(), geometry))
}

/// Creates a check box labelled `text`. An empty `text` leaves the caption
/// empty rather than falling back to a default.
pub fn create_check_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut check_box = CheckBox::new(geometry);
    if !text.is_empty() {
        check_box.set_text(text.to_string());
    }
    Box::new(check_box)
}

/// Creates a radio button labelled `text`. An empty `text` leaves the caption
/// empty rather than falling back to a default.
pub fn create_radio_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut radio_button = RadioButton::new(geometry);
    if !text.is_empty() {
        radio_button.set_text(text.to_string());
    }
    Box::new(radio_button)
}

/// Creates a horizontal slider with the track's default range. `text` is applied
/// as the control's label.
pub fn create_slider(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Slider::new(geometry)))
}

/// Creates a progress bar with the control's default range. `text` is applied as
/// the control's label.
pub fn create_progress_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ProgressBar::new(geometry)))
}

/// Creates a scroll bar oriented along the longer side of `geometry`. `text` is
/// applied as the control's label.
pub fn create_scroll_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ScrollBar::new(geometry)))
}

/// Creates an empty list box. `text` is applied as the control's label.
pub fn create_list_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ListBox::new(geometry)))
}

/// Creates a spin box with the control's default range. `text` is applied as the
/// control's label.
pub fn create_spin_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SpinBox::new(geometry)))
}

/// Creates a combo box with no items. `text` is applied as the control's label.
pub fn create_combo_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ComboBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a rotary dial with the control's default range. `text` is applied as
/// the control's label.
pub fn create_dial(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Dial::new(geometry)))
}

/// Creates a top-level window whose title is `text`, or `"Window"` when `text`
/// is empty.
pub fn create_window(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let title = if text.is_empty() { "Window".to_string() } else { text.to_string() };
    Box::new(Window::new(title, geometry))
}

/// Creates a group box with `text` as its title. An empty `text` leaves the
/// title empty rather than falling back to a default.
pub fn create_group_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut group_box = GroupBox::new(geometry);
    if !text.is_empty() {
        group_box.set_title(text.to_string());
    }
    Box::new(group_box)
}

#[cfg(full_widgets)]
/// Creates a horizontal splitter with no child panes. `text` is applied as the
/// control's label.
pub fn create_splitter(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Splitter::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a seven-segment number display reading zero. `text` is applied as the
/// control's label.
pub fn create_lcd_number(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(LCDNumber::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a command link button labelled `text`. An empty `text` leaves the
/// label empty rather than falling back to a default.
pub fn create_command_link(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut command_link = CommandLink::new(geometry);
    if !text.is_empty() {
        command_link.set_text(text.to_string());
    }
    Box::new(command_link)
}

#[cfg(full_widgets)]
/// Creates a combo box for choosing a font. `text` is applied as the control's
/// label.
pub fn create_font_combo_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FontComboBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a menu- or tool-bar action whose display name is `text`.
pub fn create_action(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(Action::new(text.to_string(), geometry))
}

#[cfg(full_widgets)]
/// Creates a tool box with no pages. `text` is applied as the control's label.
pub fn create_tool_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ToolBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tab bar with no tabs. `text` is applied as the control's label.
pub fn create_tab_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TabBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a calendar showing the current month. `text` is applied as the
/// control's label.
pub fn create_calendar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Calendar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a date editor initialised to the current date. `text` is applied as
/// the control's label.
pub fn create_date_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DateEdit::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a time editor initialised to the current time. `text` is applied as
/// the control's label.
pub fn create_time_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TimeEdit::new(geometry)))
}

/// Creates a single-line text entry initialised to `text`.
pub fn create_line_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut line_edit = LineEdit::new(geometry);
    if !text.is_empty() {
        line_edit.set_text(text.to_string());
    }
    Box::new(line_edit)
}

#[cfg(full_widgets)]
/// Creates a list view with no rows or columns. `text` is applied as the
/// control's label.
pub fn create_list_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ListView::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tree view with no items. `text` is applied as the control's label.
pub fn create_tree_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TreeView::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a table widget with no rows or columns. `text` is applied as the
/// control's label.
pub fn create_table_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TableWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a data grid with no rows or columns. `text` is applied as the
/// control's label.
pub fn create_data_grid(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DataGrid::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tree table with no rows or columns. `text` is applied as the
/// control's label.
pub fn create_tree_table(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TreeTable::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a table that materialises only the visible rows. `text` is applied as
/// the control's label.
pub fn create_virtual_table(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(VirtualTable::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a list that materialises only the visible rows. `text` is applied as
/// the control's label.
pub fn create_virtual_list(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(VirtualList::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a menu with no items whose title is `text`.
pub fn create_menu(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(Menu::new(text, geometry))
}

#[cfg(full_widgets)]
/// Creates a menu bar with no menus. `text` is applied as the control's label.
pub fn create_menu_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MenuBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tool bar with no actions. `text` is applied as the control's label.
pub fn create_tool_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ToolBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a ribbon bar with no tabs. `text` is applied as the control's label.
pub fn create_ribbon_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(RibbonBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a colour picker with the control's default colour. `text` is applied
/// as the control's label.
pub fn create_color_picker(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ColorPicker::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a code editor with no document loaded. `text` becomes the editor's
/// initial contents.
pub fn create_code_editor(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut editor = CodeEditor::new(geometry);
    if !text.is_empty() {
        editor.set_text(text.to_string());
    }
    Box::new(editor)
}

#[cfg(full_widgets)]
/// Creates a Gantt chart with no tasks. `text` is applied as the control's
/// label.
pub fn create_gantt_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(GanttWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a terminal view with no output. `text` becomes the initial contents of
/// the input line, not the transcript.
pub fn create_terminal_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut terminal = TerminalView::new(geometry);
    if !text.is_empty() {
        terminal.set_input_line(text.to_string());
    }
    Box::new(terminal)
}

#[cfg(full_widgets)]
/// Creates a snackbar in the dismissed state. When `text` is non-empty the
/// snackbar is shown immediately with that message.
pub fn create_snackbar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut snackbar = Snackbar::new(geometry);
    if !text.is_empty() {
        snackbar.show(text.to_string());
    }
    Box::new(snackbar)
}

#[cfg(full_widgets)]
/// Creates a map view with no tiles or markers. `text` is applied as the
/// control's label.
pub fn create_map_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MapView::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a media player with no source loaded. `text` is applied as the
/// control's label.
pub fn create_media_player(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MediaPlayer::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a breadcrumb trail with no segments. `text` is applied as the
/// control's label.
pub fn create_breadcrumb(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Breadcrumb::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a split button whose primary label is `text`.
pub fn create_split_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(SplitButton::new(text.to_string(), geometry))
}

#[cfg(full_widgets)]
/// Creates a segmented control with no segments. `text` is applied as the
/// control's label.
pub fn create_segmented_control(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SegmentedControl::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a chip with no label of its own. `text` is applied as the control's
/// label.
pub fn create_chip(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Chip::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a grid layout with no child cells. `text` is applied as the control's
/// label.
pub fn create_grid(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(GridWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a free-form shape widget drawn as a rounded rectangle with a corner
/// radius of 8 pixels. `text` is applied as the control's label.
pub fn create_freeform_shape(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(
        geometry,
        text,
        Box::new(FreeformShapeWidget::new(geometry, ShapePath::RoundedRect { radius: 8 })),
    )
}

// ── Always-available widget constructors (not gated by mini) ───

#[cfg(full_widgets)]
/// Creates a toggle button labelled `text`. An empty `text` leaves the label
/// empty rather than falling back to a default.
pub fn create_toggle_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let mut btn = ToggleButton::new(text.to_string(), geometry);
    if !text.is_empty() {
        btn.set_text(text.to_string());
    }
    Box::new(btn)
}

/// Creates an arc with the control's default sweep. `text` is applied as the
/// control's label.
pub fn create_arc(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Arc::new(geometry)))
}

/// Creates a spinner in its stopped state. `text` is applied as the control's
/// label.
pub fn create_spinner(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Spinner::new(geometry)))
}

/// Creates a roller selection wheel. Each line of `text` becomes one option; an
/// empty `text` yields the three placeholder options `Option 1` to `Option 3`.
pub fn create_roller(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let options = if text.is_empty() {
        vec!["Option 1".to_string(), "Option 2".to_string(), "Option 3".to_string()]
    } else {
        text.lines().map(|s| s.to_string()).collect()
    };
    Box::new(Roller::new(options, geometry))
}

/// Creates a drop-down list. Each line of `text` becomes one item; an empty
/// `text` leaves the list empty.
pub fn create_dropdown(geometry: Rect, text: &str) -> Box<dyn Widget> {
    let items =
        if text.is_empty() { Vec::new() } else { text.lines().map(|s| s.to_string()).collect() };
    Box::new(Dropdown::new(items, geometry))
}

/// Creates a multi-line text area initialised to `text`.
pub fn create_textarea(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(TextArea::new(text.to_string(), geometry))
}

/// Creates an on-screen keyboard with the platform's default layout. `text` is
/// applied as the control's label.
pub fn create_keyboard(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Keyboard::new(geometry)))
}

/// Creates a switch in the off position. `text` is applied as the control's
/// label.
pub fn create_switch(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Switch::new(geometry)))
}

/// Creates a horizontal separator line. `text` is applied as the control's
/// label.
pub fn create_line(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(
        geometry,
        text,
        Box::new(Line::new(
            crate::widget::display_widgets::line::LineOrientation::Horizontal,
            geometry,
        )),
    )
}

/// Creates a meter gauge with the control's default range. `text` is applied as
/// the control's label.
pub fn create_meter(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Meter::new(geometry)))
}

/// Creates a small inline chart with no data. `text` is applied as the control's
/// label.
pub fn create_mini_chart(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MiniChart::new(geometry)))
}

/// Creates an image view with no image loaded. `text` is applied as the
/// control's label.
pub fn create_image_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ImageView::new(crate::widget::Image::new(), geometry)))
}

/// Creates a small drawing surface with an empty scene. `text` is applied as the
/// control's label.
pub fn create_mini_canvas(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MiniCanvas::new(geometry)))
}

/// Creates a tile view with no tiles. `text` is applied as the control's label.
pub fn create_tile_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TileView::new(geometry)))
}

// ── Dialog widget constructors ────────────────────────────────

#[cfg(full_widgets)]
/// Creates a message box in its default state: no icon, an `OK` button and no
/// title or body text. `text` becomes the box's text, not its title.
pub fn create_message_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MessageBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a file dialog with no filter, starting directory or selection.
/// `text` is applied as the control's label.
pub fn create_file_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FileDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a font selection dialog using the platform's default selection.
/// `text` is applied as the control's label.
pub fn create_font_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FontDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a single-line input dialog with no prompt and an empty field. `text`
/// is applied as the control's label.
pub fn create_input_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(InputDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a modal progress dialog with no cancellation support. `text` is
/// applied as the control's label.
pub fn create_progress_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ProgressDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a popup window with no content. `text` is applied as the control's
/// label.
pub fn create_popup_window(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(PopupWindow::new(geometry)))
}

// ── Container widget constructors ─────────────────────────────

/// Creates a scrollable viewport with no content. `text` is applied as the
/// control's label.
pub fn create_scroll_area(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ScrollArea::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tab widget with no pages. `text` is applied as the control's label.
pub fn create_tab_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TabWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a stacked widget with no pages. `text` is applied as the control's
/// label.
pub fn create_stacked_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(StackedWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a collapsible pane with an empty header title. `text` is applied as
/// the control's label.
pub fn create_collapsible_pane(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CollapsiblePane::new(geometry, String::new())))
}

#[cfg(full_widgets)]
/// Creates a dockable panel with no content. `text` is applied as the control's
/// label.
pub fn create_dock_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DockWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a multiple-document interface area with no child windows. `text` is
/// applied as the control's label.
pub fn create_mdi_area(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MdiArea::new(geometry)))
}

// ── Text widget constructors ──────────────────────────────────

#[cfg(full_widgets)]
/// Creates a rich text editor with no document loaded. `text` is applied as the
/// control's label.
pub fn create_text_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TextEdit::new(geometry)))
}

// ── Web widget constructors ───────────────────────────────────

#[cfg(full_widgets)]
/// Creates a web engine view with no page loaded.
///
/// `_text` is deliberately ignored: the underlying view has no label concept, so
/// there is nothing for it to configure.
pub fn create_web_view(geometry: Rect, _text: &str) -> Box<dyn Widget> {
    // WebView is now an alias for WebEngineView.
    Box::new(WebEngineView::new(geometry))
}

// ── Advanced widget constructors ──────────────────────────────

#[cfg(full_widgets)]
/// Creates a pie menu centred on `geometry`, with a radius of half the shorter
/// side so that it fits inside the rectangle. `text` is applied as the control's
/// label.
pub fn create_pie_menu(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(
        geometry,
        text,
        Box::new(PieMenu::new(
            Point::new(
                geometry.x + (geometry.width / 2) as i32,
                geometry.y + (geometry.height / 2) as i32,
            ),
            geometry.width.min(geometry.height) as f32 / 2.0,
        )),
    )
}

#[cfg(full_widgets)]
/// Creates a combined date and time editor initialised to the current moment.
/// `text` is applied as the control's label.
pub fn create_date_time_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DateTimeEdit::new(geometry)))
}

// ── Group A widget constructors (non-mini) ─────────────────────

#[cfg(full_widgets)]
/// Creates a drawing surface with an empty scene. `text` is applied as the
/// control's label.
pub fn create_canvas(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Canvas::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a chart with no series. `text` is applied as the control's label.
pub fn create_chart(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ChartWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a search box with an empty query. `text` is applied as the control's
/// label.
pub fn create_search_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SearchBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a badge with no count or text. `text` is applied as the control's
/// label.
pub fn create_badge(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Badge::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a placeholder skeleton shown while content loads. `text` is applied
/// as the control's label.
pub fn create_skeleton_loader(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SkeletonLoader::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a floating action button with no icon or label. `text` is applied as
/// the control's label.
pub fn create_fab(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FAB::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a bottom sheet in its collapsed state with no content. `text` is
/// applied as the control's label.
pub fn create_bottom_sheet(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(BottomSheet::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a bottom navigation bar with no items. `text` is applied as the
/// control's label.
pub fn create_bottom_navigation_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(BottomNavigationBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a navigation drawer with no items. `text` is applied as the control's
/// label.
pub fn create_navigation_drawer(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(NavigationDrawer::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an app bar with an empty title and no back or action affordances.
/// `text` is applied through the label contract, so it lands on the bar's
/// `/Title` rather than being passed to the constructor.
pub fn create_app_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(AppBar::new("", geometry)))
}

#[cfg(full_widgets)]
/// Creates a mobile date picker opened on the current date. `text` is applied as
/// the control's label.
pub fn create_mobile_date_picker(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MobileDatePicker::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a horizontal divider rule. `text` is applied as the control's label.
pub fn create_divider(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Divider::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a stepper at its first step with no steps defined. `text` is applied
/// as the control's label.
pub fn create_stepper(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Stepper::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a star rating control with no rating set. `text` is applied as the
/// control's label.
pub fn create_rating(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Rating::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an avatar with no image or initials. `text` is applied as the
/// control's label.
pub fn create_avatar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Avatar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a placeholder shown when a collection has no items. `text` is applied
/// as the control's label.
pub fn create_empty_state(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(EmptyState::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a colour history strip recording no previously used colours. `text`
/// is applied as the control's label.
pub fn create_color_history(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ColorHistory::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a colour swatch initialised to opaque red. `text` is applied as the
/// control's label.
pub fn create_color_well(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ColorWell::new(Color::rgba(255, 0, 0, 255), geometry)))
}

#[cfg(full_widgets)]
/// Creates a tag entry control with no tags. `text` is applied as the control's
/// label.
pub fn create_tag_input(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TagInput::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a pre-edit display for input-method composition with no text. `text`
/// is applied as the control's label.
pub fn create_ime_preedit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ImePreedit::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an in-place editor over an empty cell, so it has no value to edit
/// until one is set. `text` is applied as the control's label.
pub fn create_inplace_editor(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(InplaceEditor::new("", geometry)))
}

#[cfg(full_widgets)]
/// Creates a QR code view with no payload encoded. `text` is applied as the
/// control's label, not as the content to encode.
pub fn create_qr_code(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(QRCode::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a masonry layout with no child tiles. `text` is applied as the
/// control's label.
pub fn create_masonry_layout(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MasonryLayout::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a Material-styled snackbar in the dismissed state. `text` is applied
/// as the control's label.
pub fn create_material_snackbar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MaterialSnackbar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an adaptive scaffold with an empty body. `text` is applied through
/// the label contract rather than being passed to the constructor.
pub fn create_adaptive_scaffold(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(AdaptiveScaffold::new("", geometry)))
}

#[cfg(full_widgets)]
/// Creates a wizard dialog at its first page with no pages defined. `text` is
/// applied as the control's label.
pub fn create_wizard_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(WizardDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a safe area inset with no padding applied. `text` is applied as the
/// control's label.
pub fn create_safe_area(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SafeArea::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an iOS-style alert dialog with no title, message or actions. `text`
/// is applied as the control's label.
pub fn create_cupertino_alert_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CupertinoAlertDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an iOS-style slider with the control's default range. `text` is
/// applied as the control's label.
pub fn create_cupertino_slider(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CupertinoSlider::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tooltip with an empty tip text. `text` is applied through the label
/// contract rather than being passed to the constructor.
pub fn create_tooltip(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Tooltip::new("", geometry)))
}

#[cfg(full_widgets)]
/// Creates a segmented button group with no segments. `text` is applied as the
/// control's label.
pub fn create_segmented_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SegmentedButton::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a navigation stack with no pushed routes. `text` is applied as the
/// control's label.
pub fn create_navigation_stack(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(NavigationStack::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a circular progress indicator at zero. `text` is applied as the
/// control's label.
pub fn create_progress_circle(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ProgressCircle::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an icon view with no icon selected. `text` is applied as the
/// control's label.
pub fn create_icon(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Icon::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a drop-down menu with no items. `text` is applied as the control's
/// label.
pub fn create_dropdown_menu(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DropdownMenu::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a masked text entry with the control's default (unmasked) pattern.
/// `text` is applied as the control's label.
pub fn create_masked_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MaskedEdit::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a button that opens an attached menu, with an empty caption. `text`
/// is applied through the label contract rather than being passed to the
/// constructor.
pub fn create_menu_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MenuButton::new("", geometry)))
}

#[cfg(full_widgets)]
/// Creates a popover with no content, initially hidden. `text` is applied as the
/// control's label.
pub fn create_popover(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Popover::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a text entry offering completion suggestions, with no suggestions
/// loaded. `text` is applied as the control's label.
pub fn create_auto_complete_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(AutoCompleteEdit::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a combo box that allows more than one selection, with no items.
/// `text` is applied as the control's label.
pub fn create_multi_select_combo_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MultiSelectComboBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a slider with two handles spanning the control's default range.
/// `text` is applied as the control's label.
pub fn create_range_slider(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(RangeSlider::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a label that floats above its field once the field has content.
/// `text` is applied as the control's label.
pub fn create_floating_label(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FloatingLabel::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a preview of a font, defaulting to Arial. `text` is applied as the
/// control's label, not as the sample string the preview renders.
pub fn create_font_preview(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FontPreview::new("Arial", geometry)))
}

#[cfg(full_widgets)]
/// Creates an iOS-style navigation bar with an empty title. `text` is applied as
/// the control's label.
pub fn create_cupertino_navigation_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CupertinoNavigationBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an iOS-style segmented control with no segments. `text` is applied as
/// the control's label.
pub fn create_cupertino_segmented_control(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CupertinoSegmentedControl::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a pull-to-refresh control in its idle state. `text` is applied as the
/// control's label.
pub fn create_refresh_control(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(RefreshControl::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a modal bottom sheet in its collapsed state. `text` is applied as the
/// control's label.
pub fn create_modal_bottom_sheet(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ModalBottomSheet::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a find-and-replace dialog with empty search and replacement fields.
/// `text` is applied as the control's label.
pub fn create_find_replace_dialog(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(FindReplaceDialog::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a properties panel with no property rows. `text` is applied as the
/// control's label.
pub fn create_properties_panel(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(PropertiesPanel::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an iOS-style date picker opened on the current date. `text` is
/// applied as the control's label.
pub fn create_cupertino_date_picker(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CupertinoDatePicker::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a combo box whose text may also be typed, with no items. `text` is
/// applied as the control's label.
pub fn create_editable_combo_box(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(EditableComboBox::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a picker for a start and end date, with no range selected. `text` is
/// applied as the control's label.
pub fn create_date_range_picker(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(DateRangePicker::new(geometry)))
}

// ── New widget constructors (non-mini) ───────────────────────────

#[cfg(full_widgets)]
/// Creates a rich text editor with no document loaded. `text` is applied as the
/// control's label.
pub fn create_rich_edit(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(RichEdit::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a carousel at its first item with no items defined. `text` is applied
/// as the control's label.
pub fn create_carousel(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Carousel::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a Material navigation rail with no destinations. `text` is applied as
/// the control's label.
pub fn create_material_navigation_rail(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(MaterialNavigationRail::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tab view with no tabs. `text` is applied as the control's label.
pub fn create_tab_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(TabView::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a search bar with an empty query. `text` is applied as the control's
/// label.
pub fn create_search_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SearchBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a keyboard-shortcut capture field with no shortcut assigned. `text`
/// is applied as the control's label.
pub fn create_shortcut_editor(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ShortcutEditor::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a swipe-to-dismiss wrapper with no content. `text` is applied as the
/// control's label.
pub fn create_swipe_to_dismiss(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(SwipeToDismiss::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a horizontally paged view at the first page with no pages. `text` is
/// applied as the control's label.
pub fn create_pager_page_view(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(PagerPageView::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a line chart with no series. `text` is applied as the control's
/// label.
pub fn create_line_chart(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(LineChart::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a sparkline with no data points. `text` is applied as the control's
/// label.
pub fn create_sparkline(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(Sparkline::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a bar chart with no series. `text` is applied as the control's label.
pub fn create_bar_chart(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(BarChart::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a pie chart with no slices. `text` is applied as the control's label.
pub fn create_pie_chart(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(PieChart::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a view for a multi-frame image with no frames loaded. `text` is
/// applied as the control's label.
pub fn create_animated_image(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(AnimatedImage::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates the host for a shared-element (hero) transition with no elements
/// registered. `text` is applied as the control's label.
pub fn create_hero_animation(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(HeroAnimation::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an editor for a cubic Bézier easing curve, holding no control
/// points yet. `text` is applied as the control's label.
pub fn create_bezier_curve_editor(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(BezierCurveEditor::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a view for a Lottie animation with no animation loaded. `text` is
/// applied as the control's label.
pub fn create_lottie_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(LottieWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a view for a Rive animation with no animation loaded. `text` is
/// applied as the control's label.
pub fn create_rive_widget(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(RiveWidget::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a video player with no media loaded and playback stopped. `text` is
/// applied as the control's label.
pub fn create_video_player(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(VideoPlayer::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an image gallery with no images. `text` is applied as the control's
/// label.
pub fn create_image_gallery(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(ImageGallery::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates an audio visualiser with no audio source attached. `text` is applied
/// as the control's label.
pub fn create_audio_visualizer(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(AudioVisualizer::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a live camera preview with no camera opened. `text` is applied as the
/// control's label.
pub fn create_camera_preview(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(CameraPreview::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a barcode scanner view with no scan in progress. `text` is applied as
/// the control's label.
pub fn create_barcode_scanner(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(BarcodeScanner::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a tool bar button labelled `text`.
pub fn create_tool_button(geometry: Rect, text: &str) -> Box<dyn Widget> {
    Box::new(ToolButton::new(text.to_string(), geometry))
}

#[cfg(full_widgets)]
/// Creates a status bar with no message or indicators. `text` is applied as the
/// control's label.
pub fn create_status_bar(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(StatusBar::new(geometry)))
}

#[cfg(full_widgets)]
/// Creates a property grid with no property rows. `text` is applied as the
/// control's label.
pub fn create_property_grid(geometry: Rect, text: &str) -> Box<dyn Widget> {
    label(geometry, text, Box::new(PropertyGrid::new(geometry)))
}