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.
4
5#include "ui/views/controls/menu/menu_config.h"
6#include "ui/views/controls/menu/menu_delegate.h"
7
8namespace views {
9
10MenuDelegate::~MenuDelegate() {}
11
12bool MenuDelegate::IsItemChecked(int id) const {
13  return false;
14}
15
16string16 MenuDelegate::GetLabel(int id) const {
17  return string16();
18}
19
20const gfx::Font* MenuDelegate::GetLabelFont(int id) const {
21  return NULL;
22}
23
24bool MenuDelegate::GetBackgroundColor(int command_id,
25                                      bool is_hovered,
26                                      SkColor* override_color) const {
27  return false;
28}
29
30bool MenuDelegate::GetForegroundColor(int command_id,
31                                      bool is_hovered,
32                                      SkColor* override_color) const {
33  return false;
34}
35
36string16 MenuDelegate::GetTooltipText(int id,
37                                      const gfx::Point& screen_loc) const {
38  return string16();
39}
40
41bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) {
42  return false;
43}
44
45bool MenuDelegate::ShowContextMenu(MenuItemView* source,
46                                   int id,
47                                   const gfx::Point& p,
48                                   ui::MenuSourceType source_type) {
49  return false;
50}
51
52bool MenuDelegate::SupportsCommand(int id) const {
53  return true;
54}
55
56bool MenuDelegate::IsCommandEnabled(int id) const {
57  return true;
58}
59
60bool MenuDelegate::GetContextualLabel(int id, string16* out) const {
61  return false;
62}
63
64bool MenuDelegate::ShouldCloseAllMenusOnExecute(int id) {
65  return true;
66}
67
68void MenuDelegate::ExecuteCommand(int id, int mouse_event_flags) {
69  ExecuteCommand(id);
70}
71
72bool MenuDelegate::ShouldExecuteCommandWithoutClosingMenu(int id,
73                                                          const ui::Event& e) {
74  return false;
75}
76
77bool MenuDelegate::IsTriggerableEvent(MenuItemView* source,
78                                      const ui::Event& e) {
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)));
83}
84
85bool MenuDelegate::CanDrop(MenuItemView* menu, const OSExchangeData& data) {
86  return false;
87}
88
89bool MenuDelegate::GetDropFormats(
90    MenuItemView* menu,
91    int* formats,
92    std::set<OSExchangeData::CustomFormat>* custom_formats) {
93  return false;
94}
95
96bool MenuDelegate::AreDropTypesRequired(MenuItemView* menu) {
97  return false;
98}
99
100int 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;
105}
106
107int 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;
112}
113
114bool MenuDelegate::CanDrag(MenuItemView* menu) {
115  return false;
116}
117
118void MenuDelegate::WriteDragData(MenuItemView* sender, OSExchangeData* data) {
119  NOTREACHED() << "If you override CanDrag, you must override this too.";
120}
121
122int MenuDelegate::GetDragOperations(MenuItemView* sender) {
123  NOTREACHED() << "If you override CanDrag, you must override this too.";
124  return 0;
125}
126
127MenuItemView* MenuDelegate::GetSiblingMenu(MenuItemView* menu,
128                                           const gfx::Point& screen_point,
129                                           MenuItemView::AnchorPosition* anchor,
130                                           bool* has_mnemonics,
131                                           MenuButton** button) {
132  return NULL;
133}
134
135int MenuDelegate::GetMaxWidthForMenu(MenuItemView* menu) {
136  // NOTE: this needs to be large enough to accommodate the wrench menu with
137  // big fonts.
138  return 800;
139}
140
141void MenuDelegate::WillShowMenu(MenuItemView* menu) {
142}
143
144void MenuDelegate::WillHideMenu(MenuItemView* menu) {
145}
146
147void MenuDelegate::GetHorizontalIconMargins(int command_id,
148                                            int icon_size,
149                                            int* left_margin,
150                                            int* right_margin) const {
151  *left_margin = 0;
152  *right_margin = 0;
153}
154
155bool MenuDelegate::ShouldReserveSpaceForSubmenuIndicator() const {
156  return true;
157}
158
159}  // namespace views
160