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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub struct Widget {
|
pub struct Widget {
|
||||||
@ -7,7 +10,7 @@ pub struct Widget {
|
|||||||
|
|
||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// 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
|
// Init widget
|
||||||
let gobject = Box::builder()
|
let gobject = Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
const MARGIN: i32 = 6;
|
const MARGIN: i32 = 6;
|
||||||
@ -11,11 +14,11 @@ pub struct Widget {
|
|||||||
impl Widget {
|
impl Widget {
|
||||||
// Construct
|
// Construct
|
||||||
pub fn new_arc(
|
pub fn new_arc(
|
||||||
base: &Button,
|
base: &impl IsA<gtk::Widget>,
|
||||||
history: &Box,
|
history: &impl IsA<gtk::Widget>,
|
||||||
reload: &Button,
|
reload: &impl IsA<gtk::Widget>,
|
||||||
request: &Entry,
|
request: &impl IsA<gtk::Widget>,
|
||||||
bookmark: &Button,
|
bookmark: &impl IsA<gtk::Widget>,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
let gobject = Box::builder()
|
let gobject = Box::builder()
|
||||||
.orientation(Orientation::Horizontal)
|
.orientation(Orientation::Horizontal)
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use adw::Clamp;
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{SimpleAction, SimpleActionGroup},
|
gio::{SimpleAction, SimpleActionGroup},
|
||||||
glib::uuid_string_random,
|
glib::uuid_string_random,
|
||||||
prelude::{ActionMapExt, BoxExt, WidgetExt},
|
prelude::{ActionMapExt, BoxExt, IsA, WidgetExt},
|
||||||
Box, Orientation,
|
Box, Orientation,
|
||||||
};
|
};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@ -18,9 +17,9 @@ impl Widget {
|
|||||||
// Actions
|
// Actions
|
||||||
action_page_open: SimpleAction,
|
action_page_open: SimpleAction,
|
||||||
// Components
|
// Components
|
||||||
navigation: &Box,
|
navigation: &impl IsA<gtk::Widget>,
|
||||||
content: &Box,
|
content: &impl IsA<gtk::Widget>,
|
||||||
input: &Clamp,
|
input: &impl IsA<gtk::Widget>,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
// Init additional action group
|
// Init additional action group
|
||||||
let action_group = SimpleActionGroup::new();
|
let action_group = SimpleActionGroup::new();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user