Skip to content

Commit

Permalink
deploy: e53a5ab
Browse files Browse the repository at this point in the history
  • Loading branch information
xStrom committed Jun 15, 2023
1 parent 0c32874 commit 0458e3d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
6 changes: 3 additions & 3 deletions 01_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ <h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a>
released version of Druid (v0.8).</p>
<h2 id="key-concepts"><a class="header" href="#key-concepts">Key Concepts</a></h2>
<ul>
<li><strong><a href="./data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
<li><strong><a href="./03_data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./04_widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./05_lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
your UI.</li>
</ul>

Expand Down
8 changes: 4 additions & 4 deletions 04_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ <h1 id="widgets-and-the-widget-trait"><a class="header" href="#widgets-and-the-w
and custom widgets to create a <em>widget tree</em>; you will start with some single
<em>root widget</em>, which will (generally) have children, which may themselves have
children, and so on. <code>Widget</code> has a generic parameter <code>T</code> that represents
the <a href="./data.html"><code>Data</code></a> handled by that widget. Some widgets (such as layout widgets)
the <a href="./03_data.html"><code>Data</code></a> handled by that widget. Some widgets (such as layout widgets)
may be entirely agnostic about what sort of <code>Data</code> they encounter, while other
widgets (such as a slider) may expect a single type (such as <code>f64</code>).</p>
<blockquote>
<p><strong>Note</strong>: For more information on how different parts of your <a href="./data.html"><code>Data</code></a> are exposed
to different widgets, see <a href="./lens.html"><code>Lens</code></a>.</p>
<p><strong>Note</strong>: For more information on how different parts of your <a href="./03_data.html"><code>Data</code></a> are exposed
to different widgets, see <a href="./05_lens.html"><code>Lens</code></a>.</p>
</blockquote>
<p>At a high level, Druid works like this:</p>
<ul>
Expand Down Expand Up @@ -186,7 +186,7 @@ <h1 id="widgets-and-the-widget-trait"><a class="header" href="#widgets-and-the-w
predictably during event handling, but only when extra information (such
as if a widget has gained focus) happens as a consequence of other events.</li>
</ul>
<p>For more information on implementing these methods, see <a href="./custom_widgets.html">Creating custom
<p>For more information on implementing these methods, see <a href="./08_widgets_in_depth.html">Creating custom
widgets</a>.</p>
<h2 id="modularity-and-composition"><a class="header" href="#modularity-and-composition">Modularity and composition</a></h2>
<p>Widgets are intended to be modular and composable, not monolithic. For instance,
Expand Down
20 changes: 10 additions & 10 deletions 08_widgets_in_depth.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ <h1 id="create-custom-widgets"><a class="header" href="#create-custom-widgets">C
will eventually need to create and use custom <code>Widget</code>s.</p>
<h2 id="painter-and-controller"><a class="header" href="#painter-and-controller"><code>Painter</code> and <code>Controller</code></a></h2>
<p>There are two helper widgets in Druid that let you customize widget behaviour
without needing to implement the full widget trait: <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Painter.html"><code>Painter</code></a> and
<a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a>.</p>
without needing to implement the full widget trait: <a href="https://docs.rs/druid/latest/druid/widget/struct.Painter.html"><code>Painter</code></a> and
<a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a>.</p>
<h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Painter.html"><code>Painter</code></a> widget lets you draw arbitrary custom content, but cannot
<p>The <a href="https://docs.rs/druid/latest/druid/widget/struct.Painter.html"><code>Painter</code></a> widget lets you draw arbitrary custom content, but cannot
respond to events or otherwise contain update logic. Its general use is to
either provide a custom background to some other widget, or to implement
something like an icon or another graphical element that will be contained in
Expand All @@ -169,12 +169,12 @@ <h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
}</code></pre>
<p><code>Painter</code> uses all the space that is available to it; if you want to give it a
set size, you must pass it explicit constraints, such as by wrapping it in a
<a href="https://docs.rs/druid/0.8.3/druid/widget/struct.SizedBox.html"><code>SizedBox</code></a>:</p>
<a href="https://docs.rs/druid/latest/druid/widget/struct.SizedBox.html"><code>SizedBox</code></a>:</p>
<pre><code class="language-rust noplaypen">fn sized_swatch() -&gt; impl Widget&lt;Color&gt; {
SizedBox::new(make_color_swatch()).width(20.0).height(20.0)
}</code></pre>
<p>One other useful thing about <code>Painter</code> is that it can be used as the background
of a <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Container.html"><code>Container</code></a> widget. If we wanted to have a label that used our swatch
of a <a href="https://docs.rs/druid/latest/druid/widget/struct.Container.html"><code>Container</code></a> widget. If we wanted to have a label that used our swatch
as a background, we could do:</p>
<pre><code class="language-rust noplaypen">fn background_label() -&gt; impl Widget&lt;Color&gt; {
Label::dynamic(|color: &amp;Color, _| {
Expand All @@ -183,16 +183,16 @@ <h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
})
.background(make_color_swatch())
}</code></pre>
<p>(This uses the <a href="https://docs.rs/druid/0.8.3/druid/trait.WidgetExt.html#background"><code>background</code></a> method on <a href="https://docs.rs/druid/0.8.3/druid/trait.WidgetExt.html"><code>WidgetExt</code></a> to embed our label in a
<p>(This uses the <a href="https://docs.rs/druid/latest/druid/trait.WidgetExt.html#background"><code>background</code></a> method on <a href="https://docs.rs/druid/latest/druid/trait.WidgetExt.html"><code>WidgetExt</code></a> to embed our label in a
container.)</p>
<h3 id="controller"><a class="header" href="#controller">Controller</a></h3>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a> trait is sort of the inverse of <code>Painter</code>; it is a way to
<p>The <a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a> trait is sort of the inverse of <code>Painter</code>; it is a way to
make widgets that handle events, but don't do any layout or drawing. The idea
here is that you can use some <code>Controller</code> type to customize the behaviour of
some set of children.</p>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a> trait has <code>event</code>, <code>update</code>, and <code>lifecycle</code> methods, just
like <a href="./widget.html"><code>Widget</code></a>; it does not have <code>paint</code> or <code>layout</code> methods. Also unlike
<a href="./widget.html"><code>Widget</code></a>, all of its methods are optional; you can override only the method
<p>The <a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a> trait has <code>event</code>, <code>update</code>, and <code>lifecycle</code> methods, just
like <a href="./04_widget.html"><code>Widget</code></a>; it does not have <code>paint</code> or <code>layout</code> methods. Also unlike
<a href="./04_widget.html"><code>Widget</code></a>, all of its methods are optional; you can override only the method
that you need.</p>
<p>There's one other difference to the <code>Controller</code> methods; it is explicitly
passed a mutable reference to its child in each method, so that it can modify it
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ <h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a>
released version of Druid (v0.8).</p>
<h2 id="key-concepts"><a class="header" href="#key-concepts">Key Concepts</a></h2>
<ul>
<li><strong><a href="./data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
<li><strong><a href="./03_data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./04_widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./05_lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
your UI.</li>
</ul>

Expand Down
34 changes: 17 additions & 17 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ <h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a>
released version of Druid (v0.8).</p>
<h2 id="key-concepts"><a class="header" href="#key-concepts">Key Concepts</a></h2>
<ul>
<li><strong><a href="./data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
<li><strong><a href="./03_data.html">the <code>Data</code> trait</a></strong>: How you represent your application model.</li>
<li><strong><a href="./04_widget.html">the <code>Widget</code> trait</a></strong>: How you represent your UI.</li>
<li><strong><a href="./05_lens.html">the <code>Lens</code> trait</a></strong>: How you associate parts of your model with parts of
your UI.</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div><h1 id="get-started-with-druid"><a class="header" href="#get-started-with-druid">Get started with Druid</a></h1>
Expand Down Expand Up @@ -569,12 +569,12 @@ <h2 id="mapping-data-with-lenses"><a class="header" href="#mapping-data-with-len
and custom widgets to create a <em>widget tree</em>; you will start with some single
<em>root widget</em>, which will (generally) have children, which may themselves have
children, and so on. <code>Widget</code> has a generic parameter <code>T</code> that represents
the <a href="./data.html"><code>Data</code></a> handled by that widget. Some widgets (such as layout widgets)
the <a href="./03_data.html"><code>Data</code></a> handled by that widget. Some widgets (such as layout widgets)
may be entirely agnostic about what sort of <code>Data</code> they encounter, while other
widgets (such as a slider) may expect a single type (such as <code>f64</code>).</p>
<blockquote>
<p><strong>Note</strong>: For more information on how different parts of your <a href="./data.html"><code>Data</code></a> are exposed
to different widgets, see <a href="./lens.html"><code>Lens</code></a>.</p>
<p><strong>Note</strong>: For more information on how different parts of your <a href="./03_data.html"><code>Data</code></a> are exposed
to different widgets, see <a href="./05_lens.html"><code>Lens</code></a>.</p>
</blockquote>
<p>At a high level, Druid works like this:</p>
<ul>
Expand Down Expand Up @@ -605,7 +605,7 @@ <h2 id="mapping-data-with-lenses"><a class="header" href="#mapping-data-with-len
predictably during event handling, but only when extra information (such
as if a widget has gained focus) happens as a consequence of other events.</li>
</ul>
<p>For more information on implementing these methods, see <a href="./custom_widgets.html">Creating custom
<p>For more information on implementing these methods, see <a href="./08_widgets_in_depth.html">Creating custom
widgets</a>.</p>
<h2 id="modularity-and-composition"><a class="header" href="#modularity-and-composition">Modularity and composition</a></h2>
<p>Widgets are intended to be modular and composable, not monolithic. For instance,
Expand Down Expand Up @@ -993,10 +993,10 @@ <h2 id="an-even-better-way"><a class="header" href="#an-even-better-way">An even
will eventually need to create and use custom <code>Widget</code>s.</p>
<h2 id="painter-and-controller"><a class="header" href="#painter-and-controller"><code>Painter</code> and <code>Controller</code></a></h2>
<p>There are two helper widgets in Druid that let you customize widget behaviour
without needing to implement the full widget trait: <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Painter.html"><code>Painter</code></a> and
<a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a>.</p>
without needing to implement the full widget trait: <a href="https://docs.rs/druid/latest/druid/widget/struct.Painter.html"><code>Painter</code></a> and
<a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a>.</p>
<h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Painter.html"><code>Painter</code></a> widget lets you draw arbitrary custom content, but cannot
<p>The <a href="https://docs.rs/druid/latest/druid/widget/struct.Painter.html"><code>Painter</code></a> widget lets you draw arbitrary custom content, but cannot
respond to events or otherwise contain update logic. Its general use is to
either provide a custom background to some other widget, or to implement
something like an icon or another graphical element that will be contained in
Expand All @@ -1013,12 +1013,12 @@ <h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
}</code></pre>
<p><code>Painter</code> uses all the space that is available to it; if you want to give it a
set size, you must pass it explicit constraints, such as by wrapping it in a
<a href="https://docs.rs/druid/0.8.3/druid/widget/struct.SizedBox.html"><code>SizedBox</code></a>:</p>
<a href="https://docs.rs/druid/latest/druid/widget/struct.SizedBox.html"><code>SizedBox</code></a>:</p>
<pre><code class="language-rust noplaypen">fn sized_swatch() -&gt; impl Widget&lt;Color&gt; {
SizedBox::new(make_color_swatch()).width(20.0).height(20.0)
}</code></pre>
<p>One other useful thing about <code>Painter</code> is that it can be used as the background
of a <a href="https://docs.rs/druid/0.8.3/druid/widget/struct.Container.html"><code>Container</code></a> widget. If we wanted to have a label that used our swatch
of a <a href="https://docs.rs/druid/latest/druid/widget/struct.Container.html"><code>Container</code></a> widget. If we wanted to have a label that used our swatch
as a background, we could do:</p>
<pre><code class="language-rust noplaypen">fn background_label() -&gt; impl Widget&lt;Color&gt; {
Label::dynamic(|color: &amp;Color, _| {
Expand All @@ -1027,16 +1027,16 @@ <h3 id="painter"><a class="header" href="#painter">Painter</a></h3>
})
.background(make_color_swatch())
}</code></pre>
<p>(This uses the <a href="https://docs.rs/druid/0.8.3/druid/trait.WidgetExt.html#background"><code>background</code></a> method on <a href="https://docs.rs/druid/0.8.3/druid/trait.WidgetExt.html"><code>WidgetExt</code></a> to embed our label in a
<p>(This uses the <a href="https://docs.rs/druid/latest/druid/trait.WidgetExt.html#background"><code>background</code></a> method on <a href="https://docs.rs/druid/latest/druid/trait.WidgetExt.html"><code>WidgetExt</code></a> to embed our label in a
container.)</p>
<h3 id="controller"><a class="header" href="#controller">Controller</a></h3>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a> trait is sort of the inverse of <code>Painter</code>; it is a way to
<p>The <a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a> trait is sort of the inverse of <code>Painter</code>; it is a way to
make widgets that handle events, but don't do any layout or drawing. The idea
here is that you can use some <code>Controller</code> type to customize the behaviour of
some set of children.</p>
<p>The <a href="https://docs.rs/druid/0.8.3/druid/widget/trait.Controller.html"><code>Controller</code></a> trait has <code>event</code>, <code>update</code>, and <code>lifecycle</code> methods, just
like <a href="./widget.html"><code>Widget</code></a>; it does not have <code>paint</code> or <code>layout</code> methods. Also unlike
<a href="./widget.html"><code>Widget</code></a>, all of its methods are optional; you can override only the method
<p>The <a href="https://docs.rs/druid/latest/druid/widget/trait.Controller.html"><code>Controller</code></a> trait has <code>event</code>, <code>update</code>, and <code>lifecycle</code> methods, just
like <a href="./04_widget.html"><code>Widget</code></a>; it does not have <code>paint</code> or <code>layout</code> methods. Also unlike
<a href="./04_widget.html"><code>Widget</code></a>, all of its methods are optional; you can override only the method
that you need.</p>
<p>There's one other difference to the <code>Controller</code> methods; it is explicitly
passed a mutable reference to its child in each method, so that it can modify it
Expand Down

0 comments on commit 0458e3d

Please sign in to comment.