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§
Sourcetype DragEdgeClass<'a, I: Ids>
type DragEdgeClass<'a, I: Ids>
The class of the edge being dragged.
Sourcetype AnchorClass<'a>
type AnchorClass<'a>
The class of an Anchor.
Sourcetype GraphClass<'a>
type GraphClass<'a>
The class of the canvas.
Sourcetype SelectionBoxClass<'a>
type SelectionBoxClass<'a>
The class of the selection box.
Sourcetype CuttingToolClass<'a>
type CuttingToolClass<'a>
The class of the edge-cutting trail.
Sourcetype ParticleClass<'a>
type ParticleClass<'a>
The class of a particle travelling along an edge.
Sourcetype MinimapClass<'a>
type MinimapClass<'a>
The class of the minimap overlay.
Required Methods§
Sourcefn default_node<'a>() -> Self::NodeClass<'a>
fn default_node<'a>() -> Self::NodeClass<'a>
The class a node gets without Node::class.
Sourcefn node(&self, class: &Self::NodeClass<'_>, status: NodeStatus) -> NodeStyle
fn node(&self, class: &Self::NodeClass<'_>, status: NodeStatus) -> NodeStyle
Resolves a node’s style.
Sourcefn default_pin<'a, I: Ids>() -> Self::PinClass<'a, I>
fn default_pin<'a, I: Ids>() -> Self::PinClass<'a, I>
The class a node’s pins get without
Node::pin_class.
Sourcefn pin<I: Ids>(
&self,
class: &Self::PinClass<'_, I>,
pin: &PinInfo<'_, I>,
other: Option<&PinInfo<'_, I>>,
status: PinStatus,
) -> PinStyle
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.
Sourcefn default_edge<'a, I: Ids>() -> Self::EdgeClass<'a, I>
fn default_edge<'a, I: Ids>() -> Self::EdgeClass<'a, I>
The class an edge gets without Edge::class.
Sourcefn edge<I: Ids>(
&self,
class: &Self::EdgeClass<'_, I>,
status: EdgeStatus,
from: PinInfo<'_, I>,
to: PinInfo<'_, I>,
) -> EdgeStyle
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).
Sourcefn default_drag_edge<'a, I: Ids>() -> Self::DragEdgeClass<'a, I>
fn default_drag_edge<'a, I: Ids>() -> Self::DragEdgeClass<'a, I>
The class the dragged edge gets without
NodeGraph::dragging_edge_class.
Sourcefn drag_edge<I: Ids>(
&self,
class: &Self::DragEdgeClass<'_, I>,
source: PinInfo<'_, I>,
) -> EdgeStyle
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.
Sourcefn default_anchor<'a>() -> Self::AnchorClass<'a>
fn default_anchor<'a>() -> Self::AnchorClass<'a>
The class an anchor gets without Anchor::class.
Sourcefn anchor(
&self,
class: &Self::AnchorClass<'_>,
status: AnchorStatus,
) -> AnchorStyle
fn anchor( &self, class: &Self::AnchorClass<'_>, status: AnchorStatus, ) -> AnchorStyle
Resolves an anchor’s style.
Sourcefn default_graph<'a>() -> Self::GraphClass<'a>
fn default_graph<'a>() -> Self::GraphClass<'a>
The class the canvas gets without
NodeGraph::graph_class.
Sourcefn graph(&self, class: &Self::GraphClass<'_>) -> GraphStyle
fn graph(&self, class: &Self::GraphClass<'_>) -> GraphStyle
Resolves the canvas style.
Sourcefn default_selection_box<'a>() -> Self::SelectionBoxClass<'a>
fn default_selection_box<'a>() -> Self::SelectionBoxClass<'a>
The class the selection box gets without
NodeGraph::selection_box_class.
Sourcefn selection_box(
&self,
class: &Self::SelectionBoxClass<'_>,
) -> SelectionBoxStyle
fn selection_box( &self, class: &Self::SelectionBoxClass<'_>, ) -> SelectionBoxStyle
Resolves the selection box style.
Sourcefn default_cutting_tool<'a>() -> Self::CuttingToolClass<'a>
fn default_cutting_tool<'a>() -> Self::CuttingToolClass<'a>
The class the cutting trail gets without
NodeGraph::cutting_tool_class.
Sourcefn cutting_tool(&self, class: &Self::CuttingToolClass<'_>) -> CuttingToolStyle
fn cutting_tool(&self, class: &Self::CuttingToolClass<'_>) -> CuttingToolStyle
Resolves the cutting trail style.
Sourcefn default_particle<'a>() -> Self::ParticleClass<'a>
fn default_particle<'a>() -> Self::ParticleClass<'a>
The class a particle gets without Particle::class.
Sourcefn particle(&self, class: &Self::ParticleClass<'_>) -> ParticleStyle
fn particle(&self, class: &Self::ParticleClass<'_>) -> ParticleStyle
Resolves a particle’s style.
Sourcefn default_minimap<'a>() -> Self::MinimapClass<'a>
fn default_minimap<'a>() -> Self::MinimapClass<'a>
The class the minimap gets without
NodeGraph::minimap_class.
Sourcefn minimap(&self, class: &Self::MinimapClass<'_>) -> MinimapStyle
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".