29 lines
646 B
Rust
Executable File
29 lines
646 B
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/.
|
|
*/
|
|
|
|
use abletk_common::Renderer;
|
|
use crate::widget::Widget;
|
|
|
|
pub struct Label {
|
|
text: String
|
|
}
|
|
|
|
impl Widget for Label {
|
|
fn draw(&self, renderer: &Renderer) {
|
|
renderer.draw_text(&self.text);
|
|
}
|
|
}
|
|
|
|
impl Label {
|
|
pub fn new<S: Into<String>>(text: S) -> Self {
|
|
Self {
|
|
text: text.into()
|
|
}
|
|
}
|
|
}
|