pub trait NodeDataTraitwhere
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§
Required Methods§
Provided Methods§
Sourcefn 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 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,
UI to draw on the top bar of the node.
Sourcefn 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 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,
UI to draw for each output
Defaults to showing param_name as a simple label.
Sourcefn titlebar_color(
&self,
_ui: &Ui,
_node_id: NodeId,
_graph: &Graph<Self, Self::DataType, Self::ValueType>,
_user_state: &mut Self::UserState,
) -> Option<Color32>
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.
Sourcefn separator(
&self,
_ui: &mut Ui,
_node_id: NodeId,
_param_id: AnyParameterId,
_graph: &Graph<Self, Self::DataType, Self::ValueType>,
_user_state: &mut Self::UserState,
)
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.
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".