slint/internal/compiler/widgets/cupertino/menu.slint
FloVanGH be7c125726
menus: fluent style and refactoring (#7723)
* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-02-24 17:01:22 +01:00

73 lines
2.3 KiB
Text

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
import { CupertinoPalette, CupertinoFontSettings } from "styling.slint";
import { MenuBarItemBase, MenuBarBase, MenuFrameBase, MenuItemBase } from "../common/menu-base.slint";
export component MenuBarItem {
in property <MenuEntry> entry <=> base.entry;
callback clicked <=> base.clicked;
min-width: base.min-width;
min-height: base.min-height;
base := MenuBarItemBase {
padding-left: 11px;
padding-right: 11px;
padding-top: 4px;
padding-bottom: 6px;
default-foreground: CupertinoPalette.foreground;
hover-foreground: CupertinoPalette.accent-foreground;
pressed-foreground: CupertinoPalette.accent-foreground;
hover-background: CupertinoPalette.accent-background;
pressed-background: CupertinoPalette.accent-background;
font-size: 14px;
font-weight: 300;
border-radius: 3px;
}
}
export component MenuBar inherits MenuBarBase {
padding: 9px;
spacing: 10px;
min-layout-height: 40px;
}
export component MenuFrame inherits MenuFrameBase {
background: CupertinoPalette.background;
border-radius: 7px;
border-width: 1px;
border-color: CupertinoPalette.border;
padding: 1px;
layout-min-width: 280px;
}
export component MenuItem {
in property <bool> is-current <=> base.is-current;
in property <MenuEntry> entry <=> base.entry;
callback set-current <=> base.set-current;
callback clear-current <=> base.clear-current;
callback activate <=> base.activate;
min-height: max(40px, base.min-height);
HorizontalLayout {
padding: 5px;
base := MenuItemBase {
default-foreground: CupertinoPalette.foreground;
current-foreground: CupertinoPalette.accent-foreground;
current-background: CupertinoPalette.accent-background;
font-size: CupertinoFontSettings.body.font-size;
font-weight: CupertinoFontSettings.body.font-weight;
border-radius: 4px;
padding-left: 11px;
padding-right: 11px;
spacing: 8px;
sub-menu-icon: @image-url("_arrow_forward.svg");
icon-size: 12px;
}
}
}