mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
implement separated mods for navigation widgets
This commit is contained in:
parent
2e8d907c22
commit
2d9eec9b02
15 changed files with 401 additions and 194 deletions
46
src/app/browser/window/tab/item/page/navigation/widget.rs
Normal file
46
src/app/browser/window/tab/item/page/navigation/widget.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
use gtk::{
|
||||
prelude::{BoxExt, WidgetExt},
|
||||
Box, Button, DirectionType, Entry, Orientation,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
gobject: Box,
|
||||
}
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
base: &Button,
|
||||
history: &Box,
|
||||
reload: &Button,
|
||||
request: &Entry,
|
||||
bookmark: &Button,
|
||||
) -> Arc<Self> {
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
.spacing(8)
|
||||
.margin_start(6)
|
||||
.margin_end(6)
|
||||
.margin_bottom(6)
|
||||
.build();
|
||||
|
||||
gobject.append(base);
|
||||
gobject.append(history);
|
||||
gobject.append(reload);
|
||||
gobject.append(request);
|
||||
gobject.append(bookmark);
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn focus(&self) {
|
||||
self.gobject.child_focus(DirectionType::Right);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn gobject(&self) -> &Box {
|
||||
&self.gobject
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue