use adw Clamp for input

This commit is contained in:
yggverse 2024-10-16 12:40:38 +03:00
parent 9be583044f
commit 78c2765d2a
4 changed files with 14 additions and 12 deletions

View File

@ -4,7 +4,7 @@ mod widget;
use content::Content; use content::Content;
use widget::Widget; use widget::Widget;
use adw::ToolbarView; use adw::Clamp;
use std::sync::Arc; use std::sync::Arc;
pub struct Input { pub struct Input {
@ -32,7 +32,7 @@ impl Input {
} }
// Getters // Getters
pub fn gobject(&self) -> &ToolbarView { pub fn gobject(&self) -> &Clamp {
&self.widget.gobject() &self.widget.gobject()
} }
} }

View File

@ -9,7 +9,7 @@ impl Widget {
// Construct // Construct
pub fn new_arc() -> Arc<Self> { pub fn new_arc() -> Arc<Self> {
let gobject = Button::builder() let gobject = Button::builder()
.css_classes(["accent"]) //.css_classes(["accent"])
.halign(Align::End) .halign(Align::End)
.label("Send") .label("Send")
.build(); .build();

View File

@ -1,16 +1,18 @@
use adw::ToolbarView; use adw::Clamp;
use gtk::{prelude::WidgetExt, Box}; use gtk::{prelude::WidgetExt, Box};
use std::sync::Arc; use std::sync::Arc;
pub struct Widget { pub struct Widget {
gobject: ToolbarView, gobject: Clamp,
} }
impl Widget { impl Widget {
// Construct // Construct
pub fn new_arc(content: &Box) -> Arc<Self> { pub fn new_arc(child: &Box) -> Arc<Self> {
let gobject = ToolbarView::builder() let gobject = Clamp::builder()
.content(content) .child(child)
.css_classes(["app-notification"])
.maximum_size(800)
.visible(false) .visible(false)
.build(); .build();
@ -23,7 +25,7 @@ impl Widget {
} }
// Getters // Getters
pub fn gobject(&self) -> &ToolbarView { pub fn gobject(&self) -> &Clamp {
&self.gobject &self.gobject
} }
} }

View File

@ -1,4 +1,4 @@
use adw::ToolbarView; use adw::Clamp;
use gtk::{ use gtk::{
gio::{SimpleAction, SimpleActionGroup}, gio::{SimpleAction, SimpleActionGroup},
glib::uuid_string_random, glib::uuid_string_random,
@ -20,7 +20,7 @@ impl Widget {
// Components // Components
navigation: &Box, navigation: &Box,
content: &Box, content: &Box,
input: &ToolbarView, input: &Clamp,
) -> Arc<Self> { ) -> Arc<Self> {
// Init additional action group // Init additional action group
let action_group = SimpleActionGroup::new(); let action_group = SimpleActionGroup::new();
@ -33,8 +33,8 @@ impl Widget {
.build(); .build();
gobject.append(navigation); gobject.append(navigation);
gobject.append(input);
gobject.append(content); gobject.append(content);
gobject.append(input);
gobject.insert_action_group(&uuid_string_random(), Some(&action_group)); gobject.insert_action_group(&uuid_string_random(), Some(&action_group));