47 lines
No EOL
12 KiB
HTML
47 lines
No EOL
12 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="Pane grids let your users split regions of your application and organize layout dynamically."><title>cosmic::widget::pane_grid - 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 mod"><!--[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="#">Module pane_<wbr>grid</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#example" title="Example">Example</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#traits" title="Traits">Traits</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In cosmic::<wbr>widget</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">widget</a></div><h1>Module <span>pane_grid</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><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Pane grids let your users split regions of your application and organize layout dynamically.</p>
|
|
<p><img src="https://iced.rs/examples/pane_grid.gif" alt="Pane grid - Iced" /></p>
|
|
<p>This distribution of space is common in tiling window managers (like
|
|
<a href="https://awesomewm.org/"><code>awesome</code></a>, <a href="https://i3wm.org/"><code>i3</code></a>, or even
|
|
<a href="https://github.com/tmux/tmux"><code>tmux</code></a>).</p>
|
|
<p>A <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a> supports:</p>
|
|
<ul>
|
|
<li>Vertical and horizontal splits</li>
|
|
<li>Tracking of the last active pane</li>
|
|
<li>Mouse-based resizing</li>
|
|
<li>Drag and drop to reorganize panes</li>
|
|
<li>Hotkey support</li>
|
|
<li>Configurable modifier keys</li>
|
|
<li><a href="struct.State.html" title="struct cosmic::widget::pane_grid::State"><code>State</code></a> API to perform actions programmatically (<code>split</code>, <code>swap</code>, <code>resize</code>, etc.)</li>
|
|
</ul>
|
|
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
|
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>iced::widget::{pane_grid, text};
|
|
|
|
<span class="kw">struct </span>State {
|
|
panes: pane_grid::State<Pane>,
|
|
}
|
|
|
|
<span class="kw">enum </span>Pane {
|
|
SomePane,
|
|
AnotherKindOfPane,
|
|
}
|
|
|
|
<span class="kw">enum </span>Message {
|
|
PaneDragged(pane_grid::DragEvent),
|
|
PaneResized(pane_grid::ResizeEvent),
|
|
}
|
|
|
|
<span class="kw">fn </span>view(state: <span class="kw-2">&</span>State) -> Element<<span class="lifetime">'_</span>, Message> {
|
|
pane_grid(<span class="kw-2">&</span>state.panes, |pane, state, is_maximized| {
|
|
pane_grid::Content::new(<span class="kw">match </span>state {
|
|
Pane::SomePane => text(<span class="string">"This is some pane"</span>),
|
|
Pane::AnotherKindOfPane => text(<span class="string">"This is another kind of pane"</span>),
|
|
})
|
|
})
|
|
.on_drag(Message::PaneDragged)
|
|
.on_resize(<span class="number">10</span>, Message::PaneResized)
|
|
.into()
|
|
}</code></pre></div>
|
|
<p>The <a href="https://github.com/iced-rs/iced/tree/0.14/examples/pane_grid"><code>pane_grid</code> example</a> showcases how to use a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a> with resizing,
|
|
drag and drop, and hotkey support.</p>
|
|
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="state/index.html" title="mod cosmic::widget::pane_grid::state">state</a></dt><dd>The state of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Content.html" title="struct cosmic::widget::pane_grid::Content">Content</a></dt><dd>The content of a <a href="struct.Pane.html" title="struct cosmic::widget::pane_grid::Pane"><code>Pane</code></a>.</dd><dt><a class="struct" href="struct.Controls.html" title="struct cosmic::widget::pane_grid::Controls">Controls</a></dt><dd>The controls of a <a href="struct.Pane.html" title="struct cosmic::widget::pane_grid::Pane"><code>Pane</code></a>.</dd><dt><a class="struct" href="struct.Highlight.html" title="struct cosmic::widget::pane_grid::Highlight">Highlight</a></dt><dd>The appearance of a highlight of the <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="struct" href="struct.Line.html" title="struct cosmic::widget::pane_grid::Line">Line</a></dt><dd>A line.</dd><dt><a class="struct" href="struct.Pane.html" title="struct cosmic::widget::pane_grid::Pane">Pane</a></dt><dd>A rectangular region in a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a> used to display widgets.</dd><dt><a class="struct" href="struct.PaneGrid.html" title="struct cosmic::widget::pane_grid::PaneGrid">Pane<wbr>Grid</a></dt><dd>A collection of panes distributed using either vertical or horizontal splits
|
|
to completely fill the space available.</dd><dt><a class="struct" href="struct.ResizeEvent.html" title="struct cosmic::widget::pane_grid::ResizeEvent">Resize<wbr>Event</a></dt><dd>An event produced during a resize interaction of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="struct" href="struct.Split.html" title="struct cosmic::widget::pane_grid::Split">Split</a></dt><dd>A divider that splits a region in a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a> into two different panes.</dd><dt><a class="struct" href="struct.State.html" title="struct cosmic::widget::pane_grid::State">State</a></dt><dd>The state of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="struct" href="struct.Style.html" title="struct cosmic::widget::pane_grid::Style">Style</a></dt><dd>The appearance of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="struct" href="struct.TitleBar.html" title="struct cosmic::widget::pane_grid::TitleBar">Title<wbr>Bar</a></dt><dd>The title bar of a <a href="struct.Pane.html" title="struct cosmic::widget::pane_grid::Pane"><code>Pane</code></a>.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Axis.html" title="enum cosmic::widget::pane_grid::Axis">Axis</a></dt><dd>A fixed reference line for the measurement of coordinates.</dd><dt><a class="enum" href="enum.Configuration.html" title="enum cosmic::widget::pane_grid::Configuration">Configuration</a></dt><dd>The arrangement of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="enum" href="enum.Direction.html" title="enum cosmic::widget::pane_grid::Direction">Direction</a></dt><dd>A four cardinal direction.</dd><dt><a class="enum" href="enum.DragEvent.html" title="enum cosmic::widget::pane_grid::DragEvent">Drag<wbr>Event</a></dt><dd>An event produced during a drag and drop interaction of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="enum" href="enum.Edge.html" title="enum cosmic::widget::pane_grid::Edge">Edge</a></dt><dd>The edges of an area.</dd><dt><a class="enum" href="enum.Node.html" title="enum cosmic::widget::pane_grid::Node">Node</a></dt><dd>A layout node of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="enum" href="enum.Region.html" title="enum cosmic::widget::pane_grid::Region">Region</a></dt><dd>The region of a <a href="struct.Pane.html" title="struct cosmic::widget::pane_grid::Pane"><code>Pane</code></a>.</dd><dt><a class="enum" href="enum.Target.html" title="enum cosmic::widget::pane_grid::Target">Target</a></dt><dd>The <a href="enum.Target.html" title="enum cosmic::widget::pane_grid::Target"><code>Target</code></a> area a pane can be dropped on.</dd></dl><h2 id="traits" class="section-header">Traits<a href="#traits" class="anchor">§</a></h2><dl class="item-table"><dt><a class="trait" href="trait.Catalog.html" title="trait cosmic::widget::pane_grid::Catalog">Catalog</a></dt><dd>The theme catalog of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd><dt><a class="trait" href="trait.Draggable.html" title="trait cosmic::widget::pane_grid::Draggable">Draggable</a></dt><dd>A pane that can be dragged.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.default.html" title="fn cosmic::widget::pane_grid::default">default</a></dt><dd>The default style of a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.StyleFn.html" title="type cosmic::widget::pane_grid::StyleFn">StyleFn</a></dt><dd>A styling function for a <a href="../struct.PaneGrid.html" title="struct cosmic::widget::PaneGrid"><code>PaneGrid</code></a>.</dd></dl></section></div></main></body></html> |