Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: views/controls/menu/menu_delegate.h

Issue 6811025: Change status button menu implementation from Menu2 to MenuItemView. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Changed refcount guard to use OS_CHROMEOS. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ 5 #ifndef VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_
6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ 6 #define VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "ui/base/dragdrop/drag_drop_types.h" 13 #include "ui/base/dragdrop/drag_drop_types.h"
14 #include "ui/base/dragdrop/os_exchange_data.h" 14 #include "ui/base/dragdrop/os_exchange_data.h"
15 #include "views/controls/menu/menu_item_view.h" 15 #include "views/controls/menu/menu_item_view.h"
16 #include "views/events/event.h" 16 #include "views/events/event.h"
17 17
18 using ui::OSExchangeData; 18 using ui::OSExchangeData;
19 19
20 namespace gfx {
21
22 class Font;
23
24 } // namespace gfx
25
20 namespace views { 26 namespace views {
21 27
22 class DropTargetEvent; 28 class DropTargetEvent;
23 class MenuButton; 29 class MenuButton;
24 30
25 // MenuDelegate -------------------------------------------------------------- 31 // MenuDelegate --------------------------------------------------------------
26 32
27 // Delegate for a menu. This class is used as part of MenuItemView, see it 33 // Delegate for a menu. This class is used as part of MenuItemView, see it
28 // for details. 34 // for details.
29 // TODO(sky): merge this with ui::MenuModel. 35 // TODO(sky): merge this with ui::MenuModel.
(...skipping 16 matching lines...) Expand all
46 }; 52 };
47 53
48 // Whether or not an item should be shown as checked. This is invoked for 54 // Whether or not an item should be shown as checked. This is invoked for
49 // radio buttons and check buttons. 55 // radio buttons and check buttons.
50 virtual bool IsItemChecked(int id) const; 56 virtual bool IsItemChecked(int id) const;
51 57
52 // The string shown for the menu item. This is only invoked when an item is 58 // The string shown for the menu item. This is only invoked when an item is
53 // added with an empty label. 59 // added with an empty label.
54 virtual std::wstring GetLabel(int id) const; 60 virtual std::wstring GetLabel(int id) const;
55 61
62 // The font for the menu item label. Returning NULL selects the default
63 // menu font.
64 virtual const gfx::Font* GetLabelFont(int id) const;
oshima 2011/04/14 17:27:31 const gfx::Font&
rhashimoto 2011/04/14 18:27:04 That wouldn't allow subclasses a convenient way to
oshima 2011/04/15 17:40:12 Ah i see. Hmm, then pointer may be fine. Alternati
rhashimoto 2011/04/15 21:20:27 If we put the default in the base class then subcl
oshima 2011/04/15 22:26:51 My preference is actually above. It guarantees tha
rhashimoto 2011/04/15 23:44:32 Done.
65
56 // The tooltip shown for the menu item. This is invoked when the user 66 // The tooltip shown for the menu item. This is invoked when the user
57 // hovers over the item, and no tooltip text has been set for that item. 67 // hovers over the item, and no tooltip text has been set for that item.
58 virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc); 68 virtual std::wstring GetTooltipText(int id, const gfx::Point& screen_loc);
59 69
60 // If there is an accelerator for the menu item with id |id| it is set in 70 // If there is an accelerator for the menu item with id |id| it is set in
61 // |accelerator| and true is returned. 71 // |accelerator| and true is returned.
62 virtual bool GetAccelerator(int id, Accelerator* accelerator); 72 virtual bool GetAccelerator(int id, Accelerator* accelerator);
63 73
64 // Shows the context menu with the specified id. This is invoked when the 74 // Shows the context menu with the specified id. This is invoked when the
65 // user does the appropriate gesture to show a context menu. The id 75 // user does the appropriate gesture to show a context menu. The id
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 bool* has_mnemonics, 184 bool* has_mnemonics,
175 MenuButton** button); 185 MenuButton** button);
176 186
177 // Returns the max width menus can grow to be. 187 // Returns the max width menus can grow to be.
178 virtual int GetMaxWidthForMenu(); 188 virtual int GetMaxWidthForMenu();
179 }; 189 };
180 190
181 } // namespace views 191 } // namespace views
182 192
183 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_ 193 #endif // VIEWS_CONTROLS_MENU_MENU_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698