Expand description
Widget info, builder and base, UI node and list.
The Wgt! widget is a blank widget that entirely shaped by properties.
use zng::prelude::*;
Wgt! {
id = "sun";
widget::background_gradient = {
axis: 0.deg(),
stops: color::gradient::stops![hex!(#ff5226), hex!(#ffc926)],
};
layout::size = 100;
widget::corner_radius = 100;
layout::align = layout::Align::BOTTOM;
#[easing(2.secs())]
layout::y = 100;
when *#widget::is_inited {
layout::y = -30;
}
}To learn more about the widget macros syntax see widget_set!.
To learn more about how widgets are declared see widget.
To learn more about how properties are declared see property.
§Full API
See zng_app::widget, zng_wgt, zng_wgt_fill, zng_wgt_image::border, zng_wgt_image::fill for the full API.
Modules§
- builder
- Widget and property builder types.
- info
- Widget info tree and info builder.
- node
- Widget node types,
UiNode,UiVecand others.
Macros§
- wgt_fn
- Declares a widget function closure.
- widget_
impl - Implement a property on the widget to strongly associate it with the widget.
- widget_
set - Sets properties and when condition on a widget builder.
Structs§
- BORDER
- Coordinates nested borders and corner-radius.
- Border
Repeats - Defines how the 9-patch edge slices are used to fill the widths.
- Border
Side - The line style and color for the sides of a widget’s border.
- Border
Sides - The line style and color for each side of a widget’s border.
- Corner
Radius - Radius of each corner of a border defined from
Sizevalues. - EDITORS
- Service that provides editor widgets for a given variable.
- Editor
Request Args - Arguments for
EDITORS.register. - NonWidget
Base - Base widget for types that build to a custom type that is not used as a part of the UI tree.
- OnNode
OpArgs - Arguments for the node operation event properties.
- Parallel
- Node list methods that are made parallel.
- WIDGET
- Current context widget.
- Weak
Widget Fn - Weak reference to a
WidgetFn<D>. - Wgt
WMinimal widget.- Widget
Base - Base widget.
- Widget
Fn - Boxed shared closure that generates a widget for a given data.
- Widget
Id - Unique ID of a widget.
- ZIndex
- Position of a widget inside an UI node list render operation.
Enums§
- Border
Style - The line style for the sides of a widget’s border.
- Corner
Radius Fit - Defines how the corner radius is computed for each usage.
- HitTest
Mode - Defines if and how a widget is hit-tested.
- Line
Orientation - Orientation of a straight line.
- Line
Style - Represents a line style.
- Repeat
Mode - Nine-patch border repeat mode.
- Visibility
- Widget visibility.
- Widget
Update Mode - Defines how widget update requests inside
WIDGET::with_contextare handled.
Statics§
- IS_
MOBILE_ VAR - Variable that indicates the context should use mobile UI themes.
- PARALLEL_
VAR - Defines what node list methods can run in parallel in a widget and descendants.
Traits§
- Widget
Impl - Trait implemented by all
#[widget].
Functions§
- auto_
hide PDefines if the widget only renders if it’s bounds intersects with the viewport auto-hide rectangle.- background
PCustom background. Allows using any other UI node as a background.- background_
color PFill color background.- background_
conic PConic gradient background.- background_
fn PCustom background generated using aWidgetFn<()>.- background_
gradient PLinear gradient background.- background_
img PBackground image.- background_
img_ align PSets the background image alignment.- background_
img_ crop PSets the background image crop.- background_
img_ fit PSets the background image fit.- background_
img_ offset PSets the background image offset.- background_
img_ opacity PSets the background image opacity.- background_
img_ repeat PSets the background image repeat.- background_
img_ repeat_ spacing PSets the background image repeat spacing.- background_
radial PRadial gradient background.- border
PBorder widths, color and style.- border_
align PPosition of a widget borders in relation to the widget fill.- border_
img P9-patch image border.- border_
img_ fill PDefines if the middle slice of the 9-patch image is also rendered.- border_
img_ repeat PDefines how the 9-patch edge slices are used to fill the widths.- border_
over PIf the border is rendered over the fill and child visuals.- clip_
to_ bounds PClips the widget child to the area of the widget when set totrue.- corner_
radius PCorner radius of widget and inner widgets.- corner_
radius_ fit PDefines how thecorner_radiusis computed for each usage.- enabled
PDefines if default interaction is allowed in the widget and its descendants.- foreground
PCustom foreground fill. Allows using any other UI node as a foreground overlay.- foreground_
color PFill color overlay.- foreground_
conic PConic gradient foreground.- foreground_
fn PCustom foreground generated using aWidgetFn<()>.- foreground_
gradient PLinear gradient overlay.- foreground_
highlight PForeground highlight border overlay.- foreground_
img PForeground image.- foreground_
img_ align PSets the foreground image alignment.- foreground_
img_ crop PSets the foreground image crop.- foreground_
img_ fit PSets the foreground image fit.- foreground_
img_ offset PSets the foreground image offset.- foreground_
img_ opacity PSets the foreground image opacity.- foreground_
img_ repeat PSets the foreground image repeat.- foreground_
img_ repeat_ spacing PSets the foreground image repeat spacing.- foreground_
radial PRadial gradient foreground.- hit_
test_ mode PDefines if and how the widget is hit-tested.- inline
PEnforce an inline mode on the widget.- interactive
PDefines if any interaction is allowed in the widget and its descendants.- is_
collapsed PIf the widget isCollapsed.- is_
disabled PIf the widget is disabled for interaction.- is_
enabled PIf the widget is enabled for interaction.- is_
hidden PIf the widget isHidden.- is_
hit_ testable PIf the widget is visible for hit-tests.- is_
inited PIf the widget has been initialized.- is_
mobile PGets theIS_MOBILE_VARthat indicates the window or widget should use mobile UI themes.- is_
visible PIf the widget isVisible.- modal
POnly allow interaction inside the widget, descendants and ancestors.- modal_
included PInclude itself in the allow list of another widget that ismodalor descendant of modal.- modal_
includes PExtra widgets that are allowed interaction by this widget when it ismodal.- on_
block PWidget interactions now blocked.- on_
blocked_ changed PWidget interactions where blocked or unblocked.- on_
collapse PWidget visibility changed to collapsed.- on_
deinit PWidget deinited.- on_
disable PWidget normal interactions now disabled.- on_
enable PWidget normal interactions now enabled.- on_
enabled_ changed PWidget was enabled or disabled.- on_hide
PWidget visibility changed to hidden.- on_
info_ init PWidget info is now available.- on_init
PWidget initialized.- on_
interactivity_ changed PWidget interactivity changed.- on_move
PWidget global position changed.- on_
node_ op POn any node operation.- on_
pre_ block PPreviewon_blockevent.- on_
pre_ blocked_ changed PPreviewon_blocked_changedevent.- on_
pre_ collapse PPreviewon_collapseevent.- on_
pre_ deinit PPreviewon_deinitevent.- on_
pre_ disable PPreviewon_disableevent.- on_
pre_ enable PPreviewon_enableevent.- on_
pre_ enabled_ changed PPreviewon_enabled_changedevent.- on_
pre_ hide PPreviewon_hideevent.- on_
pre_ init PPreviewon_initevent.- on_
pre_ interactivity_ changed PPreviewon_interactivity_changedevent.- on_
pre_ move PPreviewon_moveevent.- on_
pre_ node_ op PPreviewon_node_opevent.- on_
pre_ show PPreviewon_showevent.- on_
pre_ transform_ changed PPreviewon_transform_changedevent.- on_
pre_ unblock PPreviewon_unblockevent.- on_
pre_ update PPreviewon_updateevent.- on_
pre_ vis_ disable PPreviewon_vis_disableevent.- on_
pre_ vis_ enable PPreviewon_vis_enableevent.- on_
pre_ vis_ enabled_ changed PPreviewon_vis_enabled_changedevent.- on_
pre_ visibility_ changed PPreviewon_visibility_changedevent.- on_show
PWidget visibility changed to visible.- on_
transform_ changed PWidget global inner transform changed.- on_
unblock PWidget interactions now unblocked.- on_
update PWidgetupdateevent.- on_
vis_ disable PWidget now looks disabled.- on_
vis_ enable PWidget now looks enabled.- on_
vis_ enabled_ changed PWidget changed to enabled or disabled visuals.- on_
visibility_ changed PWidget visibility changed.- parallel
PDefines what node list methods can run in parallel in the widget and descendants.- visibility
PSets the widget visibility.- z_index
PDefines the render order of a widget in a layout panel.
Attribute Macros§
- easing
- Expands a property assign to include an easing animation.
- property
- Expands a function to a widget property.
- widget
- Expands a struct to a widget struct and macro.
- widget_
mixin - Expands a struct to a widget mixin.