mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-26 16:02:23 +03:00
56 lines
21 KiB
HTML
56 lines
21 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `widgetry` crate."><meta name="keywords" content="rust, rustlang, rust-lang, widgetry"><title>widgetry - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings"></script><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../widgetry/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><p class="location">Crate widgetry</p><div class="block version"><p>Version 0.1.0</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all widgetry's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#functions">Functions</a></li></ul></div><p class="location"></p><script>window.sidebarCurrent = {name: "widgetry", ty: "mod", relpath: "../"};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><span class="help-button">?</span>
|
||
<a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../src/widgetry/lib.rs.html#1-173" title="goto source code">[src]</a></span><span class="in-band">Crate <a class="mod" href="">widgetry</a></span></h1><div class="docblock"><h1 id="widgets" class="section-header"><a href="#widgets">Widgets</a></h1>
|
||
<p>If none of these do what you need, implementing a new <a href="../widgetry/widgets/trait.WidgetImpl.html" title="WidgetImpl"><code>WidgetImpl</code></a> isn't tough.</p>
|
||
<p>TODO inline pictures of some of these</p>
|
||
<ul>
|
||
<li><a href="../widgetry/struct.Autocomplete.html" title="Autocomplete"><code>Autocomplete</code></a> - select predefined value by combining text entry with menus</li>
|
||
<li><a href="../widgetry/widgets/button/struct.Button.html" title="Button"><code>Button</code></a> - clickable buttons with keybindings and tooltips</li>
|
||
<li><a href="../widgetry/struct.Checkbox.html" title="Checkbox"><code>Checkbox</code></a> - toggle between two buttons</li>
|
||
<li><a href="../widgetry/struct.CompareTimes.html" title="CompareTimes"><code>CompareTimes</code></a> - a scatter plot specialized for comparing times</li>
|
||
<li><a href="../widgetry/struct.DrawWithTooltips.html" title="DrawWithTooltips"><code>DrawWithTooltips</code></a> - draw static geometry, with mouse tooltips in certain regions</li>
|
||
<li><a href="../widgetry/widgets/dropdown/struct.Dropdown.html" title="Dropdown"><code>Dropdown</code></a> - a button that expands into a menu</li>
|
||
<li><a href="../widgetry/struct.FanChart.html" title="FanChart"><code>FanChart</code></a> - visualize a range of values over time</li>
|
||
<li><a href="../widgetry/struct.Filler.html" title="Filler"><code>Filler</code></a> - just carve out space in the layout for something else</li>
|
||
<li><a href="../widgetry/widgets/just_draw/struct.JustDraw.html" title="JustDraw"><code>JustDraw</code></a> (argh private) - just draw text, <code>GeomBatch</code>es, SVGs</li>
|
||
<li><a href="../widgetry/struct.LinePlot.html" title="LinePlot"><code>LinePlot</code></a> - visualize 2 variables with a line plot</li>
|
||
<li><a href="../widgetry/struct.Menu.html" title="Menu"><code>Menu</code></a> - select something from a menu, with keybindings</li>
|
||
<li><a href="../widgetry/struct.MultiButton.html" title="MultiButton"><code>MultiButton</code></a> - clickable regions in one batch of geometry</li>
|
||
<li><a href="../widgetry/struct.PersistentSplit.html" title="PersistentSplit"><code>PersistentSplit</code></a> - a button with a dropdown to change its state</li>
|
||
<li><a href="../widgetry/struct.ScatterPlot.html" title="ScatterPlot"><code>ScatterPlot</code></a> - visualize 2 variables with a scatter plot</li>
|
||
<li><a href="../widgetry/struct.Slider.html" title="Slider"><code>Slider</code></a> - horizontal and vertical sliders</li>
|
||
<li><a href="../widgetry/struct.Spinner.html" title="Spinner"><code>Spinner</code></a> - numeric input with up/down buttons</li>
|
||
<li><a href="../widgetry/table/struct.Table.html" title="table::Table"><code>table::Table</code></a> - rows and columns, supporting filtering and pagination</li>
|
||
<li>[<code>TexBox</code>] - single line text entry</li>
|
||
</ul>
|
||
</div><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||
<table><tr class="module-item"><td><a class="mod" href="app_state/index.html" title="widgetry::app_state mod">app_state</a></td><td class="docblock-short"><p>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.</p>
|
||
</td></tr><tr class="module-item"><td><a class="mod" href="assets/index.html" title="widgetry::assets mod">assets</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="backend/index.html" title="widgetry::backend mod">backend</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="backend_glow/index.html" title="widgetry::backend_glow mod">backend_glow</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="backend_glow_native/index.html" title="widgetry::backend_glow_native mod">backend_glow_native</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="canvas/index.html" title="widgetry::canvas mod">canvas</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="color/index.html" title="widgetry::color mod">color</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="drawing/index.html" title="widgetry::drawing mod">drawing</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="event/index.html" title="widgetry::event mod">event</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="event_ctx/index.html" title="widgetry::event_ctx mod">event_ctx</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="geom/index.html" title="widgetry::geom mod">geom</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="input/index.html" title="widgetry::input mod">input</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="runner/index.html" title="widgetry::runner mod">runner</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="screen_geom/index.html" title="widgetry::screen_geom mod">screen_geom</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="style/index.html" title="widgetry::style mod">style</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="svg/index.html" title="widgetry::svg mod">svg</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="table/index.html" title="widgetry::table mod">table</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="text/index.html" title="widgetry::text mod">text</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="tools/index.html" title="widgetry::tools mod">tools</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="mod" href="widgets/index.html" title="widgetry::widgets mod">widgets</a></td><td class="docblock-short"></td></tr></table><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||
<table><tr class="module-item"><td><a class="struct" href="struct.Autocomplete.html" title="widgetry::Autocomplete struct">Autocomplete</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Btn.html" title="widgetry::Btn struct">Btn</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Cached.html" title="widgetry::Cached struct">Cached</a></td><td class="docblock-short"><p>Store a cached key/value pair, only recalculating when the key changes.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Canvas.html" title="widgetry::Canvas struct">Canvas</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Checkbox.html" title="widgetry::Checkbox struct">Checkbox</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Choice.html" title="widgetry::Choice struct">Choice</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Color.html" title="widgetry::Color struct">Color</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.CompareTimes.html" title="widgetry::CompareTimes struct">CompareTimes</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.DrawWithTooltips.html" title="widgetry::DrawWithTooltips struct">DrawWithTooltips</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Drawable.html" title="widgetry::Drawable struct">Drawable</a></td><td class="docblock-short"><p>Geometry that's been uploaded to the GPU once and can be quickly redrawn many times. Create by
|
||
creating a <code>GeomBatch</code> and calling <code>ctx.upload(batch)</code>.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.EdgeInsets.html" title="widgetry::EdgeInsets struct">EdgeInsets</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.EventCtx.html" title="widgetry::EventCtx struct">EventCtx</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.FanChart.html" title="widgetry::FanChart struct">FanChart</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Filler.html" title="widgetry::Filler struct">Filler</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.GeomBatch.html" title="widgetry::GeomBatch struct">GeomBatch</a></td><td class="docblock-short"><p>A mutable builder for a group of colored polygons.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.GfxCtx.html" title="widgetry::GfxCtx struct">GfxCtx</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.LinePlot.html" title="widgetry::LinePlot struct">LinePlot</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.LinearGradient.html" title="widgetry::LinearGradient struct">LinearGradient</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Menu.html" title="widgetry::Menu struct">Menu</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.MultiButton.html" title="widgetry::MultiButton struct">MultiButton</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Panel.html" title="widgetry::Panel struct">Panel</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.PersistentSplit.html" title="widgetry::PersistentSplit struct">PersistentSplit</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.PlotOptions.html" title="widgetry::PlotOptions struct">PlotOptions</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Prerender.html" title="widgetry::Prerender struct">Prerender</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.ScatterPlot.html" title="widgetry::ScatterPlot struct">ScatterPlot</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.ScreenDims.html" title="widgetry::ScreenDims struct">ScreenDims</a></td><td class="docblock-short"><p>ScreenDims is in units of logical pixels, as opposed to physical pixels.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ScreenPt.html" title="widgetry::ScreenPt struct">ScreenPt</a></td><td class="docblock-short"><p>ScreenPt is in units of logical pixels, as opposed to physical pixels.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.ScreenRectangle.html" title="widgetry::ScreenRectangle struct">ScreenRectangle</a></td><td class="docblock-short"><p>ScreenRectangle is in units of logical pixels, as opposed to physical pixels.</p>
|
||
</td></tr><tr class="module-item"><td><a class="struct" href="struct.Series.html" title="widgetry::Series struct">Series</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Settings.html" title="widgetry::Settings struct">Settings</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Slider.html" title="widgetry::Slider struct">Slider</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Spinner.html" title="widgetry::Spinner struct">Spinner</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Style.html" title="widgetry::Style struct">Style</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Text.html" title="widgetry::Text struct">Text</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.TextSpan.html" title="widgetry::TextSpan struct">TextSpan</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Texture.html" title="widgetry::Texture struct">Texture</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.UserInput.html" title="widgetry::UserInput struct">UserInput</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Warper.html" title="widgetry::Warper struct">Warper</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.Widget.html" title="widgetry::Widget struct">Widget</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="struct" href="struct.WidgetOutput.html" title="widgetry::WidgetOutput struct">WidgetOutput</a></td><td class="docblock-short"></td></tr></table><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||
<table><tr class="module-item"><td><a class="enum" href="enum.DrawBaselayer.html" title="widgetry::DrawBaselayer enum">DrawBaselayer</a></td><td class="docblock-short"><p>Before <code>State::draw</code> is called, draw something else.</p>
|
||
</td></tr><tr class="module-item"><td><a class="enum" href="enum.Event.html" title="widgetry::Event enum">Event</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.Fill.html" title="widgetry::Fill enum">Fill</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.HorizontalAlignment.html" title="widgetry::HorizontalAlignment enum">HorizontalAlignment</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.Key.html" title="widgetry::Key enum">Key</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.MultiKey.html" title="widgetry::MultiKey enum">MultiKey</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.Outcome.html" title="widgetry::Outcome enum">Outcome</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.RewriteColor.html" title="widgetry::RewriteColor enum">RewriteColor</a></td><td class="docblock-short"><p>A way to transform all colors in a GeomBatch.</p>
|
||
</td></tr><tr class="module-item"><td><a class="enum" href="enum.Transition.html" title="widgetry::Transition enum">Transition</a></td><td class="docblock-short"><p>When a state responds to an event, it can specify some way to manipulate the stack of states.</p>
|
||
</td></tr><tr class="module-item"><td><a class="enum" href="enum.UpdateType.html" title="widgetry::UpdateType enum">UpdateType</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="enum" href="enum.VerticalAlignment.html" title="widgetry::VerticalAlignment enum">VerticalAlignment</a></td><td class="docblock-short"></td></tr></table><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||
<table><tr class="module-item"><td><a class="trait" href="trait.SharedAppState.html" title="widgetry::SharedAppState trait">SharedAppState</a></td><td class="docblock-short"><p>Any data that should last the entire lifetime of the application should be stored in the struct
|
||
implementing this trait.</p>
|
||
</td></tr><tr class="module-item"><td><a class="trait" href="trait.SimpleState.html" title="widgetry::SimpleState trait">SimpleState</a></td><td class="docblock-short"><p>Many states fit a pattern of managing a single panel, handling mouseover events, and other
|
||
interactions on the map. Implementing this instead of <code>State</code> reduces some boilerplate.</p>
|
||
</td></tr><tr class="module-item"><td><a class="trait" href="trait.State.html" title="widgetry::State trait">State</a></td><td class="docblock-short"><p>A temporary state of an application. There's a stack of these, with the most recent being the
|
||
active one.</p>
|
||
</td></tr><tr class="module-item"><td><a class="trait" href="trait.TextExt.html" title="widgetry::TextExt trait">TextExt</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="trait" href="trait.WidgetImpl.html" title="widgetry::WidgetImpl trait">WidgetImpl</a></td><td class="docblock-short"><p>Create a new widget by implementing this trait. You can instantiate your widget by calling
|
||
<code>Widget::new(Box::new(instance of your new widget))</code>, which gives you the usual style options.</p>
|
||
</td></tr></table><h2 id="functions" class="section-header"><a href="#functions">Functions</a></h2>
|
||
<table><tr class="module-item"><td><a class="fn" href="fn.Line.html" title="widgetry::Line fn">Line</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="fn" href="fn.hotkeys.html" title="widgetry::hotkeys fn">hotkeys</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="fn" href="fn.lctrl.html" title="widgetry::lctrl fn">lctrl</a></td><td class="docblock-short"></td></tr><tr class="module-item"><td><a class="fn" href="fn.run.html" title="widgetry::run fn">run</a></td><td class="docblock-short"></td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "widgetry";</script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |