Skip to main content

NodeDataTrait

Trait NodeDataTrait 

Source
pub trait NodeDataTrait
where Self: Sized,
{ type Response; type UserState; type DataType; type ValueType; // Required method fn bottom_ui( &self, ui: &mut Ui, node_id: NodeId, graph: &Graph<Self, Self::DataType, Self::ValueType>, user_state: &mut Self::UserState, ) -> Vec<NodeResponse<Self::Response, Self>> where Self::Response: UserResponseTrait; // Provided methods fn top_bar_ui( &self, _ui: &mut Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> Vec<NodeResponse<Self::Response, Self>> where Self::Response: UserResponseTrait { ... } fn output_ui( &self, ui: &mut Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, param_name: &str, ) -> Vec<NodeResponse<Self::Response, Self>> where Self::Response: UserResponseTrait { ... } fn titlebar_color( &self, _ui: &Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> Option<Color32> { ... } fn separator( &self, _ui: &mut Ui, _node_id: NodeId, _param_id: AnyParameterId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) { ... } fn can_delete( &self, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> bool { ... } fn can_flip( &self, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> bool { ... } }
Expand description

This trait must be implemented for the NodeData generic parameter of the Graph. This trait allows customizing some aspects of the node drawing.

Required Associated Types§

Source

type Response

Must be set to the custom user NodeResponse type

Source

type UserState

Must be set to the custom user UserState type

Source

type DataType

Must be set to the custom user DataType type

Source

type ValueType

Must be set to the custom user ValueType type

Required Methods§

Source

fn bottom_ui( &self, ui: &mut Ui, node_id: NodeId, graph: &Graph<Self, Self::DataType, Self::ValueType>, user_state: &mut Self::UserState, ) -> Vec<NodeResponse<Self::Response, Self>>

Additional UI elements to draw in the nodes, after the parameters.

Provided Methods§

Source

fn top_bar_ui( &self, _ui: &mut Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> Vec<NodeResponse<Self::Response, Self>>

UI to draw on the top bar of the node.

Source

fn output_ui( &self, ui: &mut Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, param_name: &str, ) -> Vec<NodeResponse<Self::Response, Self>>

UI to draw for each output

Defaults to showing param_name as a simple label.

Source

fn titlebar_color( &self, _ui: &Ui, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> Option<Color32>

Set background color on titlebar If the return value is None, the default color is set.

Source

fn separator( &self, _ui: &mut Ui, _node_id: NodeId, _param_id: AnyParameterId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, )

Separator to put between elements in the node.

Invoked between inputs, outputs and bottom UI. Useful for complicated UIs that start to lose structure without explicit separators. The param_id argument is the id of input or output preceeding the separator.

Default implementation does nothing.

Source

fn can_delete( &self, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> bool

Source

fn can_flip( &self, _node_id: NodeId, _graph: &Graph<Self, Self::DataType, Self::ValueType>, _user_state: &mut Self::UserState, ) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§