Skip to main content

Control

Enum Control 

Source
pub enum Control {
Show 16 variants Slider(SliderData), Scroll { sprites: Vec<Option<SpriteRef>>, vertical: bool, value: f32, page: f32, inset: i32, thumb_color: u32, drag: Option<(f32, i32)>, }, Progress { sprites: Vec<Option<SpriteRef>>, background_color: u32, value: f32, content: Option<NodeId>, }, Edit(EditData), Graph { size: [i32; 2], sprite: Option<SpriteRef>, tick: i32, y_range: f32, x_divisions: i32, y_divisions: i32, series: Vec<(u32, Vec<i32>)>, }, Table { cells: Vec<(usize, usize, NodeId)>, columns: Vec<i32>, rows: Vec<i32>, spacing: i32, }, Layout(Vec<LayoutChild>), Tabs { decoration: [Option<NodeId>; 3], tabs: Vec<(NodeId, NodeId)>, selected: usize, gap: i32, header_height: i32, }, Clip { content: Option<NodeId>, size: [i32; 2], offset: [i32; 2], }, Container { content: Option<NodeId>, bars: [Option<NodeId>; 2], size: [i32; 2], spacing: i32, offset: [i32; 2], view: [i32; 4], wheel: i32, fine: f32, }, Check { button: NodeId, mark: Option<NodeId>, checked: bool, }, Combo { button: NodeId, list: NodeId, open: bool, }, Spinner { parts: [Option<NodeId>; 3], value: i32, step: i32, }, Page { children: Vec<NodeId>, selected: usize, }, Radio { children: Vec<NodeId>, selected: usize, }, Document(Document),
}
Expand description

A control and its state.

Variants§

§

Slider(SliderData)

A slider.

§

Scroll

A scroll bar.

Fields

§sprites: Vec<Option<SpriteRef>>

The sprites of the track and the thumb.

§vertical: bool

A vertical bar when true.

§value: f32

The position, from 0 to 1.

§page: f32

The share of the content that is visible, from 0 to 1.

§inset: i32

The bar’s inset at both ends of the track (ScrollDescription).

§thumb_color: u32

The thumb’s colour.

§drag: Option<(f32, i32)>

A drag from the thumb (flag 0x200000): the value and the pointer’s coordinate along the bar when it began.

§

Progress

A progress bar.

Fields

§sprites: Vec<Option<SpriteRef>>

The sprites of the fill and the background.

§background_color: u32

The background’s colour, 0xAARRGGBB.

§value: f32

The fill, from 0 to 1.

§content: Option<NodeId>

The element drawn on top (usually a label).

§

Edit(EditData)

An edit box.

§

Graph

GraphElement: a frame, y_divisions + 1 lines across (with ticks of tick px to the left) and x_divisions + 1 down (ticks below), then each graph’s points from the left edge to the right, y_range at the top.

Fields

§size: [i32; 2]

The size in pixels.

§sprite: Option<SpriteRef>

The sprite the lines are drawn with.

§tick: i32

The length of the ticks, in pixels.

§y_range: f32

The value at the top of the graph.

§x_divisions: i32

The number of divisions across.

§y_divisions: i32

The number of divisions down.

§series: Vec<(u32, Vec<i32>)>

AddGraph(color) / AddGraphPoint.

§

Table

A table of cells in rows and columns.

Fields

§cells: Vec<(usize, usize, NodeId)>

Each cell: its row, its column and its element.

§columns: Vec<i32>

The width of each column after the last layout.

§rows: Vec<i32>

The height of each row after the last layout.

§spacing: i32

The space between the cells, in pixels.

§

Layout(Vec<LayoutChild>)

Children placed by anchors relative to the element.

§

Tabs

Tabs: a header for each tab, and the page of the selected one.

Fields

§decoration: [Option<NodeId>; 3]

The elements drawn around the tabs.

§tabs: Vec<(NodeId, NodeId)>

Each tab: its header and its page.

§selected: usize

The selected tab.

§gap: i32

The space between the headers, in pixels.

§header_height: i32

The headers’ height, in pixels.

§

Clip

A window onto its content, cut at its edges.

Fields

§content: Option<NodeId>

The content.

§size: [i32; 2]

The window’s size, in pixels.

§offset: [i32; 2]

The content’s offset, in pixels.

§

Container

A scrolling area: its content and its scroll bars.

Fields

§content: Option<NodeId>

The content.

§bars: [Option<NodeId>; 2]

The horizontal and the vertical scroll bar.

§size: [i32; 2]

The size, in pixels.

§spacing: i32

The space between the content and the bars, in pixels.

§offset: [i32; 2]

How far the content is scrolled, in pixels.

§view: [i32; 4]

The visible part of the content: x0, y0, x1, y1.

§wheel: i32

ContainerElement::Update: the wheel’s frames still to scroll (±7 a notch) and the vertical bar’s value (ScrollElement, in pixels).

§fine: f32

The vertical bar’s position, in pixels.

§

Check

A check box.

Fields

§button: NodeId

The box.

§mark: Option<NodeId>

The tick, shown when checked.

§checked: bool

Whether it is checked.

§

Combo

A combo box: a button that opens a list.

Fields

§button: NodeId

The button that shows the choice.

§list: NodeId

The list of choices.

§open: bool

Whether the list is open.

§

Spinner

A number with up and down arrows.

Fields

§parts: [Option<NodeId>; 3]

The number and the two arrows.

§value: i32

The number.

§step: i32

How much an arrow changes it.

§

Page

Pages, of which one is shown.

Fields

§children: Vec<NodeId>

The pages.

§selected: usize

The page shown.

§

Radio

Radio buttons, of which one is selected.

Fields

§children: Vec<NodeId>

The buttons.

§selected: usize

The selected button.

§

Document(Document)

A document with markup: the help pages and the tutorials.

Trait Implementations§

Source§

impl Clone for Control

Source§

fn clone(&self) -> Control

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Control

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.