mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
50 lines
945 B
Rust
50 lines
945 B
Rust
// @TODO mod image;
|
|
mod text;
|
|
|
|
use text::Text;
|
|
|
|
use gtk::{prelude::BoxExt, Box, Orientation};
|
|
|
|
pub enum Mime {
|
|
Undefined,
|
|
TextGemini,
|
|
TextPlain,
|
|
}
|
|
|
|
pub struct Content {
|
|
mime: Mime,
|
|
widget: Box,
|
|
}
|
|
|
|
impl Content {
|
|
// Construct
|
|
pub fn new() -> Self {
|
|
Self {
|
|
mime: Mime::Undefined,
|
|
widget: Box::builder().orientation(Orientation::Vertical).build(),
|
|
}
|
|
}
|
|
|
|
// Actions
|
|
pub fn reset(&self, mime: Mime, data: &str) {
|
|
//self.widget.remove(self.child.widget());
|
|
match mime {
|
|
Mime::TextGemini => {
|
|
let child = Text::gemini(data);
|
|
self.widget.append(child.widget());
|
|
}
|
|
Mime::TextPlain => {
|
|
todo!()
|
|
}
|
|
Mime::Undefined => {
|
|
todo!()
|
|
}
|
|
}
|
|
}
|
|
|
|
// Getters
|
|
pub fn widget(&self) -> &Box {
|
|
&self.widget
|
|
}
|
|
}
|