libcosmic/cosmic/iced/advanced/trait.Overlay.html
2026-04-18 20:11:25 +00:00

99 lines
No EOL
18 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="An interactive component that can be displayed on top of other widgets."><title>Overlay in cosmic::iced::advanced - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-aa0817cf.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="cosmic" data-themes="" data-resource-suffix="" data-rustdoc-version="1.90.0-nightly (3048886e5 2025-07-30)" data-channel="nightly" data-search-js="search-fa3e91e5.js" data-settings-js="settings-5514c975.js" ><script src="../../../static.files/storage-68b7e25d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../../static.files/main-eebb9057.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../cosmic/index.html">cosmic</a><span class="version">1.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Overlay</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.draw" title="draw">draw</a></li><li><a href="#tymethod.layout" title="layout">layout</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.index" title="index">index</a></li><li><a href="#method.mouse_interaction" title="mouse_interaction">mouse_interaction</a></li><li><a href="#method.operate" title="operate">operate</a></li><li><a href="#method.overlay" title="overlay">overlay</a></li><li><a href="#method.update" title="update">update</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In cosmic::<wbr>iced::<wbr>advanced</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">cosmic</a>::<wbr><a href="../index.html">iced</a>::<wbr><a href="index.html">advanced</a></div><h1>Trait <span class="trait">Overlay</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Overlay&lt;Message, Theme, Renderer&gt;<div class="where">where
Renderer: <a class="trait" href="trait.Renderer.html" title="trait cosmic::iced::advanced::Renderer">Renderer</a>,</div>{
// Required methods
fn <a href="#tymethod.layout" class="fn">layout</a>(&amp;mut self, renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>, bounds: <a class="struct" href="../struct.Size.html" title="struct cosmic::iced::Size">Size</a>) -&gt; <a class="struct" href="../daemon/program/graphics/core/layout/struct.Node.html" title="struct cosmic::iced::daemon::program::graphics::core::layout::Node">Node</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.draw" class="fn">draw</a>(
&amp;self,
renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut Renderer</a>,
theme: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Theme</a>,
style: &amp;<a class="struct" href="../daemon/program/graphics/core/renderer/struct.Style.html" title="struct cosmic::iced::daemon::program::graphics::core::renderer::Style">Style</a>,
layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
);
// Provided methods
fn <a href="#method.operate" class="fn">operate</a>(
&amp;mut self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
_operation: &amp;mut dyn <a class="trait" href="../../widget/trait.Operation.html" title="trait cosmic::widget::Operation">Operation</a>,
) { ... }
<span class="item-spacer"></span> fn <a href="#method.update" class="fn">update</a>(
&amp;mut self,
_event: &amp;<a class="enum" href="../enum.Event.html" title="enum cosmic::iced::Event">Event</a>,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
_clipboard: &amp;mut dyn <a class="trait" href="trait.Clipboard.html" title="trait cosmic::iced::advanced::Clipboard">Clipboard</a>,
_shell: &amp;mut <a class="struct" href="struct.Shell.html" title="struct cosmic::iced::advanced::Shell">Shell</a>&lt;'_, Message&gt;,
) { ... }
<span class="item-spacer"></span> fn <a href="#method.mouse_interaction" class="fn">mouse_interaction</a>(
&amp;self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
) -&gt; <a class="enum" href="../mouse/enum.Interaction.html" title="enum cosmic::iced::mouse::Interaction">Interaction</a> { ... }
<span class="item-spacer"></span> fn <a href="#method.overlay" class="fn">overlay</a>&lt;'a&gt;(
&amp;'a mut self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'a&gt;,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../daemon/program/graphics/core/overlay/struct.Element.html" title="struct cosmic::iced::daemon::program::graphics::core::overlay::Element">Element</a>&lt;'a, Message, Theme, Renderer&gt;&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.index" class="fn">index</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An interactive component that can be displayed on top of other widgets.</p>
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.layout" class="method"><h4 class="code-header">fn <a href="#tymethod.layout" class="fn">layout</a>(&amp;mut self, renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>, bounds: <a class="struct" href="../struct.Size.html" title="struct cosmic::iced::Size">Size</a>) -&gt; <a class="struct" href="../daemon/program/graphics/core/layout/struct.Node.html" title="struct cosmic::iced::daemon::program::graphics::core::layout::Node">Node</a></h4></section></summary><div class="docblock"><p>Returns the layout <a href="../daemon/program/graphics/core/layout/struct.Node.html" title="struct cosmic::iced::daemon::program::graphics::core::layout::Node"><code>Node</code></a> of the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a>.</p>
<p>This <a href="../daemon/program/graphics/core/layout/struct.Node.html" title="struct cosmic::iced::daemon::program::graphics::core::layout::Node"><code>Node</code></a> is used by the runtime to compute the <a href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout"><code>Layout</code></a> of the
user interface.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.draw" class="method"><h4 class="code-header">fn <a href="#tymethod.draw" class="fn">draw</a>(
&amp;self,
renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut Renderer</a>,
theme: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Theme</a>,
style: &amp;<a class="struct" href="../daemon/program/graphics/core/renderer/struct.Style.html" title="struct cosmic::iced::daemon::program::graphics::core::renderer::Style">Style</a>,
layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
)</h4></section></summary><div class="docblock"><p>Draws the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a> using the associated <code>Renderer</code>.</p>
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.operate" class="method"><h4 class="code-header">fn <a href="#method.operate" class="fn">operate</a>(
&amp;mut self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
_operation: &amp;mut dyn <a class="trait" href="../../widget/trait.Operation.html" title="trait cosmic::widget::Operation">Operation</a>,
)</h4></section></summary><div class="docblock"><p>Applies an <a href="../../widget/trait.Operation.html" title="trait cosmic::widget::Operation"><code>crate::widget::Operation</code></a> to the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.update" class="method"><h4 class="code-header">fn <a href="#method.update" class="fn">update</a>(
&amp;mut self,
_event: &amp;<a class="enum" href="../enum.Event.html" title="enum cosmic::iced::Event">Event</a>,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
_clipboard: &amp;mut dyn <a class="trait" href="trait.Clipboard.html" title="trait cosmic::iced::advanced::Clipboard">Clipboard</a>,
_shell: &amp;mut <a class="struct" href="struct.Shell.html" title="struct cosmic::iced::advanced::Shell">Shell</a>&lt;'_, Message&gt;,
)</h4></section></summary><div class="docblock"><p>Processes a runtime <a href="../enum.Event.html" title="enum cosmic::iced::Event"><code>Event</code></a>.</p>
<p>It receives:</p>
<ul>
<li>an <a href="../enum.Event.html" title="enum cosmic::iced::Event"><code>Event</code></a> describing user interaction</li>
<li>the computed <a href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout"><code>Layout</code></a> of the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a></li>
<li>the current cursor position</li>
<li>a mutable <code>Message</code> list, allowing the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a> to produce
new messages based on user interaction.</li>
<li>the <code>Renderer</code></li>
<li>a <a href="trait.Clipboard.html" title="trait cosmic::iced::advanced::Clipboard"><code>Clipboard</code></a>, if available</li>
</ul>
<p>By default, it does nothing.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.mouse_interaction" class="method"><h4 class="code-header">fn <a href="#method.mouse_interaction" class="fn">mouse_interaction</a>(
&amp;self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'_&gt;,
_cursor: <a class="enum" href="../mouse/enum.Cursor.html" title="enum cosmic::iced::mouse::Cursor">Cursor</a>,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
) -&gt; <a class="enum" href="../mouse/enum.Interaction.html" title="enum cosmic::iced::mouse::Interaction">Interaction</a></h4></section></summary><div class="docblock"><p>Returns the current <a href="../mouse/enum.Interaction.html" title="enum cosmic::iced::mouse::Interaction"><code>mouse::Interaction</code></a> of the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a>.</p>
<p>By default, it returns <a href="../mouse/enum.Interaction.html#variant.None" title="variant cosmic::iced::mouse::Interaction::None"><code>mouse::Interaction::None</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.overlay" class="method"><h4 class="code-header">fn <a href="#method.overlay" class="fn">overlay</a>&lt;'a&gt;(
&amp;'a mut self,
_layout: <a class="struct" href="struct.Layout.html" title="struct cosmic::iced::advanced::Layout">Layout</a>&lt;'a&gt;,
_renderer: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;Renderer</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../daemon/program/graphics/core/overlay/struct.Element.html" title="struct cosmic::iced::daemon::program::graphics::core::overlay::Element">Element</a>&lt;'a, Message, Theme, Renderer&gt;&gt;</h4></section></summary><div class="docblock"><p>Returns the nested overlay of the <a href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay"><code>Overlay</code></a>, if there is any.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.index" class="method"><h4 class="code-header">fn <a href="#method.index" class="fn">index</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.f32.html">f32</a></h4></section></summary><div class="docblock"><p>The index of the overlay.</p>
<p>Overlays with a higher index will be rendered on top of overlays with
a lower index.</p>
<p>By default, it returns <code>1.0</code>.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Overlay%3CMessage,+Theme,+Renderer%3E-for-Overlay%3C'_,+'_,+Message,+Renderer%3E" class="impl"><a class="src rightside" href="../../../src/cosmic/widget/popover.rs.html#340-477">Source</a><a href="#impl-Overlay%3CMessage,+Theme,+Renderer%3E-for-Overlay%3C'_,+'_,+Message,+Renderer%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Message, Renderer&gt; <a class="trait" href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay">Overlay</a>&lt;Message, <a class="struct" href="../../struct.Theme.html" title="struct cosmic::Theme">Theme</a>, Renderer&gt; for <a class="struct" href="../../widget/popover/struct.Overlay.html" title="struct cosmic::widget::popover::Overlay">Overlay</a>&lt;'_, '_, Message, Renderer&gt;<div class="where">where
Message: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
Renderer: <a class="trait" href="trait.Renderer.html" title="trait cosmic::iced::advanced::Renderer">Renderer</a>,</div></h3></section><section id="impl-Overlay%3CMessage,+Theme,+Renderer%3E-for-Group%3C'_,+Message,+Theme,+Renderer%3E" class="impl"><a href="#impl-Overlay%3CMessage,+Theme,+Renderer%3E-for-Group%3C'_,+Message,+Theme,+Renderer%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Message, Theme, Renderer&gt; <a class="trait" href="trait.Overlay.html" title="trait cosmic::iced::advanced::Overlay">Overlay</a>&lt;Message, Theme, Renderer&gt; for <a class="struct" href="../daemon/program/graphics/core/overlay/struct.Group.html" title="struct cosmic::iced::daemon::program::graphics::core::overlay::Group">Group</a>&lt;'_, Message, Theme, Renderer&gt;<div class="where">where
Renderer: <a class="trait" href="trait.Renderer.html" title="trait cosmic::iced::advanced::Renderer">Renderer</a>,</div></h3></section></div><script src="../../../trait.impl/iced_core/overlay/trait.Overlay.js" data-ignore-extern-crates="iced_core" async></script></section></div></main></body></html>