menu_bar: add min_width/max_width constraints and update examples

This commit is contained in:
Bryan Hyland 2026-02-02 09:49:03 -08:00
parent 6158af1991
commit 7903ee12c0
7 changed files with 191 additions and 55 deletions

View file

@ -160,23 +160,26 @@ pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> El
menu::items(
key_binds,
vec![
menu::Item::Button(
menu::Item::button(
"New window",
Some(cosmic::widget::icon::from_name("screenshot-window-symbolic").into()),
Action::WindowNew,
),
menu::Item::Divider,
menu::Item::Folder(
menu::Item::divider(),
menu::Item::folder(
"View",
vec![menu::Item::CheckBox(
vec![menu::Item::checkbox(
"Hide content",
Some(cosmic::widget::icon::from_name("view-conceal-symbolic").into()),
config.hide_content,
Action::ToggleHideContent,
)],
),
menu::Item::Divider,
menu::Item::Button(
)
.width(280)
.min_width(200)
.max_width(300),
menu::Item::divider(),
menu::Item::button(
"Quit",
Some(cosmic::widget::icon::from_name("window-close-symbolic").into()),
Action::WindowClose,