Skip to main content

Catalog

Trait Catalog 

Source
pub trait Catalog {
    type NodeClass<'a>;
    type PinClass<'a, I: Ids>;
    type EdgeClass<'a, I: Ids>;
    type DragEdgeClass<'a, I: Ids>;
    type AnchorClass<'a>;
    type GraphClass<'a>;
    type SelectionBoxClass<'a>;
    type CuttingToolClass<'a>;
    type ParticleClass<'a>;
    type MinimapClass<'a>;

Show 20 methods // Required methods fn default_node<'a>() -> Self::NodeClass<'a>; fn node(&self, class: &Self::NodeClass<'_>, status: NodeStatus) -> NodeStyle; fn default_pin<'a, I: Ids>() -> Self::PinClass<'a, I>; fn pin<I: Ids>( &self, class: &Self::PinClass<'_, I>, pin: &PinInfo<'_, I>, other: Option<&PinInfo<'_, I>>, status: PinStatus, ) -> PinStyle; fn default_edge<'a, I: Ids>() -> Self::EdgeClass<'a, I>; fn edge<I: Ids>( &self, class: &Self::EdgeClass<'_, I>, status: EdgeStatus, from: PinInfo<'_, I>, to: PinInfo<'_, I>, ) -> EdgeStyle; fn default_drag_edge<'a, I: Ids>() -> Self::DragEdgeClass<'a, I>; fn drag_edge<I: Ids>( &self, class: &Self::DragEdgeClass<'_, I>, source: PinInfo<'_, I>, ) -> EdgeStyle; fn default_anchor<'a>() -> Self::AnchorClass<'a>; fn anchor( &self, class: &Self::AnchorClass<'_>, status: AnchorStatus, ) -> AnchorStyle; fn default_graph<'a>() -> Self::GraphClass<'a>; fn graph(&self, class: &Self::GraphClass<'_>) -> GraphStyle; fn default_selection_box<'a>() -> Self::SelectionBoxClass<'a>; fn selection_box( &self, class: &Self::SelectionBoxClass<'_>, ) -> SelectionBoxStyle; fn default_cutting_tool<'a>() -> Self::CuttingToolClass<'a>; fn cutting_tool( &self, class: &Self::CuttingToolClass<'_>, ) -> CuttingToolStyle; fn default_particle<'a>() -> Self::ParticleClass<'a>; fn particle(&self, class: &Self::ParticleClass<'_>) -> ParticleStyle; fn default_minimap<'a>() -> Self::MinimapClass<'a>; fn minimap(&self, class: &Self::MinimapClass<'_>) -> MinimapStyle;
}
Expand description

The theme’s styling of everything a NodeGraph draws.

One trait rather than one per element because the graph is one widget: a theme that can host it must answer for nodes, pins, edges, anchors and the graph’s own chrome together. The shape per element is iced’s (iced_widget::button::Catalog): a class type the widget stores, a default class, and a resolver from class (plus status) to the concrete style.

The .style(..) builders (Node::style, Edge::style, NodeGraph::graph_style, …) need the matching class to implement From<*StyleFn<'_, Theme, ..>>; the .class(..) builders take any class directly.

Required Associated Types§

Source

type NodeClass<'a>

The class of a Node.

Source

type PinClass<'a, I: Ids>

The class of a node’s pins.

Source

type EdgeClass<'a, I: Ids>

The class of an Edge.

Source

type DragEdgeClass<'a, I: Ids>

The class of the edge being dragged.

Source

type AnchorClass<'a>

The class of an Anchor.

Source

type GraphClass<'a>

The class of the canvas.

Source

type SelectionBoxClass<'a>

The class of the selection box.

Source

type CuttingToolClass<'a>

The class of the edge-cutting trail.

Source

type ParticleClass<'a>

The class of a particle travelling along an edge.

Source

type MinimapClass<'a>

The class of the minimap overlay.

Required Methods§

Source

fn default_node<'a>() -> Self::NodeClass<'a>

The class a node gets without Node::class.

Source

fn node(&self, class: &Self::NodeClass<'_>, status: NodeStatus) -> NodeStyle

Resolves a node’s style.

Source

fn default_pin<'a, I: Ids>() -> Self::PinClass<'a, I>

The class a node’s pins get without Node::pin_class.

Source

fn pin<I: Ids>( &self, class: &Self::PinClass<'_, I>, pin: &PinInfo<'_, I>, other: Option<&PinInfo<'_, I>>, status: PinStatus, ) -> PinStyle

Resolves a pin’s style. pin is the pin being drawn; other is the drag source while an edge drag is in flight, else None.

Source

fn default_edge<'a, I: Ids>() -> Self::EdgeClass<'a, I>

The class an edge gets without Edge::class.

Source

fn edge<I: Ids>( &self, class: &Self::EdgeClass<'_, I>, status: EdgeStatus, from: PinInfo<'_, I>, to: PinInfo<'_, I>, ) -> EdgeStyle

Resolves an edge’s style. from and to are the endpoints in draw order (output side first).

Source

fn default_drag_edge<'a, I: Ids>() -> Self::DragEdgeClass<'a, I>

The class the dragged edge gets without NodeGraph::dragging_edge_class.

Source

fn drag_edge<I: Ids>( &self, class: &Self::DragEdgeClass<'_, I>, source: PinInfo<'_, I>, ) -> EdgeStyle

Resolves the dragged edge’s style from the pin the drag started on.

Source

fn default_anchor<'a>() -> Self::AnchorClass<'a>

The class an anchor gets without Anchor::class.

Source

fn anchor( &self, class: &Self::AnchorClass<'_>, status: AnchorStatus, ) -> AnchorStyle

Resolves an anchor’s style.

Source

fn default_graph<'a>() -> Self::GraphClass<'a>

The class the canvas gets without NodeGraph::graph_class.

Source

fn graph(&self, class: &Self::GraphClass<'_>) -> GraphStyle

Resolves the canvas style.

Source

fn default_selection_box<'a>() -> Self::SelectionBoxClass<'a>

The class the selection box gets without NodeGraph::selection_box_class.

Source

fn selection_box( &self, class: &Self::SelectionBoxClass<'_>, ) -> SelectionBoxStyle

Resolves the selection box style.

Source

fn default_cutting_tool<'a>() -> Self::CuttingToolClass<'a>

The class the cutting trail gets without NodeGraph::cutting_tool_class.

Source

fn cutting_tool(&self, class: &Self::CuttingToolClass<'_>) -> CuttingToolStyle

Resolves the cutting trail style.

Source

fn default_particle<'a>() -> Self::ParticleClass<'a>

The class a particle gets without Particle::class.

Source

fn particle(&self, class: &Self::ParticleClass<'_>) -> ParticleStyle

Resolves a particle’s style.

Source

fn default_minimap<'a>() -> Self::MinimapClass<'a>

The class the minimap gets without NodeGraph::minimap_class.

Source

fn minimap(&self, class: &Self::MinimapClass<'_>) -> MinimapStyle

Resolves the minimap style.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Catalog for Theme

Source§

type NodeClass<'a> = Box<dyn Fn(&Theme, NodeStatus) -> NodeStyle + 'a>

Source§

type PinClass<'a, I: Ids> = Box<dyn Fn(&Theme, &PinInfo<'_, I>, Option<&PinInfo<'_, I>>, PinStatus) -> PinStyle + 'a>

Source§

type EdgeClass<'a, I: Ids> = Box<dyn Fn(&Theme, EdgeStatus, PinInfo<'_, I>, PinInfo<'_, I>) -> EdgeStyle + 'a>

Source§

type DragEdgeClass<'a, I: Ids> = Box<dyn Fn(&Theme, PinInfo<'_, I>) -> EdgeStyle + 'a>

Source§

type AnchorClass<'a> = Box<dyn Fn(&Theme, AnchorStatus) -> AnchorStyle + 'a>

Source§

type GraphClass<'a> = Box<dyn Fn(&Theme) -> GraphStyle + 'a>

Source§

type SelectionBoxClass<'a> = Box<dyn Fn(&Theme) -> SelectionBoxStyle + 'a>

Source§

type CuttingToolClass<'a> = Box<dyn Fn(&Theme) -> CuttingToolStyle + 'a>

Source§

type ParticleClass<'a> = Box<dyn Fn(&Theme) -> ParticleStyle + 'a>

Source§

type MinimapClass<'a> = Box<dyn Fn(&Theme) -> MinimapStyle + 'a>

Source§

fn default_node<'a>() -> Self::NodeClass<'a>

Source§

fn node(&self, class: &Self::NodeClass<'_>, status: NodeStatus) -> NodeStyle

Source§

fn default_pin<'a, I: Ids>() -> Self::PinClass<'a, I>

Source§

fn pin<I: Ids>( &self, class: &Self::PinClass<'_, I>, pin: &PinInfo<'_, I>, other: Option<&PinInfo<'_, I>>, status: PinStatus, ) -> PinStyle

Source§

fn default_edge<'a, I: Ids>() -> Self::EdgeClass<'a, I>

Source§

fn edge<I: Ids>( &self, class: &Self::EdgeClass<'_, I>, status: EdgeStatus, from: PinInfo<'_, I>, to: PinInfo<'_, I>, ) -> EdgeStyle

Source§

fn default_drag_edge<'a, I: Ids>() -> Self::DragEdgeClass<'a, I>

Source§

fn drag_edge<I: Ids>( &self, class: &Self::DragEdgeClass<'_, I>, source: PinInfo<'_, I>, ) -> EdgeStyle

Source§

fn default_anchor<'a>() -> Self::AnchorClass<'a>

Source§

fn anchor( &self, class: &Self::AnchorClass<'_>, status: AnchorStatus, ) -> AnchorStyle

Source§

fn default_graph<'a>() -> Self::GraphClass<'a>

Source§

fn graph(&self, class: &Self::GraphClass<'_>) -> GraphStyle

Source§

fn default_selection_box<'a>() -> Self::SelectionBoxClass<'a>

Source§

fn selection_box( &self, class: &Self::SelectionBoxClass<'_>, ) -> SelectionBoxStyle

Source§

fn default_cutting_tool<'a>() -> Self::CuttingToolClass<'a>

Source§

fn cutting_tool(&self, class: &Self::CuttingToolClass<'_>) -> CuttingToolStyle

Source§

fn default_particle<'a>() -> Self::ParticleClass<'a>

Source§

fn particle(&self, class: &Self::ParticleClass<'_>) -> ParticleStyle

Source§

fn default_minimap<'a>() -> Self::MinimapClass<'a>

Source§

fn minimap(&self, class: &Self::MinimapClass<'_>) -> MinimapStyle

Implementors§