TreeizeViewer

Trait TreeizeViewer 

Source
pub trait TreeizeViewer<T> {
Show 30 methods // Required methods fn title(&mut self, node: &T) -> String; fn has_input(&mut self, node: &T) -> bool; fn has_output(&mut self, node: &T) -> bool; fn show_input( &mut self, pin: &InPin, ui: &mut Ui, treeize: &mut Treeize<T>, ) -> impl TreeizePin + 'static; fn show_output( &mut self, pin: &OutPin, ui: &mut Ui, treeize: &mut Treeize<T>, ) -> impl TreeizePin + 'static; // Provided methods fn node_frame( &mut self, default: Frame, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> Frame { ... } fn header_frame( &mut self, default: Frame, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> Frame { ... } fn has_node_style( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> bool { ... } fn apply_node_style( &mut self, style: &mut Style, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) { ... } fn node_layout( &mut self, default: NodeLayout, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> NodeLayout { ... } fn show_header( &mut self, node: NodeId, ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn has_body(&mut self, node: &T) -> bool { ... } fn show_body(&mut self, node: NodeId, ui: &mut Ui, treeize: &mut Treeize<T>) { ... } fn final_node_rect( &mut self, node: NodeId, rect: Rect, ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn has_on_hover_popup(&mut self, node: &T) -> bool { ... } fn show_on_hover_popup( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn has_wire_widget( &mut self, from: &OutPinId, to: &InPinId, treeize: &Treeize<T>, ) -> bool { ... } fn show_wire_widget( &mut self, from: &OutPin, to: &InPin, ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn has_graph_menu(&mut self, pos: Pos2, treeize: &mut Treeize<T>) -> bool { ... } fn show_graph_menu( &mut self, pos: Pos2, ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn has_dropped_wire_menu( &mut self, src_pins: AnyPins<'_>, treeize: &mut Treeize<T>, ) -> bool { ... } fn show_dropped_wire_menu( &mut self, pos: Pos2, ui: &mut Ui, src_pins: AnyPins<'_>, treeize: &mut Treeize<T>, ) { ... } fn has_node_menu(&mut self, node: &T) -> bool { ... } fn show_node_menu( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], ui: &mut Ui, treeize: &mut Treeize<T>, ) { ... } fn connect(&mut self, from: &OutPin, to: &InPin, treeize: &mut Treeize<T>) { ... } fn disconnect( &mut self, from: &OutPin, to: &InPin, treeize: &mut Treeize<T>, ) { ... } fn drop_outputs(&mut self, pin: &OutPin, treeize: &mut Treeize<T>) { ... } fn drop_inputs(&mut self, pin: &InPin, treeize: &mut Treeize<T>) { ... } fn draw_background( &mut self, background: Option<&BackgroundPattern>, viewport: &Rect, treeize_style: &TreeizeStyle, style: &Style, painter: &Painter, treeize: &Treeize<T>, ) { ... } fn current_transform( &mut self, to_global: &mut TSTransform, treeize: &mut Treeize<T>, ) { ... }
}
Expand description

TreeizeViewer is a trait for viewing a Treeize.

It can extract necessary data from the nodes and controls their response to certain events.

Required Methods§

Source

fn title(&mut self, node: &T) -> String

Returns title of the node.

Source

fn has_input(&mut self, node: &T) -> bool

Returns true if node has an input pin.

Source

fn has_output(&mut self, node: &T) -> bool

Returns true if node has an output pin.

Source

fn show_input( &mut self, pin: &InPin, ui: &mut Ui, treeize: &mut Treeize<T>, ) -> impl TreeizePin + 'static

Renders one specified node’s input element and returns drawer for the corresponding pin.

Source

fn show_output( &mut self, pin: &OutPin, ui: &mut Ui, treeize: &mut Treeize<T>, ) -> impl TreeizePin + 'static

Renders the node’s output.

Provided Methods§

Source

fn node_frame( &mut self, default: Frame, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> Frame

Returns the node’s frame. All node’s elements will be rendered inside this frame. Except for pins if they are configured to be rendered outside of the frame.

Returns default by default. default frame is taken from the TreeizeStyle::node_frame or constructed if it’s None.

Override this method to customize the frame for specific nodes.

Source

fn header_frame( &mut self, default: Frame, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> Frame

Returns the node’s header frame.

This frame would be placed on top of the node’s frame. And header UI (see [show_header]) will be placed inside this frame.

Returns default by default. default frame is taken from the TreeizeStyle::header_frame, or TreeizeStyle::node_frame with removed shadow if None, or constructed if both are None.

Source

fn has_node_style( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> bool

Checks if node has a custom egui style.

Source

fn apply_node_style( &mut self, style: &mut Style, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, )

Modifies the node’s egui style

Source

fn node_layout( &mut self, default: NodeLayout, node: NodeId, inputs: &[InPin], outputs: &[OutPin], treeize: &Treeize<T>, ) -> NodeLayout

Returns elements layout for the node.

Node consists of 4 parts: header, body, input pins and output pins. See NodeLayout for available placements.

Returns default by default. default layout is taken from the TreeizeStyle::node_layout or constructed if it’s None. Override this method to customize the layout for specific nodes.

Source

fn show_header(&mut self, node: NodeId, ui: &mut Ui, treeize: &mut Treeize<T>)

Renders elements inside the node’s header frame.

This is the good place to show the node’s title and controls related to the whole node.

By default it shows the node’s title.

Source

fn has_body(&mut self, node: &T) -> bool

Checks if node has something to show in body - between input and output pins.

Source

fn show_body(&mut self, node: NodeId, ui: &mut Ui, treeize: &mut Treeize<T>)

Renders the node’s body.

Source

fn final_node_rect( &mut self, node: NodeId, rect: Rect, ui: &mut Ui, treeize: &mut Treeize<T>, )

Reports the final node’s rect after rendering.

It aimed to be used for custom positioning of nodes that requires node dimensions for calculations. Node’s position can be modified directly in this method.

Source

fn has_on_hover_popup(&mut self, node: &T) -> bool

Checks if node has something to show in on-hover popup.

Source

fn show_on_hover_popup( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], ui: &mut Ui, treeize: &mut Treeize<T>, )

Renders the node’s on-hover popup.

Source

fn has_wire_widget( &mut self, from: &OutPinId, to: &InPinId, treeize: &Treeize<T>, ) -> bool

Checks if wire has something to show in widget. This may not be called if wire is invisible.

Source

fn show_wire_widget( &mut self, from: &OutPin, to: &InPin, ui: &mut Ui, treeize: &mut Treeize<T>, )

Renders the wire’s widget. This may not be called if wire is invisible.

Source

fn has_graph_menu(&mut self, pos: Pos2, treeize: &mut Treeize<T>) -> bool

Checks if the treeize has something to show in context menu if right-clicked or long-touched on empty space at pos.

Source

fn show_graph_menu(&mut self, pos: Pos2, ui: &mut Ui, treeize: &mut Treeize<T>)

Show context menu for the treeize.

This can be used to implement menu for adding new nodes.

Source

fn has_dropped_wire_menu( &mut self, src_pins: AnyPins<'_>, treeize: &mut Treeize<T>, ) -> bool

Checks if the treeize has something to show in context menu if wire drag is stopped at pos.

Source

fn show_dropped_wire_menu( &mut self, pos: Pos2, ui: &mut Ui, src_pins: AnyPins<'_>, treeize: &mut Treeize<T>, )

Show context menu for the treeize. This menu is opened when releasing a pin to empty space. It can be used to implement menu for adding new node, and directly connecting it to the released wire.

Source

fn has_node_menu(&mut self, node: &T) -> bool

Checks if the node has something to show in context menu if right-clicked or long-touched on the node.

Source

fn show_node_menu( &mut self, node: NodeId, inputs: &[InPin], outputs: &[OutPin], ui: &mut Ui, treeize: &mut Treeize<T>, )

Show context menu for the treeize.

This can be used to implement menu for adding new nodes.

Source

fn connect(&mut self, from: &OutPin, to: &InPin, treeize: &mut Treeize<T>)

Asks the viewer to connect two pins.

This is usually happens when user drags a wire from one node’s output pin to another node’s input pin or vice versa. By default this method connects the pins and returns Ok(()).

Source

fn disconnect(&mut self, from: &OutPin, to: &InPin, treeize: &mut Treeize<T>)

Asks the viewer to disconnect two pins.

Source

fn drop_outputs(&mut self, pin: &OutPin, treeize: &mut Treeize<T>)

Asks the viewer to disconnect all wires from the output pin.

This is usually happens when right-clicking on an output pin. By default this method disconnects the pins and returns Ok(()).

Source

fn drop_inputs(&mut self, pin: &InPin, treeize: &mut Treeize<T>)

Asks the viewer to disconnect all wires from the input pin.

This is usually happens when right-clicking on an input pin. By default this method disconnects the pins and returns Ok(()).

Source

fn draw_background( &mut self, background: Option<&BackgroundPattern>, viewport: &Rect, treeize_style: &TreeizeStyle, style: &Style, painter: &Painter, treeize: &Treeize<T>, )

Draws background of the treeize view.

By default it draws the background pattern using BackgroundPattern::draw.

If you want to draw the background yourself, you can override this method.

Source

fn current_transform( &mut self, to_global: &mut TSTransform, treeize: &mut Treeize<T>, )

Informs the viewer what is the current transform of the treeize view and allows viewer to override it.

This method is called in the beginning of the graph rendering.

By default it does nothing.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§