1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/views/controls/menu/menu_config.h"
6 #include "ui/views/controls/menu/menu_delegate.h"
10 MenuDelegate::~MenuDelegate() {}
12 bool MenuDelegate::IsItemChecked(int id) const {
16 string16 MenuDelegate::GetLabel(int id) const {
20 const gfx::Font* MenuDelegate::GetLabelFont(int id) const {
24 bool MenuDelegate::GetBackgroundColor(int command_id,
26 SkColor* override_color) const {
30 bool MenuDelegate::GetForegroundColor(int command_id,
32 SkColor* override_color) const {
36 string16 MenuDelegate::GetTooltipText(int id,
37 const gfx::Point& screen_loc) const {
41 bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) {
45 bool MenuDelegate::ShowContextMenu(MenuItemView* source,
48 ui::MenuSourceType source_type) {
52 bool MenuDelegate::SupportsCommand(int id) const {
56 bool MenuDelegate::IsCommandEnabled(int id) const {
60 bool MenuDelegate::GetContextualLabel(int id, string16* out) const {
64 bool MenuDelegate::ShouldCloseAllMenusOnExecute(int id) {
68 void MenuDelegate::ExecuteCommand(int id, int mouse_event_flags) {
72 bool MenuDelegate::ShouldExecuteCommandWithoutClosingMenu(int id,
77 bool MenuDelegate::IsTriggerableEvent(MenuItemView* source,
79 return e.type() == ui::ET_GESTURE_TAP ||
80 e.type() == ui::ET_GESTURE_TAP_DOWN ||
81 (e.IsMouseEvent() && (e.flags() &
82 (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)));
85 bool MenuDelegate::CanDrop(MenuItemView* menu, const OSExchangeData& data) {
89 bool MenuDelegate::GetDropFormats(
92 std::set<OSExchangeData::CustomFormat>* custom_formats) {
96 bool MenuDelegate::AreDropTypesRequired(MenuItemView* menu) {
100 int MenuDelegate::GetDropOperation(MenuItemView* item,
101 const ui::DropTargetEvent& event,
102 DropPosition* position) {
103 NOTREACHED() << "If you override CanDrop, you need to override this too";
104 return ui::DragDropTypes::DRAG_NONE;
107 int MenuDelegate::OnPerformDrop(MenuItemView* menu,
108 DropPosition position,
109 const ui::DropTargetEvent& event) {
110 NOTREACHED() << "If you override CanDrop, you need to override this too";
111 return ui::DragDropTypes::DRAG_NONE;
114 bool MenuDelegate::CanDrag(MenuItemView* menu) {
118 void MenuDelegate::WriteDragData(MenuItemView* sender, OSExchangeData* data) {
119 NOTREACHED() << "If you override CanDrag, you must override this too.";
122 int MenuDelegate::GetDragOperations(MenuItemView* sender) {
123 NOTREACHED() << "If you override CanDrag, you must override this too.";
127 MenuItemView* MenuDelegate::GetSiblingMenu(MenuItemView* menu,
128 const gfx::Point& screen_point,
129 MenuItemView::AnchorPosition* anchor,
131 MenuButton** button) {
135 int MenuDelegate::GetMaxWidthForMenu(MenuItemView* menu) {
136 // NOTE: this needs to be large enough to accommodate the wrench menu with
141 void MenuDelegate::WillShowMenu(MenuItemView* menu) {
144 void MenuDelegate::WillHideMenu(MenuItemView* menu) {
147 void MenuDelegate::GetHorizontalIconMargins(int command_id,
150 int* right_margin) const {
155 bool MenuDelegate::ShouldReserveSpaceForSubmenuIndicator() const {