This commit is contained in:
Ashley Wulber 2025-06-10 11:05:29 -04:00
parent 3fd6c4f6bc
commit 3d84fb2a89
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
14 changed files with 203 additions and 177 deletions

View file

@ -177,7 +177,6 @@ impl cosmic::Application for App {
self.hidden = !self.hidden;
}
Message::Surface(a) => {
dbg!("got action...");
return cosmic::task::message(cosmic::Action::Cosmic(
cosmic::app::Action::Surface(a),
));
@ -236,8 +235,6 @@ impl cosmic::Application for App {
}
fn header_start(&self) -> Vec<Element<Self::Message>> {
use cosmic::widget::menu::Tree;
vec![cosmic::widget::responsive_menu_bar().into_element(
self.core(),
&self.keybinds,
@ -300,6 +297,10 @@ impl cosmic::Application for App {
vec![
menu::Item::Button("hi 443", None, Action::Hi2),
menu::Item::Button("hi 4444", None, Action::Hi),
menu::Item::Button("hi 44444", None, Action::Hi3),
menu::Item::Button("hi 444445", None, Action::Hi3),
menu::Item::Button("hi 4444446", None, Action::Hi3),
menu::Item::Button("hi 44444447", None, Action::Hi3),
],
),
],

View file

@ -92,6 +92,7 @@ impl cosmic::Application for App {
|date| Message::DateSelected(date),
|| Message::PrevMonth,
|| Message::NextMonth,
chrono::Weekday::Sun,
);
content = content.push(calendar);

View file

@ -11,4 +11,12 @@ tracing-log = "0.2.0"
[dependencies.libcosmic]
path = "../../"
default-features = false
features = ["debug", "winit", "tokio", "xdg-portal", "multi-window"]
features = [
"debug",
"winit",
"tokio",
"xdg-portal",
"multi-window",
"surface-message",
"wayland",
]

View file

@ -93,7 +93,7 @@ impl cosmic::Application for App {
/// Creates a view after each update.
fn view(&self) -> Element<Self::Message> {
let widget = cosmic::widget::context_menu(
cosmic::widget::button::text(&self.button_label).on_press(Message::Clicked),
cosmic::widget::button::text(self.button_label.to_string()).on_press(Message::Clicked),
self.context_menu(),
);

View file

@ -15,6 +15,7 @@ use cosmic::widget::menu::action::MenuAction;
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::menu::key_bind::Modifier;
use cosmic::widget::menu::{self, ItemHeight, ItemWidth};
use cosmic::widget::RcElementWrapper;
use cosmic::{executor, Element};
/// Runs application with these settings
@ -155,7 +156,7 @@ impl cosmic::Application for App {
pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> Element<'a, Message> {
menu::bar(vec![menu::Tree::with_children(
menu::root("File"),
RcElementWrapper::new(Element::from(menu::root("File"))),
menu::items(
key_binds,
vec![

View file

@ -209,11 +209,11 @@ impl cosmic::Application for App {
if size.width < 600.0 {
widget::compact_table(&self.table_model)
.on_item_left_click(Message::ItemSelect)
.item_context(|item| {
.item_context(move |item| {
Some(widget::menu::items(
&HashMap::new(),
vec![widget::menu::Item::Button(
format!("Action on {}", item.name),
format!("Action on {}", item.name.to_string()),
None,
Action::None,
)],