init navbar components

This commit is contained in:
yggverse 2024-09-19 10:37:16 +03:00
parent 38659b45ca
commit 0759f14843
10 changed files with 240 additions and 2 deletions

View File

@ -1,9 +1,22 @@
#[path = "page/navigation.rs"] mod navigation;
#[path = "page/content.rs"] mod content;
use gtk::Box; use gtk::Box;
// use gtk::prelude::BoxExt; @TODO append use gtk::prelude::BoxExt;
pub fn new() -> Box pub fn new() -> Box
{ {
return Box::builder().orientation( let page = Box::builder().orientation(
gtk::Orientation::Vertical gtk::Orientation::Vertical
).build(); ).build();
page.append(
&navigation::new()
);
page.append(
&content::new()
);
return page;
} }

View File

@ -0,0 +1,9 @@
use gtk::Box;
// use gtk::prelude::BoxExt; @TODO append
pub fn new() -> Box
{
return Box::builder().orientation(
gtk::Orientation::Vertical
).build();
}

View File

@ -0,0 +1,50 @@
#[path = "navigation/base.rs"] mod base;
#[path = "navigation/history.rs"] mod history;
#[path = "navigation/reload.rs"] mod reload;
#[path = "navigation/request.rs"] mod request;
#[path = "navigation/bookmark.rs"] mod bookmark;
use gtk::Box;
use gtk::prelude::BoxExt;
pub fn new() -> Box
{
let navigation = Box::builder()
// Tuneup
.orientation(
gtk::Orientation::Horizontal
)
.spacing(8)
.margin_top(8)
.margin_start(8)
.margin_end(8)
.margin_bottom(8)
.build();
// Compose childs
navigation.append(
&base::new()
);
navigation.append(
&history::new()
);
navigation.append(
&reload::new()
);
navigation.append(
&request::new()
);
navigation.append(
&bookmark::new()
);
return navigation;
}

View File

@ -0,0 +1,22 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-home-symbolic"
)
.tooltip_text(
"Base"
)
.sensitive(
false
)
.build();
return button;
}

View File

@ -0,0 +1,22 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"starred-symbolic"
)
.tooltip_text(
"Toggle bookmark"
)
.sensitive(
false
)
.build();
return button;
}

View File

@ -0,0 +1,34 @@
#[path = "history/back.rs"] mod back;
#[path = "history/forward.rs"] mod forward;
use gtk::Box;
use gtk::prelude::BoxExt;
pub fn new() -> Box
{
let history = Box::builder()
// Tuneup
.orientation(
gtk::Orientation::Horizontal
)
.css_classes(
[
"linked" // merge childs
]
)
.build();
// Compose childs
history.append(
&back::new()
);
history.append(
&forward::new()
);
return history;
}

View File

@ -0,0 +1,22 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-previous-symbolic"
)
.tooltip_text(
"Back"
)
.sensitive(
false
)
.build();
return button;
}

View File

@ -0,0 +1,22 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"go-next-symbolic"
)
.tooltip_text(
"Forward"
)
.sensitive(
false
)
.build();
return button;
}

View File

@ -0,0 +1,22 @@
use gtk::Button;
pub fn new() -> Button
{
let button = Button::builder()
.icon_name(
"view-refresh-symbolic"
)
.tooltip_text(
"Reload"
)
.sensitive(
false
)
.build();
return button;
}

View File

@ -0,0 +1,22 @@
use gtk::Entry;
pub fn new() -> Entry
{
let entry = Entry::builder()
.placeholder_text(
"URL or search term..."
)
.hexpand(
true
)
.progress_pulse_step(
0.1
)
.build();
return entry;
}