From b759ad72ee7775d18d9b8c1ceaf58fc566823ec0 Mon Sep 17 00:00:00 2001 From: yggverse Date: Thu, 19 Sep 2024 00:02:09 +0300 Subject: [PATCH] init label components --- src/app/browser/main/tab/label.rs | 19 ++++++++++++++++--- src/app/browser/main/tab/label/pin.rs | 10 ++++++++++ src/app/browser/main/tab/label/title.rs | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/app/browser/main/tab/label/pin.rs create mode 100644 src/app/browser/main/tab/label/title.rs diff --git a/src/app/browser/main/tab/label.rs b/src/app/browser/main/tab/label.rs index 306b3750..56962b97 100644 --- a/src/app/browser/main/tab/label.rs +++ b/src/app/browser/main/tab/label.rs @@ -1,9 +1,22 @@ +#[path = "label/pin.rs"] mod pin; +#[path = "label/title.rs"] mod title; + use gtk::Box; -// use gtk::prelude::BoxExt; @TODO append +use gtk::prelude::BoxExt; pub fn new() -> Box { - return Box::builder().orientation( - gtk::Orientation::Vertical + let label = Box::builder().orientation( + gtk::Orientation::Horizontal ).build(); + + label.append( + &pin::new() + ); + + label.append( + &title::new() + ); + + return label; } \ No newline at end of file diff --git a/src/app/browser/main/tab/label/pin.rs b/src/app/browser/main/tab/label/pin.rs new file mode 100644 index 00000000..fc8340b0 --- /dev/null +++ b/src/app/browser/main/tab/label/pin.rs @@ -0,0 +1,10 @@ +use gtk::Image; + +pub fn new() -> Image +{ + let pin = Image::builder().icon_name( + "view-pin-symbolic" + ).build(); + + return pin; +} \ No newline at end of file diff --git a/src/app/browser/main/tab/label/title.rs b/src/app/browser/main/tab/label/title.rs new file mode 100644 index 00000000..f011d846 --- /dev/null +++ b/src/app/browser/main/tab/label/title.rs @@ -0,0 +1,24 @@ +use gtk::Label; + +pub fn new() -> Label +{ + return Label::builder() + + .label( + "New page" + ) + + .ellipsize( + gtk::pango::EllipsizeMode::End + ) + + .width_chars( + 16 + ) + + .single_line_mode( + true + ) + + .build(); +} \ No newline at end of file