summaryrefslogtreecommitdiff
path: root/src/window_controller.rs
blob: fe23f53453d3f0d59ae3be7ef7122cf479a45289 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 fullscreen(&self) -> bool { false }
    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) {}
}