feat: applet button theme helper

This commit is contained in:
Ashley Wulber 2023-01-05 10:13:45 -05:00 committed by Michael Murphy
parent a36552cba8
commit dc4edb2a4d
3 changed files with 17 additions and 5 deletions

View file

@ -6,4 +6,4 @@ edition = "2021"
publish = false
[dependencies]
libcosmic = { path = "../..", default-features = false, features = ["wayland"] }
libcosmic = { path = "../..", default-features = false, features = ["wayland", "tokio"] }

View file

@ -1,5 +1,5 @@
use cosmic::{
iced::{sctk_settings::InitialSurface, Application},
iced::{wayland::InitialSurface, Application},
settings,
};

View file

@ -1,23 +1,35 @@
use cosmic_panel_config::{PanelAnchor, PanelSize};
use iced::{
alignment::{Horizontal, Vertical},
sctk_settings::InitialSurface,
wayland::InitialSurface,
widget::{self, Container},
Color, Element, Length, Rectangle, Settings,
};
use iced_core::BorderRadius;
use iced_native::command::platform_specific::wayland::{
popup::{SctkPopupSettings, SctkPositioner},
window::SctkWindowSettings,
};
use iced_style::container::Appearance;
use iced_style::{button::StyleSheet, container::Appearance};
use sctk::reexports::protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
use crate::Renderer;
use crate::{theme::Button, Renderer};
pub use cosmic_panel_config;
const APPLET_PADDING: u32 = 8;
pub const APPLET_BUTTON_THEME: Button = Button::Custom {
active: |t| iced_style::button::Appearance {
border_radius: BorderRadius::from(0.0),
..t.active(&Button::Text)
},
hover: |t| iced_style::button::Appearance {
border_radius: BorderRadius::from(0.0),
..t.hovered(&Button::Text)
},
};
#[derive(Debug, Clone)]
pub struct CosmicAppletHelper {
pub size: Size,