Trait nih_plug_iced::IcedEditor
source · pub trait IcedEditor: 'static + Send + Sync + Sized {
type Executor: Executor;
type Message: 'static + Clone + Debug + Send;
type InitializationFlags: 'static + Clone + Send + Sync;
// Required methods
fn new(
initialization_fags: Self::InitializationFlags,
context: Arc<dyn GuiContext>
) -> (Self, Command<Self::Message>);
fn context(&self) -> &dyn GuiContext;
fn update(
&mut self,
window: &mut WindowQueue,
message: Self::Message
) -> Command<Self::Message>;
fn view(&mut self) -> Element<'_, Self::Message>;
// Provided methods
fn subscription(
&self,
_window_subs: &mut WindowSubs<Self::Message>
) -> Subscription<Self::Message> { ... }
fn background_color(&self) -> Color { ... }
fn scale_policy(&self) -> WindowScalePolicy { ... }
fn renderer_settings() -> Settings { ... }
fn handle_param_message(&self, message: ParamMessage) { ... }
}
Expand description
A plugin editor using iced
. This wraps around [Application
] with the only change being that
the usual new()
function now additionally takes a Arc<dyn GuiContext>
that the editor can
store to interact with the parameters. The editor should have a Arc<impl Params>
as part
of their InitializationFlags
so it can read the current parameter
values. See [Application
] for more information.
Required Associated Types§
sourcetype Executor: Executor
type Executor: Executor
See [Application::Executor
]. You’ll likely want to use [crate::executor::Default
].
sourcetype Message: 'static + Clone + Debug + Send
type Message: 'static + Clone + Debug + Send
See [Application::Message
]. You should have one variant containing a ParamMessage
.
sourcetype InitializationFlags: 'static + Clone + Send + Sync
type InitializationFlags: 'static + Clone + Send + Sync
See [Application::Flags
].
Required Methods§
sourcefn new(
initialization_fags: Self::InitializationFlags,
context: Arc<dyn GuiContext>
) -> (Self, Command<Self::Message>)
fn new( initialization_fags: Self::InitializationFlags, context: Arc<dyn GuiContext> ) -> (Self, Command<Self::Message>)
See [Application::new
]. This also receivs the GUI context in addition to the flags.
sourcefn context(&self) -> &dyn GuiContext
fn context(&self) -> &dyn GuiContext
Returns a reference to the GUI context.
handle_param_message()
uses this to interact with the
parameters.
sourcefn update(
&mut self,
window: &mut WindowQueue,
message: Self::Message
) -> Command<Self::Message>
fn update( &mut self, window: &mut WindowQueue, message: Self::Message ) -> Command<Self::Message>
See [Application::update
]. When receiving the variant that contains a
widgets::ParamMessage
you can call
handle_param_message()
to handle the parameter update.
Provided Methods§
sourcefn subscription(
&self,
_window_subs: &mut WindowSubs<Self::Message>
) -> Subscription<Self::Message>
fn subscription( &self, _window_subs: &mut WindowSubs<Self::Message> ) -> Subscription<Self::Message>
See [Application::subscription
].
sourcefn background_color(&self) -> Color
fn background_color(&self) -> Color
See [Application::background_color
].
sourcefn scale_policy(&self) -> WindowScalePolicy
fn scale_policy(&self) -> WindowScalePolicy
See [Application::scale_policy
].
TODO: Is this needed? Editors shouldn’t change the scale policy.
sourcefn renderer_settings() -> Settings
fn renderer_settings() -> Settings
See [Application::renderer_settings
].
sourcefn handle_param_message(&self, message: ParamMessage)
fn handle_param_message(&self, message: ParamMessage)
Handle a parameter update using the GUI context.