diff --git a/src/app/mod.rs b/src/app/mod.rs index d73d024c..18f6b399 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -546,7 +546,6 @@ impl ApplicationExt for App { let sharp_corners = core.window.sharp_corners; let content_container = core.window.content_container; let show_context = core.window.show_context; - let context_is_overlay = core.window.context_is_overlay; let nav_bar_active = core.nav_bar_active(); let focused = core .focused_window() @@ -557,11 +556,7 @@ impl ApplicationExt for App { let main_content_padding = if !content_container { [0, 0, 0, 0] } else { - let right_padding = if show_context && !context_is_overlay { - 0 - } else { - border_padding - }; + let right_padding = if show_context { 0 } else { border_padding }; let left_padding = if nav_bar_active { 0 } else { border_padding }; [0, right_padding, 0, left_padding] @@ -595,7 +590,7 @@ impl ApplicationExt for App { //TODO: reduce duplication let context_width = core.context_width(has_nav); - if context_is_overlay && show_context { + if core.window.context_is_overlay && show_context { if let Some(context) = self.context_drawer() { widgets.push( crate::widget::context_drawer( @@ -615,17 +610,11 @@ impl ApplicationExt for App { )) }) .apply(container) - .padding(if content_container { - [0, border_padding, border_padding, border_padding] - } else { - [0, 0, 0, 0] - }) + .padding([0, border_padding, 0, 0]) .apply(Element::from) .map(crate::Action::App), ); } else { - //TODO: container and padding are temporary, until - //the `resize_border` is moved to not cover window content widgets.push( container(main_content.map(crate::Action::App)) .padding(main_content_padding) @@ -634,8 +623,6 @@ impl ApplicationExt for App { } } else { //TODO: hide content when out of space - //TODO: container and padding are temporary, until - //the `resize_border` is moved to not cover window content widgets.push( container(main_content.map(crate::Action::App)) .padding(main_content_padding) diff --git a/src/widget/mod.rs b/src/widget/mod.rs index 70fc175f..746292d3 100644 --- a/src/widget/mod.rs +++ b/src/widget/mod.rs @@ -308,10 +308,9 @@ pub mod row { } } -mod scrollable; +pub mod scrollable; #[doc(inline)] -pub use scrollable::*; - +pub use scrollable::scrollable; pub mod segmented_button; pub mod segmented_control; diff --git a/src/widget/scrollable.rs b/src/widget/scrollable.rs deleted file mode 100644 index 81ed3533..00000000 --- a/src/widget/scrollable.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2022 System76 -// SPDX-License-Identifier: MPL-2.0 - -use crate::{Element, Renderer}; -use iced::widget; - -pub fn scrollable<'a, Message>( - element: impl Into>, -) -> widget::Scrollable<'a, Message, crate::Theme, Renderer> { - widget::scrollable(element) - .scroller_width(8.0) - .scrollbar_width(8.0) - .scrollbar_padding(8.0) -} diff --git a/src/widget/scrollable/mod.rs b/src/widget/scrollable/mod.rs new file mode 100644 index 00000000..2485edf4 --- /dev/null +++ b/src/widget/scrollable/mod.rs @@ -0,0 +1,6 @@ +// Copyright 2022 System76 +// SPDX-License-Identifier: MPL-2.0 + +mod scrollable; + +pub use scrollable::{horizontal, scrollable, vertical}; diff --git a/src/widget/scrollable/scrollable.rs b/src/widget/scrollable/scrollable.rs new file mode 100644 index 00000000..a3fa4edd --- /dev/null +++ b/src/widget/scrollable/scrollable.rs @@ -0,0 +1,31 @@ +// Copyright 2022 System76 +// SPDX-License-Identifier: MPL-2.0 + +use crate::{Element, Renderer}; +use iced::widget; + +pub fn scrollable<'a, Message>( + element: impl Into>, +) -> widget::Scrollable<'a, Message, crate::Theme, Renderer> { + vertical(element) +} + +pub fn vertical<'a, Message>( + element: impl Into>, +) -> widget::Scrollable<'a, Message, crate::Theme, Renderer> { + widget::scrollable(element) + .scroller_width(8.0) + .scrollbar_width(8.0) + .scrollbar_padding(8.0) +} + +pub fn horizontal<'a, Message>( + element: impl Into>, +) -> widget::Scrollable<'a, Message, crate::Theme, Renderer> { + widget::scrollable(element) + .direction(widget::scrollable::Direction::Horizontal( + widget::scrollable::Scrollbar::new(), + )) + .scroller_width(8.0) + .scrollbar_width(8.0) +}