zng_wgt/
lib.rs

1#![doc(html_favicon_url = "https://raw.githubusercontent.com/zng-ui/zng/main/examples/image/res/zng-logo-icon.png")]
2#![doc(html_logo_url = "https://raw.githubusercontent.com/zng-ui/zng/main/examples/image/res/zng-logo.png")]
3//!
4//! Basic widget properties and helpers for declaring widgets and properties.
5//!
6//! # Widget Instantiation
7//!
8//! See [`enable_widget_macros!`] if you want to instantiate widgets without depending on the `zng` crate.
9//!
10//! # Crate
11//!
12#![doc = include_str!(concat!("../", std::env!("CARGO_PKG_README")))]
13// suppress nag about very simple boxed closure signatures.
14#![expect(clippy::type_complexity)]
15#![warn(unused_extern_crates)]
16#![warn(missing_docs)]
17
18pub use zng_app::enable_widget_macros;
19enable_widget_macros!();
20
21#[doc(hidden)]
22#[allow(unused_extern_crates)]
23extern crate self as zng_wgt; // for doc-tests
24
25/// Prelude for declaring properties and widgets.
26pub mod prelude {
27    #[doc(no_inline)]
28    pub use crate::__prelude::*;
29}
30mod __prelude {
31    pub use zng_app::{
32        DInstant, Deadline, INSTANT,
33        event::{
34            AnyEventArgs as _, Command, CommandHandle, CommandInfoExt as _, CommandNameExt as _, Event, EventArgs as _, EventHandle,
35            EventHandles, EventPropagationHandle, command, event, event_args,
36        },
37        handler::{AppHandler, WidgetHandler, app_hn, app_hn_once, async_app_hn, async_app_hn_once, async_hn, async_hn_once, hn, hn_once},
38        render::{FrameBuilder, FrameUpdate, FrameValue, FrameValueKey, FrameValueUpdate, SpatialFrameId, TransformStyle},
39        shortcut::{CommandShortcutExt as _, Shortcut, ShortcutFilter, Shortcuts, shortcut},
40        timer::{DeadlineHandle, DeadlineVar, TIMERS, TimerHandle, TimerVar},
41        update::{EventUpdate, UPDATES, UpdateDeliveryList, UpdateOp, WidgetUpdates},
42        widget::{
43            AnyVarSubscribe as _, VarLayout as _, VarSubscribe as _, WIDGET, WidgetId, WidgetUpdateMode,
44            base::{WidgetBase, WidgetImpl},
45            border::{BORDER, BorderSides, BorderStyle, CornerRadius, CornerRadiusFit, LineOrientation, LineStyle},
46            builder::{NestGroup, WidgetBuilder, WidgetBuilding, property_id},
47            easing,
48            info::{
49                InteractionPath, Interactivity, Visibility, WidgetBorderInfo, WidgetBoundsInfo, WidgetInfo, WidgetInfoBuilder,
50                WidgetLayout, WidgetMeasure, WidgetPath,
51            },
52            node::{
53                ArcNode, ArcNodeList, BoxedUiNode, BoxedUiNodeList, EditableUiNodeList, EditableUiNodeListRef, FillUiNode, NilUiNode,
54                PanelList, PanelListData as _, SORTING_LIST, SortingList, UiNode, UiNodeList, UiNodeListChain as _, UiNodeListObserver,
55                UiNodeOp, UiVec, ZIndex, match_node, match_node_leaf, match_node_list, match_node_typed, match_widget, ui_vec,
56            },
57            property, ui_node, widget, widget_impl, widget_mixin, widget_set,
58        },
59        window::{MonitorId, WINDOW, WindowId},
60    };
61
62    pub use zng_var::{
63        AnyVar as _, AnyWeakVar as _, ArcVar, BoxedVar, ContextVar, IntoValue, IntoVar, LocalVar, ObservableVec, ReadOnlyArcVar,
64        ResponderVar, ResponseVar, Var, VarCapability, VarHandle, VarHandles, VarUpdateId, VarValue, WeakVar as _, context_var, expr_var,
65        impl_from_and_into_var, merge_var, response_done_var, response_var, state_var, var, var_from, when_var,
66    };
67
68    pub use zng_layout::{
69        context::{DIRECTION_VAR, LAYOUT, LayoutDirection, LayoutMetrics},
70        unit::{
71            Align, AngleDegree, AngleGradian, AngleRadian, AngleUnits as _, ByteUnits as _, Dip, DipBox, DipPoint, DipRect, DipSideOffsets,
72            DipSize, DipToPx as _, DipVector, Factor, Factor2d, FactorPercent, FactorSideOffsets, FactorUnits as _, Layout1d as _,
73            Layout2d as _, LayoutAxis, Length, LengthUnits as _, Line, LineFromTuplesBuilder as _, Point, Px, PxBox, PxConstraints,
74            PxConstraints2d, PxCornerRadius, PxLine, PxPoint, PxRect, PxSideOffsets, PxSize, PxToDip as _, PxTransform, PxVector, Rect,
75            RectFromTuplesBuilder as _, ResolutionUnits as _, SideOffsets, Size, TimeUnits as _, Transform, Vector,
76        },
77    };
78
79    pub use zng_txt::{ToTxt, Txt, formatx};
80
81    pub use zng_clone_move::{async_clmv, async_clmv_fn, async_clmv_fn_once, clmv};
82
83    pub use zng_task as task;
84
85    pub use zng_app_context::{CaptureFilter, ContextLocal, ContextValueSet, LocalContext, RunOnDrop, app_local, context_local};
86
87    pub use zng_state_map::{OwnedStateMap, StateId, StateMapMut, StateMapRef, state_map, static_id};
88
89    pub use zng_unique_id::{IdEntry, IdMap, IdSet};
90
91    pub use zng_color::{
92        ColorScheme, Hsla, Hsva, LightDark, LightDarkVarExt as _, MixAdjust as _, MixBlendMode, Rgba, colors, gradient, hex, hsl, hsla,
93        hsv, hsva, light_dark, rgb, rgba, web_colors,
94    };
95
96    pub use crate::node::{
97        bind_state, border_node, command_property, event_property, event_state, event_state2, event_state3, event_state4, fill_node,
98        list_presenter, presenter, presenter_opt, widget_state_get_state, widget_state_is_state, with_context_blend, with_context_local,
99        with_context_local_init, with_context_var, with_context_var_init, with_widget_state, with_widget_state_modify,
100    };
101
102    pub use crate::{CommandIconExt as _, WidgetFn, wgt_fn};
103}
104
105pub mod node;
106
107mod border_props;
108mod clip_props;
109mod color_props;
110mod func;
111mod hit_test_props;
112mod interactivity_props;
113mod layout_props;
114mod node_events;
115mod panel_props;
116mod parallel_prop;
117mod visibility_props;
118mod wgt;
119
120pub use border_props::*;
121pub use clip_props::*;
122pub use color_props::*;
123pub use func::*;
124pub use hit_test_props::*;
125pub use interactivity_props::*;
126pub use layout_props::*;
127pub use node_events::*;
128pub use panel_props::*;
129pub use parallel_prop::*;
130pub use visibility_props::*;
131pub use wgt::*;