improv: add window border

This commit is contained in:
Vukašin Vojinović 2024-11-03 19:16:37 +01:00 committed by Michael Murphy
parent 36b3cfa13a
commit 127ce17b85
26 changed files with 130 additions and 114 deletions

View file

@ -1,14 +1,15 @@
use crate::Theme;
use cosmic_theme::LayeredTheme;
use iced::widget::Container;
use iced_core::alignment;
use iced_core::event::{self, Event};
use iced_core::layout;
use iced_core::mouse;
use iced_core::overlay;
use iced_core::renderer;
use iced_core::widget::Tree;
use iced_core::{Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget};
use iced_core::{
Alignment, Clipboard, Element, Layout, Length, Padding, Rectangle, Shell, Vector, Widget,
};
pub use iced_widget::container::{Catalog, Style};
pub fn layer_container<'a, Message: 'static, E>(
@ -96,14 +97,14 @@ where
/// Sets the content alignment for the horizontal axis of the [`LayerContainer`].
#[must_use]
pub fn align_x(mut self, alignment: alignment::Horizontal) -> Self {
pub fn align_x(mut self, alignment: Alignment) -> Self {
self.container = self.container.align_x(alignment);
self
}
/// Sets the content alignment for the vertical axis of the [`LayerContainer`].
#[must_use]
pub fn align_y(mut self, alignment: alignment::Vertical) -> Self {
pub fn align_y(mut self, alignment: Alignment) -> Self {
self.container = self.container.align_y(alignment);
self
}
@ -122,6 +123,13 @@ where
self
}
/// Centers the contents in the horizontal and vertical axis of the [`Container`].
#[must_use]
pub fn center(mut self, length: Length) -> Self {
self.container = self.container.center(length);
self
}
/// Sets the style of the [`LayerContainer`].
#[must_use]
pub fn class(mut self, style: impl Into<crate::style::iced::Container<'a>>) -> Self {