blob: 0c444989f6d95f79c6270fe79968dab8fb73c65f [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "ui/gfx/image/mojo/image.mojom";
// The types of menu items shown in shelf context and application list menus.
// These values roughly match ui::MenuModel::ItemType (sans TYPE_BUTTON_ITEM).
enum MenuItemType {
COMMAND, // Performs an action when selected.
CHECK, // Can be selected/checked to toggle a boolean state.
RADIO, // Can be selected/checked among a group of choices.
SEPARATOR, // Shows a horizontal line separator.
SUBMENU, // Presents a submenu within another menu.
ACTIONABLE_SUBMENU, // A SUBMENU that is also a COMMAND.
};
// For a separator we have the following types.
enum MenuSeparatorType {
// Normal - top to bottom: Spacing, line, spacing.
NORMAL_SEPARATOR = 0,
// Double thickness - top to bottom: Spacing, line, spacing.
DOUBLE_SEPARATOR,
// Upper - top to bottom: Line, spacing.
UPPER_SEPARATOR,
// Lower - top to bottom: Spacing, line.
LOWER_SEPARATOR,
// Spacing - top to bottom: Spacing only.
SPACING_SEPARATOR,
// Vertical separator within a row.
VERTICAL_SEPARATOR,
// Separator with left padding - top to bottom: Line only,
// horizontal: Starts after left padding.
PADDED_SEPARATOR,
};
// MenuItems are used to populate application menus for shelf items.
// Note: Some menu item types only support a subset of these item features.
// Please update comments below (MenuItemType -> [fields expected for usage])
// when anything changed to MenuItemType or MenuItem.
//
// COMMAND -> [command_id, label, image, enabled, checked].
// CHECK -> [command_id, label, image, enabled, checked].
// RADIO -> [command_id, label, image, enabled, checked, radio_group_id].
// SEPARATOR -> [separator_type].
// SUBMENU -> [command_id, label, image, enabled, submenu].
// ACTIONABLE_SUBMENU -> [command_id, label, image, enabled, submenu].
//
struct MenuItem {
MenuItemType type; // The type of the menu item.
int32 command_id; // The client's arbitrary item command id.
mojo_base.mojom.String16 label; // The string label, may be empty.
gfx.mojom.ImageSkia? image; // The image icon, may be null.
array<MenuItem>? submenu; // The optional nested submenu item list.
bool enabled; // The enabled state.
bool checked; // The checked state.
int64 radio_group_id; // The radio group id.
MenuSeparatorType separator_type; // The separator type.
};
// An interface implemented by clients to handle interaction with menus run in
// Ash.
interface MenuDelegate {
MenuItemActivated(int32 command_id);
};