45 lines
1.0 KiB
Rust
Executable File
45 lines
1.0 KiB
Rust
Executable File
/*
|
|
* Copyright (C) 2022 Umut İnan Erdoğan <umutinanerdogan@pm.me>
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
mod column;
|
|
mod label;
|
|
mod padding;
|
|
mod row;
|
|
|
|
use abletk_common::Renderer;
|
|
pub use column::*;
|
|
pub use label::*;
|
|
pub use padding::*;
|
|
pub use row::*;
|
|
use winit::event::MouseButton;
|
|
|
|
use crate::{layout::position::Position, window::Window};
|
|
|
|
pub trait Widget {
|
|
fn draw(&self, renderer: &mut Renderer);
|
|
|
|
// fixme: don't pass renderer
|
|
fn position(&self, renderer: &mut Renderer) -> Position;
|
|
|
|
fn mouse_pressed(&mut self,
|
|
renderer: &mut Renderer,
|
|
window: &mut Window,
|
|
button: MouseButton,
|
|
x: u32,
|
|
y: u32,
|
|
);
|
|
|
|
fn mouse_released(&mut self,
|
|
renderer: &mut Renderer,
|
|
window: &mut Window,
|
|
button: MouseButton,
|
|
x: u32,
|
|
y: u32,
|
|
);
|
|
}
|