zng_wgt/
lib.rs

1#![doc(html_favicon_url = "https://zng-ui.github.io/res/zng-logo-icon.png")]
2#![doc(html_logo_url = "https://zng-ui.github.io/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#![warn(unused_extern_crates)]
15#![warn(missing_docs)]
16
17pub use zng_app::enable_widget_macros;
18enable_widget_macros!();
19
20#[doc(hidden)]
21#[allow(unused_extern_crates)]
22extern crate self as zng_wgt; // for doc-tests
23
24/// Prelude for declaring properties and widgets.
25pub mod prelude {
26    #[doc(no_inline)]
27    pub use crate::__prelude::*;
28}
29mod __prelude {
30    pub use zng_app::{
31        DInstant, Deadline, INSTANT,
32        event::{
33            AnyEventArgs as _, Command, CommandHandle, CommandInfoExt as _, CommandNameExt as _, Event, EventArgs as _, EventHandle,
34            EventHandles, EventPropagationHandle, command, event, event_args,
35        },
36        handler::{Handler, HandlerExt as _, async_hn, async_hn_once, hn, hn_once},
37        render::{FrameBuilder, FrameUpdate, FrameValue, FrameValueKey, FrameValueUpdate, SpatialFrameId, TransformStyle},
38        shortcut::{CommandShortcutExt as _, Shortcut, ShortcutFilter, Shortcuts, shortcut},
39        timer::{DeadlineHandle, DeadlineVar, TIMERS, TimerHandle, TimerVar},
40        update::{EventUpdate, UPDATES, UpdateDeliveryList, UpdateOp, WidgetUpdates},
41        widget::{
42            AnyVarSubscribe as _, VarLayout as _, VarSubscribe as _, WIDGET, WidgetId, WidgetUpdateMode,
43            base::{WidgetBase, WidgetImpl},
44            border::{BORDER, BorderSides, BorderStyle, CornerRadius, CornerRadiusFit, LineOrientation, LineStyle},
45            builder::{NestGroup, WidgetBuilder, WidgetBuilding, property_id},
46            easing,
47            info::{
48                InteractionPath, Interactivity, Visibility, WidgetBorderInfo, WidgetBoundsInfo, WidgetInfo, WidgetInfoBuilder,
49                WidgetLayout, WidgetMeasure, WidgetPath,
50            },
51            node::{
52                ArcNode, ChainList, EditableUiVec, EditableUiVecRef, FillUiNode, IntoUiNode, PanelList, PanelListData as _, SORTING_LIST,
53                SortingList, UiNode, UiNodeImpl, UiNodeListObserver, UiNodeOp, UiVec, ZIndex, match_node, match_node_leaf, match_widget,
54                ui_vec,
55            },
56            property, widget, widget_impl, widget_mixin, widget_set,
57        },
58        window::{MonitorId, WINDOW, WindowId},
59    };
60
61    pub use zng_var::{
62        ContextVar, IntoValue, IntoVar, ObservableVec, ResponderVar, ResponseVar, Var, VarCapability, VarHandle, VarHandles, VarUpdateId,
63        VarValue, WeakVar, const_var, context_var, expr_var, flat_expr_var, impl_from_and_into_var, merge_var, response_done_var,
64        response_var, var, var_default, var_from, var_state, when_var,
65    };
66
67    pub use zng_layout::{
68        context::{DIRECTION_VAR, LAYOUT, LayoutDirection, LayoutMetrics},
69        unit::{
70            Align, AngleDegree, AngleGradian, AngleRadian, AngleUnits as _, ByteUnits as _, Dip, DipBox, DipPoint, DipRect, DipSideOffsets,
71            DipSize, DipToPx as _, DipVector, Factor, Factor2d, FactorPercent, FactorSideOffsets, FactorUnits as _, Layout1d as _,
72            Layout2d as _, LayoutAxis, Length, LengthUnits as _, Line, LineFromTuplesBuilder as _, Point, Px, PxBox, PxConstraints,
73            PxConstraints2d, PxCornerRadius, PxDensity, PxDensity2d, PxDensityUnits as _, PxDensityUnits, PxLine, PxPoint, PxRect,
74            PxSideOffsets, PxSize, PxToDip as _, PxTransform, PxVector, Rect, RectFromTuplesBuilder as _, SideOffsets, Size,
75            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        VarPresent as _, VarPresentData as _, VarPresentList as _, VarPresentListFromIter as _, VarPresentOpt as _, bind_state,
98        border_node, command_property, event_property, event_state, event_state2, event_state3, event_state4, fill_node, list_presenter,
99        list_presenter_from_iter, presenter, presenter_opt, widget_state_get_state, widget_state_is_state, with_context_blend,
100        with_context_local, with_context_local_init, with_context_var, with_context_var_init, with_widget_state, with_widget_state_modify,
101    };
102
103    pub use crate::{CommandIconExt as _, WidgetFn, wgt_fn};
104}
105
106pub mod node;
107
108mod border_props;
109mod clip_props;
110mod color_props;
111mod func;
112mod hit_test_props;
113mod interactivity_props;
114mod layout_props;
115mod node_events;
116mod panel_props;
117mod parallel_prop;
118mod visibility_props;
119mod wgt;
120
121pub use border_props::*;
122pub use clip_props::*;
123pub use color_props::*;
124pub use func::*;
125pub use hit_test_props::*;
126pub use interactivity_props::*;
127pub use layout_props::*;
128pub use node_events::*;
129pub use panel_props::*;
130pub use parallel_prop::*;
131pub use visibility_props::*;
132pub use wgt::*;