changed inputs for second section and implemented Clone and Copy traits for Alignment data structure
This commit is contained in:
@@ -1,31 +1,24 @@
|
||||
use std::ops::Deref;
|
||||
use gtk4 as gtk;
|
||||
|
||||
#[allow(unused)]
|
||||
use gtk::{
|
||||
Box,
|
||||
Stack,
|
||||
Widget,
|
||||
Orientation,
|
||||
StackSidebar,
|
||||
StackSwitcher,
|
||||
StackTransitionType,
|
||||
prelude::{BoxExt, IsA},
|
||||
Box, Orientation, Stack, StackSidebar, StackSwitcher, StackTransitionType, Widget,
|
||||
};
|
||||
|
||||
use crate::view::components::builder_traits::{Builder, Product};
|
||||
|
||||
pub type Page<'a> = (&'a str, &'a str, &'a Box);
|
||||
|
||||
pub struct Pages{
|
||||
wrapper: Box
|
||||
pub struct Pages {
|
||||
wrapper: Box,
|
||||
}
|
||||
|
||||
pub struct PagesBuilder{
|
||||
pub struct PagesBuilder {
|
||||
pages_content: Stack,
|
||||
}
|
||||
|
||||
impl Product<PagesBuilder, Box> for Pages {
|
||||
|
||||
fn builder() -> PagesBuilder {
|
||||
PagesBuilder {
|
||||
pages_content: Stack::new(),
|
||||
@@ -35,11 +28,9 @@ impl Product<PagesBuilder, Box> for Pages {
|
||||
fn get(self) -> Box {
|
||||
self.wrapper
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
|
||||
|
||||
impl Builder<Pages, Page<'_>, i32> for PagesBuilder {
|
||||
fn build(&self, build_param: i32) -> Pages {
|
||||
let stack_sidebar = StackSidebar::new();
|
||||
let stack_switcher = StackSwitcher::new();
|
||||
@@ -52,9 +43,7 @@ impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
|
||||
wrapper.append(&stack_sidebar);
|
||||
wrapper.append(&self.pages_content);
|
||||
|
||||
Pages{
|
||||
wrapper
|
||||
}
|
||||
Pages { wrapper }
|
||||
}
|
||||
|
||||
fn append_item(self, item: Page) -> Self {
|
||||
@@ -70,27 +59,18 @@ impl Builder<Pages, Page<'_>, i32> for PagesBuilder{
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl PagesBuilder {
|
||||
|
||||
fn append_page_private(
|
||||
&self,
|
||||
item: Page
|
||||
) {
|
||||
fn append_page_private(&self, item: Page) {
|
||||
self.pages_content.add_titled(item.2, Some(item.1), item.0);
|
||||
}
|
||||
|
||||
pub fn set_transition(
|
||||
self,
|
||||
type_transition : StackTransitionType,
|
||||
duration: u32
|
||||
) -> Self {
|
||||
pub fn set_transition(self, type_transition: StackTransitionType, duration: u32) -> Self {
|
||||
self.pages_content.set_transition_type(type_transition);
|
||||
self.pages_content.set_transition_duration(duration);
|
||||
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user