summaryrefslogblamecommitdiff
path: root/src/window_controller.rs
blob: c655d5d63a9cb8ea322d0647cc665d811f578be2 (plain) (tree)
1
2
3
4
5
6
7
8
9
             


                                                                         
 
                                                          
                                                         
                                                         



                                                                         

                                                

                                                 
                                              
                                                       
                               
                                                                               
                                     
 

                                                     
 

                                                            




                                                            
                                                                            
                                                     
                                         
                                               
 
use crate::*;
use std::num::NonZeroU32;
use std::path::Path;

const NON_ZERO_ONE: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(1) };

pub trait WindowController {
    fn title(&self) -> String { String::from("Phosphor") }
    fn initial_size(&self) -> Option<Dimensions> { None }
    fn minimum_size(&self) -> Option<Dimensions> { None }
    fn maximum_size(&self) -> Option<Dimensions> { None }
    fn exact_size(&self) -> Option<Dimensions> { None }
    fn pixel_scale(&self) -> NonZeroU32 { NON_ZERO_ONE }

    fn cursor_icon(&mut self) -> Option<CursorIcon> { None }
    fn render_request(&mut self) -> RenderRequest { RenderRequest::None }

    fn is_visible(&self) -> bool { true }
    fn is_cursor_visible(&self) -> bool { true }

    fn on_init(&mut self) {}
    fn on_resize(&mut self, _size: Dimensions) {}
    fn on_move(&mut self, _position: Point) {}
    fn on_focus_change(&mut self, _is_focused: bool) {}
    fn on_process(&mut self) {}
    fn on_render(&mut self, _buffer: &mut buffer::Buffer, _hint: RenderHint) {}
    fn on_close_request(&mut self) {}
    fn on_close(&mut self) {}

    fn on_cursor_enter(&mut self) {}
    fn on_cursor_exit(&mut self) {}
    fn on_cursor_move(&mut self, _position: Point) {}

    fn on_left_mouse_button(&mut self, _action: Action) {}
    fn on_middle_mouse_button(&mut self, _action: Action) {}
    fn on_right_mouse_button(&mut self, _action: Action) {}

    fn on_line_scroll_horizontal(&mut self, _delta: f64) {}
    fn on_line_scroll_vertical(&mut self, _delta: f64) {}
    fn on_pixel_scroll_horizontal(&mut self, _delta: f64) {}
    fn on_pixel_scroll_vertical(&mut self, _delta: f64) {}

    fn on_keyboard_input(&mut self, _input: KeyboardInput) {}
    fn on_keyboard_modifier_change(&mut self, _modifiers: ModifiersState) {}
    fn on_character_input(&mut self, _input: char) {}
    fn on_file_hover(&mut self, _path: &Path) {}
    fn on_file_hover_cancel(&mut self) {}
    fn on_file_drop(&mut self, _path: &Path) {}
}