mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
create separated widget mod implementation
This commit is contained in:
parent
8fa56ebf9a
commit
6f3ad01c35
@ -1,34 +1,31 @@
|
|||||||
mod tab;
|
mod tab;
|
||||||
|
mod widget;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use gtk::prelude::BoxExt;
|
|
||||||
use gtk::Box;
|
|
||||||
|
|
||||||
pub struct Main {
|
pub struct Main {
|
||||||
pub widget: Arc<gtk::Box>,
|
widget: widget::Main,
|
||||||
pub tab: Arc<tab::Tab>,
|
tab: tab::Tab,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Main {
|
impl Main {
|
||||||
|
// Construct
|
||||||
|
pub fn new() -> Main {
|
||||||
|
// Init components
|
||||||
|
let tab = tab::new();
|
||||||
|
|
||||||
|
// Init struct
|
||||||
|
Self {
|
||||||
|
widget: widget::Main::new(tab.widget.as_ref()), // @TODO
|
||||||
|
tab,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actions
|
||||||
pub fn tab_append(&self) {
|
pub fn tab_append(&self) {
|
||||||
self.tab.append(true);
|
self.tab.append(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Getters
|
||||||
pub fn new() -> Main {
|
pub fn widget(&self) -> &widget::Main {
|
||||||
// Init components
|
&self.widget
|
||||||
let tab = Arc::new(tab::new());
|
}
|
||||||
|
|
||||||
// Init widget
|
|
||||||
let widget = Arc::new(
|
|
||||||
Box::builder()
|
|
||||||
.orientation(gtk::Orientation::Vertical)
|
|
||||||
.build(),
|
|
||||||
);
|
|
||||||
|
|
||||||
widget.append(tab.widget.as_ref());
|
|
||||||
|
|
||||||
// Init struct
|
|
||||||
Main { widget, tab }
|
|
||||||
}
|
}
|
||||||
|
23
src/browser/main/widget.rs
Normal file
23
src/browser/main/widget.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
use gtk::prelude::BoxExt;
|
||||||
|
|
||||||
|
pub struct Main {
|
||||||
|
gtk: gtk::Box,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Main {
|
||||||
|
// Construct
|
||||||
|
pub fn new(tab: >k::Notebook) -> Main {
|
||||||
|
let gtk = gtk::Box::builder()
|
||||||
|
.orientation(gtk::Orientation::Vertical)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
gtk.append(tab);
|
||||||
|
|
||||||
|
Self { gtk }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getters
|
||||||
|
pub fn gtk(&self) -> >k::Box {
|
||||||
|
&self.gtk
|
||||||
|
}
|
||||||
|
}
|
@ -23,7 +23,7 @@ impl Browser {
|
|||||||
let widget = widget::Browser::new(
|
let widget = widget::Browser::new(
|
||||||
app,
|
app,
|
||||||
header::Header::new().widget().gtk(),
|
header::Header::new().widget().gtk(),
|
||||||
main::new().widget.as_ref(), // @TODO
|
main::Main::new().widget().gtk(),
|
||||||
default_width,
|
default_width,
|
||||||
default_height,
|
default_height,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user