Expand description
§Widgets
If none of these do what you need, implementing a new WidgetImpl
isn’t tough.
TODO inline pictures of some of these
Autocomplete
- select predefined value by combining text entry with menusButton
- clickable buttons with keybindings and tooltipsToggle
- checkboxes, switches, and other togglesCompareTimes
- a scatter plot specialized for comparing timesDragDrop
- a reorderable row of draggable cardsDrawWithTooltips
- draw static geometry, with mouse tooltips in certain regionsDropdown
- a button that expands into a menuFanChart
- visualize a range of values over timeFiller
- just carve out space in the layout for something elseJustDraw
(argh private) - just draw text,GeomBatch
es, SVGsLinePlot
- visualize 2 variables with a line plotMenu
- select something from a menu, with keybindingsPersistentSplit
- a button with a dropdown to change its stateScatterPlot
- visualize 2 variables with a scatter plotSlider
- horizontal and vertical slidersSpinner
- numeric input with up/down buttonstable::Table
- rows and columns, supporting filtering and paginationTextBox
- single line text entry
Re-exports§
pub use crate::tools::Cached;
Modules§
- app_
state 🔒 - A widgetry application splits its state into two pieces: global shared state that lasts for the entire lifetime of the application, and a stack of smaller states, only one of which is active at a time. For example, imagine an application to view a map. The shared state would include the map and pre-rendered geometry for it. The individual states might start with a splash screen or menu to choose a map, then a map viewer, then maybe a state to drill down into pieces of the map.
- assets 🔒
- backend 🔒
- backend_
glow 🔒 - backend_
glow_ 🔒native - canvas 🔒
- color 🔒
- drawing 🔒
- event 🔒
- event_
ctx 🔒 - geom 🔒
- input 🔒
- mapspace
- runner 🔒
- screen_
geom 🔒 - style 🔒
- svg 🔒
- table
- text 🔒
- tools
- widgets 🔒
Macros§
- include_
labeled_ bytes - Like
std::include_bytes!
, but also returns its argument, the relative path to the bytes
Structs§
- Autocomplete
- Button
Builder - Button
Style - Canvas
- Canvas
Settings - Choice
- Color
- Compare
Times - Drag
Drop - Draw
With Tooltips - Drawable
- Geometry that’s been uploaded to the GPU once and can be quickly redrawn many times. Create by
creating a
GeomBatch
and callingctx.upload(batch)
. - Edge
Insets - Event
Ctx - FanChart
- Filler
- Doesn’t do anything by itself, just used for widgetsing. Something else reaches in, asks for the ScreenRectangle to use.
- Geom
Batch - A mutable builder for a group of colored tessellated polygons.
- Geom
Batch Stack - Similar to [
Widget::row
]/[Widget::column
], but forGeomBatch
s instead of [Widget
]s, and follows a builder pattern - GfxCtx
- Image
- A stylable UI component builder which presents vector graphics from an
ImageSource
. - Line
Plot - Linear
Gradient - Menu
- Panel
- Panel
Builder - Persistent
Split - Plot
Options - Prerender
- Rounded
F64 - An f64 rounded to 4 decimal places. Useful with Spinners, to avoid values accumulating small drift.
- Scatter
Plot - Screen
Dims - ScreenDims is in units of logical pixels, as opposed to physical pixels.
- Screen
Pt - ScreenPt is in units of logical pixels, as opposed to physical pixels.
- Screen
Rectangle - ScreenRectangle is in units of logical pixels, as opposed to physical pixels.
- Series
- Settings
- Customize how widgetry works. Most of these settings can’t be changed after starting.
- Slider
- Spinner
- Stash
- An invisible widget that stores some arbitrary data on the Panel. Users of the panel can read and write the value. This is one method for “returning” data when a State completes.
- Style
- TabController
- Text
- TextBox
- Text
Span - Texture
- Toggle
- User
Input - Warper
- Widget
- Widget
Output
Enums§
- Click
Outcome - When an action happens through a button-like widget, what data is plumbed back?
- Content
Mode - Rules for how content should stretch to fill its bounds
- Control
State - Corner
Rounding - Draw
Baselayer - Before
State::draw
is called, draw something else. - Event
- Fill
- Font
- Horizontal
Alignment - Image
Source - The visual
- Key
- Multi
Key - Outcome
- The result of a Panel handling an event
- Panel
Dims - Rewrite
Color - A way to transform all colors in a GeomBatch.
- Stack
Alignment - Stack
Axis - Transition
- When a state responds to an event, it can specify some way to manipulate the stack of states.
- Update
Type - Vertical
Alignment
Constants§
Traits§
- Shared
AppState - Any data that should last the entire lifetime of the application should be stored in the struct implementing this trait.
- Simple
State - Many states fit a pattern of managing a single panel, handling mouseover events, and other
interactions on the map. Implementing this instead of
State
reduces some boilerplate. - State
- A temporary state of an application. There’s a stack of these, with the most recent being the active one.
- TextExt
- Widget
Impl - Create a new widget by implementing this trait. You can instantiate your widget by calling
Widget::new(Box::new(instance of your new widget))
, which gives you the usual style options.