mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
allow any kind of widget
This commit is contained in:
parent
f13aff2fa8
commit
b2237879be
@ -1,4 +1,7 @@
|
||||
use gtk::{prelude::BoxExt, Box, Button, Orientation};
|
||||
use gtk::{
|
||||
prelude::{BoxExt, IsA},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Widget {
|
||||
@ -7,7 +10,7 @@ pub struct Widget {
|
||||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(back: &Button, forward: &Button) -> Arc<Self> {
|
||||
pub fn new_arc(back: &impl IsA<gtk::Widget>, forward: &impl IsA<gtk::Widget>) -> Arc<Self> {
|
||||
// Init widget
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
|
@ -1,4 +1,7 @@
|
||||
use gtk::{prelude::BoxExt, Box, Button, Entry, Orientation};
|
||||
use gtk::{
|
||||
prelude::{BoxExt, IsA},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
const MARGIN: i32 = 6;
|
||||
@ -11,11 +14,11 @@ pub struct Widget {
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(
|
||||
base: &Button,
|
||||
history: &Box,
|
||||
reload: &Button,
|
||||
request: &Entry,
|
||||
bookmark: &Button,
|
||||
base: &impl IsA<gtk::Widget>,
|
||||
history: &impl IsA<gtk::Widget>,
|
||||
reload: &impl IsA<gtk::Widget>,
|
||||
request: &impl IsA<gtk::Widget>,
|
||||
bookmark: &impl IsA<gtk::Widget>,
|
||||
) -> Arc<Self> {
|
||||
let gobject = Box::builder()
|
||||
.orientation(Orientation::Horizontal)
|
||||
|
@ -1,8 +1,7 @@
|
||||
use adw::Clamp;
|
||||
use gtk::{
|
||||
gio::{SimpleAction, SimpleActionGroup},
|
||||
glib::uuid_string_random,
|
||||
prelude::{ActionMapExt, BoxExt, WidgetExt},
|
||||
prelude::{ActionMapExt, BoxExt, IsA, WidgetExt},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
@ -18,9 +17,9 @@ impl Widget {
|
||||
// Actions
|
||||
action_page_open: SimpleAction,
|
||||
// Components
|
||||
navigation: &Box,
|
||||
content: &Box,
|
||||
input: &Clamp,
|
||||
navigation: &impl IsA<gtk::Widget>,
|
||||
content: &impl IsA<gtk::Widget>,
|
||||
input: &impl IsA<gtk::Widget>,
|
||||
) -> Arc<Self> {
|
||||
// Init additional action group
|
||||
let action_group = SimpleActionGroup::new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user