[go: up one dir, main page]

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#![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, impl_from_and_into_var, merge_var, response_done_var, response_var, var,
64        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, PxLine, PxPoint, PxRect, PxSideOffsets, PxSize, PxToDip as _, PxTransform, PxVector, Rect,
74            RectFromTuplesBuilder as _, ResolutionUnits as _, SideOffsets, Size, TimeUnits as _, Transform, Vector,
75        },
76    };
77
78    pub use zng_txt::{ToTxt, Txt, formatx};
79
80    pub use zng_clone_move::{async_clmv, async_clmv_fn, async_clmv_fn_once, clmv};
81
82    pub use zng_task as task;
83
84    pub use zng_app_context::{CaptureFilter, ContextLocal, ContextValueSet, LocalContext, RunOnDrop, app_local, context_local};
85
86    pub use zng_state_map::{OwnedStateMap, StateId, StateMapMut, StateMapRef, state_map, static_id};
87
88    pub use zng_unique_id::{IdEntry, IdMap, IdSet};
89
90    pub use zng_color::{
91        ColorScheme, Hsla, Hsva, LightDark, LightDarkVarExt as _, MixAdjust as _, MixBlendMode, Rgba, colors, gradient, hex, hsl, hsla,
92        hsv, hsva, light_dark, rgb, rgba, web_colors,
93    };
94
95    pub use crate::node::{
96        VarPresent as _, VarPresentData as _, VarPresentList as _, VarPresentListFromIter as _, VarPresentOpt as _, bind_state,
97        border_node, command_property, event_property, event_state, event_state2, event_state3, event_state4, fill_node, list_presenter,
98        list_presenter_from_iter, presenter, presenter_opt, widget_state_get_state, widget_state_is_state, with_context_blend,
99        with_context_local, 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::*;