Doc review.
This commit is contained in:
parent
332d2dce83
commit
df47d74cbf
|
@ -5,6 +5,7 @@
|
|||
- Review badges.
|
||||
* Review docs.
|
||||
- Do a full read, look for typos or failed links.
|
||||
- Last reviewed zero_ui -> modules -> `AnsiText`
|
||||
|
||||
# Publish
|
||||
|
||||
|
|
|
@ -45,12 +45,12 @@ impl WidgetBase {
|
|||
Self::inherit(Self::widget_type())
|
||||
}
|
||||
|
||||
/// Direct reference the widget builder.
|
||||
/// Returns a mutable reference to the widget builder.
|
||||
pub fn widget_builder(&mut self) -> &mut WidgetBuilder {
|
||||
self.builder.get_mut().as_mut().expect("already built")
|
||||
}
|
||||
|
||||
/// Direct reference the current `when` block.
|
||||
/// Returns a mutable reference to the `when` block if called inside a when block.
|
||||
pub fn widget_when(&mut self) -> Option<&mut WhenInfo> {
|
||||
self.when.get_mut().as_mut()
|
||||
}
|
||||
|
@ -77,14 +77,14 @@ impl WidgetBase {
|
|||
node::build(wgt)
|
||||
}
|
||||
|
||||
/// Gets or sets the importance of the next property assigns, unsets or when blocks.
|
||||
/// Returns a mutable reference to the importance of the next property assigns, unsets or when blocks.
|
||||
///
|
||||
/// Note that during the `widget_intrinsic` call this is [`Importance::WIDGET`] and after it is [`Importance::INSTANCE`].
|
||||
pub fn widget_importance(&mut self) -> &mut Importance {
|
||||
&mut self.importance
|
||||
}
|
||||
|
||||
/// Start building a `when` block, all properties set after this call go on the when block.
|
||||
/// Start building a `when` block, all properties set after this call go in the when block.
|
||||
pub fn start_when_block(&mut self, inputs: Box<[WhenInput]>, state: BoxedVar<bool>, expr: &'static str, location: SourceLocation) {
|
||||
assert!(self.builder.get_mut().is_some(), "cannot start `when` after build");
|
||||
assert!(self.when.get_mut().is_none(), "cannot nest `when` blocks");
|
||||
|
@ -99,7 +99,7 @@ impl WidgetBase {
|
|||
});
|
||||
}
|
||||
|
||||
/// End the current `when` block, all properties set after this call go on the widget.
|
||||
/// End the current `when` block, all properties set after this call go in the widget.
|
||||
pub fn end_when_block(&mut self) {
|
||||
let when = self.when.get_mut().take().expect("no current `when` block to end");
|
||||
self.builder.get_mut().as_mut().unwrap().push_when(self.importance, when);
|
||||
|
|
|
@ -245,26 +245,26 @@ impl<'a> WidgetAccessInfoBuilder<'a> {
|
|||
self.with_access(|a| a.set_state(AccessState::Lang(lang)))
|
||||
}
|
||||
|
||||
/// Sets the amount scrolled on the horizontal if the content can be scrolled horizontally.
|
||||
/// Sets the amount scrolled horizontally if allowed.
|
||||
///
|
||||
/// The `normal_x` value can be a read-only variable, the variable can be updated without needing to rebuild
|
||||
/// info for every pixel scrolled, if the view-process requires access info the value is updated every render
|
||||
/// together with the widget bounds updates.
|
||||
///
|
||||
/// The value must be normalized in the 0..1 range, 0 is showing the content leftmost edge, 1 is showing
|
||||
/// The value must be normalized in the 0..=1 range, 0 is showing the content leftmost edge, 1 is showing
|
||||
/// the content the rightmost edge.
|
||||
pub fn set_scroll_horizontal(&mut self, normal_x: impl IntoVar<Factor>) {
|
||||
let normal_x = normal_x.into_var().boxed();
|
||||
self.with_access(|a| a.set_state_source(AccessStateSource::ScrollHorizontal(normal_x)))
|
||||
}
|
||||
|
||||
/// Sets the amount scrolled on the vertical if the content can be scrolled vertically.
|
||||
/// Sets the amount scrolled vertically if allowed.
|
||||
///
|
||||
/// The `normal_y` value can be a read-only variable, the variable can be updated without needing to rebuild
|
||||
/// info for every pixel scrolled, if the view-process requires access info the value is updated every render
|
||||
/// together with the widget bounds updates.
|
||||
///
|
||||
/// The value must be normalized in the 0..1 range, 0 is showing the content topmost edge, 1 is showing
|
||||
/// The value must be normalized in the 0..=1 range, 0 is showing the content topmost edge, 1 is showing
|
||||
/// the content the bottommost edge.
|
||||
pub fn set_scroll_vertical(&mut self, normal_y: impl IntoVar<Factor>) {
|
||||
let normal_y = normal_y.into_var().boxed();
|
||||
|
|
|
@ -2601,7 +2601,7 @@ impl From<font_kit::properties::Stretch> for FontStretch {
|
|||
}
|
||||
}
|
||||
|
||||
/// The degree of blackness or stroke thickness of a font. This value ranges from 100.0 to 900.0,
|
||||
/// The degree of stroke thickness of a font. This value ranges from 100.0 to 900.0,
|
||||
/// with 400.0 as normal.
|
||||
#[derive(Clone, Copy, Transitionable)]
|
||||
pub struct FontWeight(pub f32);
|
||||
|
|
|
@ -12,21 +12,21 @@ event_property! {
|
|||
with: access_click,
|
||||
}
|
||||
|
||||
/// Access requested expand or collapse the widget content.
|
||||
/// Access requested to expand or collapse the widget content.
|
||||
pub fn access_expander {
|
||||
event: ACCESS_EXPANDER_EVENT,
|
||||
args: AccessExpanderArgs,
|
||||
with: access_expander,
|
||||
}
|
||||
|
||||
/// Access requested increment or decrement the widget value by steps.
|
||||
/// Access requested to increment or decrement the widget value by steps.
|
||||
pub fn access_increment {
|
||||
event: ACCESS_INCREMENT_EVENT,
|
||||
args: AccessIncrementArgs,
|
||||
with: access_increment,
|
||||
}
|
||||
|
||||
/// Access requested show or hide the widget's tooltip.
|
||||
/// Access requested to show or hide the widget's tooltip.
|
||||
///
|
||||
/// Note that the tooltip property already handles this event.
|
||||
pub fn access_tooltip {
|
||||
|
|
|
@ -236,7 +236,7 @@ pub fn col_span(child: impl UiNode, span: impl IntoVar<usize>) -> impl UiNode {
|
|||
with_access_state(child, span, |b, v| b.set_col_span(*v))
|
||||
}
|
||||
|
||||
/// Sets the total number of rows in a [`Table`], [`Grid`], or [`TreeGrid`] when not all rows are present in tree.
|
||||
/// Sets the total number of rows in a [`Table`], [`Grid`], or [`TreeGrid`] when not all rows are present in the tree.
|
||||
///
|
||||
/// The value `0` indicates that not all rows are in the widget and the application cannot determinate the exact number.
|
||||
///
|
||||
|
@ -322,7 +322,7 @@ pub fn labelled_by(child: impl UiNode, labels: impl IntoVar<Vec<WidgetId>>) -> i
|
|||
})
|
||||
}
|
||||
|
||||
/// Append widgets that are a *child* of this widget, but is not already a child in the info tree.
|
||||
/// Append `owned` widgets that are *children* of this widget, but are not already children in the info tree.
|
||||
#[property(CONTEXT)]
|
||||
pub fn owns(child: impl UiNode, owned: impl IntoVar<Vec<WidgetId>>) -> impl UiNode {
|
||||
with_access_state(child, owned, |b, v| {
|
||||
|
@ -354,26 +354,26 @@ pub fn lang(child: impl UiNode, lang: impl IntoVar<Lang>) -> impl UiNode {
|
|||
with_access_state(child, lang, |b, v| b.set_lang(v.0.clone()))
|
||||
}
|
||||
|
||||
/// Sets the amount scrolled on the horizontal if the content can be scrolled horizontally.
|
||||
/// Sets the amount scrolled horizontally if allowed.
|
||||
///
|
||||
/// The `normal_x` value can be a read-only variable, the variable can be updated without needing to rebuild
|
||||
/// info for every pixel scrolled, if the view-process requires access info the value is updated every render
|
||||
/// together with the widget bounds updates.
|
||||
///
|
||||
/// The value must be normalized in the 0..1 range, 0 is showing the content leftmost edge, 1 is showing
|
||||
/// The value must be normalized in the 0..=1 range, 0 is showing the content leftmost edge, 1 is showing
|
||||
/// the content the rightmost edge.
|
||||
#[property(CONTEXT)]
|
||||
pub fn scroll_horizontal(child: impl UiNode, normal_x: impl IntoVar<Factor>) -> impl UiNode {
|
||||
with_access_state_var(child, normal_x, |b, v| b.set_scroll_horizontal(v.clone()))
|
||||
}
|
||||
|
||||
/// Sets the amount scrolled on the vertical if the content can be scrolled vertically.
|
||||
/// Sets the amount scrolled vertically if allowed.
|
||||
///
|
||||
/// The `normal_y` value can be a read-only variable, the variable can be updated without needing to rebuild
|
||||
/// info for every pixel scrolled, if the view-process requires access info the value is updated every render
|
||||
/// together with the widget bounds updates.
|
||||
///
|
||||
/// The value must be normalized in the 0..1 range, 0 is showing the content topmost edge, 1 is showing
|
||||
/// The value must be normalized in the 0..=1 range, 0 is showing the content topmost edge, 1 is showing
|
||||
/// the content the bottommost edge.
|
||||
#[property(CONTEXT)]
|
||||
pub fn scroll_vertical(child: impl UiNode, normal_y: impl IntoVar<Factor>) -> impl UiNode {
|
||||
|
|
|
@ -18,7 +18,7 @@ use zero_ui_wgt_text::*;
|
|||
#[doc(hidden)]
|
||||
pub use zero_ui_wgt_text::__formatx;
|
||||
|
||||
/// Render text styled using ANSI scale sequences.
|
||||
/// Render text styled using ANSI escape sequences.
|
||||
///
|
||||
/// Supports color, weight, italic and more, see [`AnsiStyle`] for the full style supported.
|
||||
#[widget($crate::AnsiText {
|
||||
|
@ -82,7 +82,7 @@ mod ansi_parse {
|
|||
pub struct AnsiStyle {
|
||||
/// Background color.
|
||||
pub background_color: AnsiColor,
|
||||
/// Foreground color.
|
||||
/// Font color.
|
||||
pub color: AnsiColor,
|
||||
/// Font weight.
|
||||
pub weight: AnsiWeight,
|
||||
|
|
|
@ -120,7 +120,7 @@ pub fn font_size(child: impl UiNode, size: impl IntoVar<FontSize>) -> impl UiNod
|
|||
with_context_var(child, FONT_SIZE_VAR, size)
|
||||
}
|
||||
|
||||
/// Defines how condensed or expanded the preferred font should be.
|
||||
/// Defines the thickness or boldness the preferred font should have.
|
||||
///
|
||||
/// This value influences font resolution, the variant within the font family that is closest to this config will be selected.
|
||||
///
|
||||
|
@ -820,7 +820,7 @@ impl TextSpacingMix<()> {
|
|||
/// usually similar to `1.2.em()`. Relative values are computed from the default value, so `200.pct()` is double
|
||||
/// the default line height.
|
||||
///
|
||||
/// The text is vertically centralized inside the height.
|
||||
/// The text is vertically centered inside the height.
|
||||
///
|
||||
/// [`Default`]: Length::Default
|
||||
///
|
||||
|
@ -863,7 +863,7 @@ pub fn line_spacing(child: impl UiNode, extra: impl IntoVar<LineSpacing>) -> imp
|
|||
with_context_var(child, LINE_SPACING_VAR, extra)
|
||||
}
|
||||
|
||||
/// Extra spacing added to the Unicode `U+0020 SPACE` character. If not set inherits the `letter_spacing` from the parent widget.
|
||||
/// Extra spacing added to the Unicode `U+0020 SPACE` character. If not set inherits the `word_spacing` from the parent widget.
|
||||
///
|
||||
/// Word spacing is done using the space character "advance" as defined in the font,
|
||||
/// this unit represents extra spacing added to that default spacing.
|
||||
|
@ -871,7 +871,7 @@ pub fn line_spacing(child: impl UiNode, extra: impl IntoVar<LineSpacing>) -> imp
|
|||
/// A "word" is the sequence of characters in-between space characters. This extra
|
||||
/// spacing is applied per space character not per word, if there are three spaces between words
|
||||
/// the extra spacing is applied thrice. Usually the number of spaces between words is collapsed to one,
|
||||
/// see [`WhiteSpace`].
|
||||
/// see [`WhiteSpace`], resulting in only one extra spacing.
|
||||
///
|
||||
/// The [`Default`] value signals that word spacing can be tweaked when text *justification* is enabled, all other
|
||||
/// values disable automatic adjustments for justification. Relative values are computed from the length of the space `' '` character,
|
||||
|
|
Loading…
Reference in New Issue