mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
move header preset init to the target widget impl
This commit is contained in:
parent
f6fb73c241
commit
ffb6929bec
3 changed files with 40 additions and 60 deletions
|
|
@ -6,7 +6,7 @@ mod title;
|
|||
use file::File;
|
||||
use gtk::{
|
||||
glib::{uuid_string_random, Bytes},
|
||||
Label, Notebook,
|
||||
Notebook,
|
||||
};
|
||||
pub use header::Header;
|
||||
use text::Text;
|
||||
|
|
@ -18,17 +18,14 @@ pub trait Titan {
|
|||
|
||||
impl Titan for Notebook {
|
||||
fn titan(callback: impl Fn(Header, Bytes, Box<dyn Fn()>) + 'static) -> Self {
|
||||
use gtk::Box;
|
||||
use std::{cell::Cell, rc::Rc};
|
||||
use gtk::{Box, Label};
|
||||
|
||||
let notebook = Notebook::builder()
|
||||
.name(format!("s{}", uuid_string_random()))
|
||||
.show_border(false)
|
||||
.build();
|
||||
|
||||
let header = Rc::new(Cell::new(Header::new()));
|
||||
|
||||
notebook.append_page(&Box::text(&header, callback), Some(&Label::title("Text")));
|
||||
notebook.append_page(&Box::text(callback), Some(&Label::title("Text")));
|
||||
notebook.append_page(&Box::file(), Some(&Label::title("File")));
|
||||
|
||||
notebook_css_patch(¬ebook);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue