pub struct PlacesPanel<'a> { /* private fields */ }Expand description
A side panel of places: sections, each a heading over its items, as the
in-app picker lists them (an import window’s sources column). One stop
for Tab; Up and Down go from item to item across the sections (through
an item’s toggle, a fold’s band and the application’s content, in the
order drawn), Enter or Space chooses. Each item is a button named by its
name and badge, described by its line, selected or not; each title a
heading, or a fold’s band when the section folds. What a chosen item
does is the caller’s: PlacesOutput::chosen.
Opt-in parts (see the module): folding sections, an empty section’s
line, an item’s visible line, toned badge and toggle, the
application’s content under an item or a section, nested items
(PlaceItem::children), dimmed items (PlaceItem::dimmed), a hook
on each row (PlacesPanel::on_row) and a selection in several
sections (PlacesPanel::selected_set). A panel using none of them
looks as it always did.
use egui_pop_api::files::places::{PlaceItem, PlaceSection, PlacesPanel};
fn sources(ui: &mut egui::Ui, at: &mut Option<String>) {
let sections = [PlaceSection::new("cards", "Cards")
.item(PlaceItem::folder("EOS_DIGITAL", "/media/EOS_DIGITAL").badge("214"))];
let out = PlacesPanel::new("import.sources", §ions)
.selected(at.as_deref())
.show(ui);
if let Some((_, item)) = out.chosen {
*at = Some(item.id);
}
}Need (dialog): a side panel of places, with sections of an application’s.
Implementations§
Source§impl<'a> PlacesPanel<'a>
impl<'a> PlacesPanel<'a>
Sourcepub fn new(name: impl Into<String>, sections: &'a [PlaceSection]) -> Self
pub fn new(name: impl Into<String>, sections: &'a [PlaceSection]) -> Self
A panel named name (its roving group’s, unique in the window) of
these sections.
Sourcepub fn indent_guides(self, mode: IndentGuides) -> Self
pub fn indent_guides(self, mode: IndentGuides) -> Self
When a tree section (PlaceItem::children) draws its indent
guides, a thin line down each nesting level in the kit’s
list-guide (list-guide.rest.border-color, border-width):
never (the default), while the pointer is over the panel, or
always, as VS Code’s renderIndentGuides.
Need (data): a tree of places whose levels are easy to follow (folders nested deep).
Sourcepub fn indent_guide_highlight(self, on: bool) -> Self
pub fn indent_guide_highlight(self, on: bool) -> Self
Whether the guide of the hovered row’s parent (the run of its
siblings) is highlighted, in list-guide’s hover state
(list-guide.hover.border-color); no by default.
Sourcepub fn selected(self, id: Option<&'a str>) -> Self
pub fn selected(self, id: Option<&'a str>) -> Self
The item shown selected, by id: where the caller is.
Sourcepub fn selected_set(self, ids: &'a [&'a str]) -> Self
pub fn selected_set(self, ids: &'a [&'a str]) -> Self
The items shown selected, by id, beside PlacesPanel::selected:
one in each section where the application’s scopes add up (a
folder, an album and a keyword chosen together).
Need (data): a side panel of places with one selection in each section (scopes chosen together).
Sourcepub fn on_row(
self,
hook: impl FnMut(&mut Ui, &PlaceSection, &PlaceItem, &Response) + 'a,
) -> Self
pub fn on_row( self, hook: impl FnMut(&mut Ui, &PlaceSection, &PlaceItem, &Response) + 'a, ) -> Self
A hook called with each item’s row and its response, after the
panel’s own handling: the application attaches what the panel
knows nothing of (a drop target or a drag source through the drag
session, bus::drag; its own context menu; a tip). Called for
nested items too.
Need (dialog): a side panel of places whose rows are drop targets or drag sources.
A context menu on each item, drawn by menu (rename, eject, forget).
Sourcepub fn under_item(
self,
add: impl FnMut(&mut Ui, &PlaceSection, &PlaceItem) + 'a,
) -> Self
pub fn under_item( self, add: impl FnMut(&mut Ui, &PlaceSection, &PlaceItem) + 'a, ) -> Self
The application’s content under each item, drawn by add in the
room below it (an account’s albums under the account): add draws
nothing for an item without any. Its widgets join the panel’s
keyboard order after the item.
Sourcepub fn under_section(self, add: impl FnMut(&mut Ui, &PlaceSection) + 'a) -> Self
pub fn under_section(self, add: impl FnMut(&mut Ui, &PlaceSection) + 'a) -> Self
The application’s content under each section’s items, drawn by
add (a history’s past imports, each with “Import again”), inside
the section’s fold when it folds. Its widgets join the panel’s
keyboard order after the section’s items.
pub fn show(self, ui: &mut Ui) -> PlacesOutput
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PlacesPanel<'a>
impl<'a> !RefUnwindSafe for PlacesPanel<'a>
impl<'a> !Send for PlacesPanel<'a>
impl<'a> !Sync for PlacesPanel<'a>
impl<'a> Unpin for PlacesPanel<'a>
impl<'a> UnsafeUnpin for PlacesPanel<'a>
impl<'a> !UnwindSafe for PlacesPanel<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more