abstreet/rustdoc/widgetry/index.html
2020-10-23 01:45:48 +00:00

48 lines
19 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><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">&#9776;</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!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></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'>&#x2212;</span>]</a></span><a class='srclink' href='../src/widgetry/lib.rs.html#1-171' 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 [<code>WidgetImpl</code>] isn't tough.</p>
<p>TODO inline pictures of some of these</p>
<ul>
<li>[<code>AreaSlider</code>] - slider with an associated area graph</li>
<li>[<code>Autocomplete</code>] - select predefined value by combining text entry with menus</li>
<li>[<code>Button</code>] - clickable buttons with keybindings and tooltips</li>
<li>[<code>Checkbox</code>] - toggle between two buttons</li>
<li>[<code>CompareTimes</code>] - a scatter plot specialized for comparing times</li>
<li>[<code>DrawWithTooltips</code>] - draw static geometry, with mouse tooltips in certain regions</li>
<li>[<code>Dropdown</code>] - a button that expands into a menu</li>
<li>[<code>FanChart</code>] - visualize a range of values over time</li>
<li>[<code>Filler</code>] - just carve out space in the layout for something else</li>
<li>[<code>JustDraw</code>] (argh private) - just draw text, <code>GeomBatch</code>es, SVGs</li>
<li>[<code>LinePlot</code>] - visualize 2 variables with a line plot</li>
<li>[<code>Menu</code>] - select something from a menu, with keybindings</li>
<li>[<code>MultiButton</code>] - clickable regions in one batch of geometry</li>
<li>[<code>PersistentSplit</code>] - a button with a dropdown to change its state</li>
<li>[<code>ScatterPlot</code>] - visualize 2 variables with a scatter plot</li>
<li>[<code>Slider</code>] - horizontal and vertical sliders</li>
<li>[<code>Spinner</code>] - numeric input with up/down buttons</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="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.AreaSlider.html" title='widgetry::AreaSlider struct'>AreaSlider</a></td><td class='docblock-short'></td></tr><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.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'></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'></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.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>