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§

source

type Executor: Executor

See [Application::Executor]. You’ll likely want to use [crate::executor::Default].

source

type Message: 'static + Clone + Debug + Send

See [Application::Message]. You should have one variant containing a ParamMessage.

source

type InitializationFlags: 'static + Clone + Send + Sync

See [Application::Flags].

Required Methods§

source

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.

source

fn context(&self) -> &dyn GuiContext

Returns a reference to the GUI context. handle_param_message() uses this to interact with the parameters.

source

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.

source

fn view(&mut self) -> Element<'_, Self::Message>

See [Application::view].

Provided Methods§

source

fn subscription( &self, _window_subs: &mut WindowSubs<Self::Message> ) -> Subscription<Self::Message>

See [Application::subscription].

source

fn background_color(&self) -> Color

See [Application::background_color].

source

fn scale_policy(&self) -> WindowScalePolicy

See [Application::scale_policy].

TODO: Is this needed? Editors shouldn’t change the scale policy.

source

fn renderer_settings() -> Settings

See [Application::renderer_settings].

source

fn handle_param_message(&self, message: ParamMessage)

Handle a parameter update using the GUI context.

Implementors§