pub trait ViewerApp {
    // Provided methods
    fn setup(
        &mut self,
        _cc: &CreationContext<'_>,
        _document_widget: &mut DocumentWidget
    ) -> Result<()> { ... }
    fn handle_input(
        &mut self,
        _ctx: &Context,
        _document_widget: &mut DocumentWidget
    ) { ... }
    fn show_panels(
        &mut self,
        _ctx: &Context,
        _document_widget: &mut DocumentWidget
    ) -> Result<()> { ... }
    fn show_central_panel(
        &mut self,
        _ui: &mut Ui,
        _document_widget: &mut DocumentWidget
    ) -> Result<()> { ... }
    fn native_options(&self) -> NativeOptions { ... }
    fn title(&self) -> String { ... }
    fn load(&mut self, _storage: &dyn Storage) { ... }
    fn save(&self, _storage: &mut dyn Storage) { ... }
    fn on_exit(&mut self) { ... }
}
Expand description

Implement this trait to build a custom viewer app based on Viewer.

Provided Methods§

source

fn setup( &mut self, _cc: &CreationContext<'_>, _document_widget: &mut DocumentWidget ) -> Result<()>

source

fn handle_input( &mut self, _ctx: &Context, _document_widget: &mut DocumentWidget )

Handle input

This is call very early in the frame loop to allow consuming input before egui.

source

fn show_panels( &mut self, _ctx: &Context, _document_widget: &mut DocumentWidget ) -> Result<()>

Hook to show side panels

This hook is called before the central panel is drawn, as per the egui documentation.

source

fn show_central_panel( &mut self, _ui: &mut Ui, _document_widget: &mut DocumentWidget ) -> Result<()>

Hook to show the central panel.

This is call after the wgpu render callback that displays the document.

source

fn native_options(&self) -> NativeOptions

Hook to modify the native options before starting the app.

source

fn title(&self) -> String

Window title

source

fn load(&mut self, _storage: &dyn Storage)

Hook to load persistent data.

Use eframe::get_value to retrieve the data.

source

fn save(&self, _storage: &mut dyn Storage)

Hook to save persistent data.

Use eframe::set_value to store the data.

source

fn on_exit(&mut self)

Hook executed before shutting down the app.

Implementors§