mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
draft gemtext composer
This commit is contained in:
parent
70f3b51591
commit
1cc3ddaf2e
5 changed files with 89 additions and 8 deletions
|
|
@ -1,6 +1,18 @@
|
|||
use gtk::{Box, Orientation};
|
||||
// @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,
|
||||
}
|
||||
|
||||
|
|
@ -8,10 +20,28 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue