OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 kSubmenuType | 48 kSubmenuType |
49 }; | 49 }; |
50 | 50 |
51 class PLATFORM_EXPORT ContextMenuItem { | 51 class PLATFORM_EXPORT ContextMenuItem { |
52 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 52 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
53 | 53 |
54 public: | 54 public: |
55 ContextMenuItem(ContextMenuItemType, | 55 ContextMenuItem(ContextMenuItemType, |
56 ContextMenuAction, | 56 ContextMenuAction, |
57 const String& title, | 57 const String& title, |
58 const String& icon, | |
59 ContextMenu* sub_menu = 0); | 58 ContextMenu* sub_menu = 0); |
60 ContextMenuItem(ContextMenuItemType, | 59 ContextMenuItem(ContextMenuItemType, |
61 ContextMenuAction, | 60 ContextMenuAction, |
62 const String& title, | 61 const String& title, |
63 const String& icon, | |
64 bool enabled, | 62 bool enabled, |
65 bool checked); | 63 bool checked); |
66 | 64 |
67 ~ContextMenuItem(); | 65 ~ContextMenuItem(); |
68 | 66 |
69 void SetType(ContextMenuItemType); | 67 void SetType(ContextMenuItemType); |
70 ContextMenuItemType GetType() const; | 68 ContextMenuItemType GetType() const; |
71 | 69 |
72 void SetAction(ContextMenuAction); | 70 void SetAction(ContextMenuAction); |
73 ContextMenuAction Action() const; | 71 ContextMenuAction Action() const; |
74 | 72 |
75 void SetChecked(bool = true); | 73 void SetChecked(bool = true); |
76 bool Checked() const; | 74 bool Checked() const; |
77 | 75 |
78 void SetEnabled(bool = true); | 76 void SetEnabled(bool = true); |
79 bool Enabled() const; | 77 bool Enabled() const; |
80 | 78 |
81 void SetSubMenu(ContextMenu*); | 79 void SetSubMenu(ContextMenu*); |
82 | 80 |
83 ContextMenuItem(ContextMenuAction, | 81 ContextMenuItem(ContextMenuAction, |
84 const String&, | 82 const String&, |
85 bool enabled, | 83 bool enabled, |
86 bool checked, | 84 bool checked, |
87 const Vector<ContextMenuItem>& sub_menu_items); | 85 const Vector<ContextMenuItem>& sub_menu_items); |
88 | 86 |
89 void SetTitle(const String& title) { title_ = title; } | 87 void SetTitle(const String& title) { title_ = title; } |
90 const String& Title() const { return title_; } | 88 const String& Title() const { return title_; } |
91 | 89 |
92 void SetIcon(const String& icon) { icon_ = icon; } | |
93 const String& Icon() const { return icon_; } | |
94 | |
95 const Vector<ContextMenuItem>& SubMenuItems() const { | 90 const Vector<ContextMenuItem>& SubMenuItems() const { |
96 return sub_menu_items_; | 91 return sub_menu_items_; |
97 } | 92 } |
98 | 93 |
99 private: | 94 private: |
100 ContextMenuItemType type_; | 95 ContextMenuItemType type_; |
101 ContextMenuAction action_; | 96 ContextMenuAction action_; |
102 String title_; | 97 String title_; |
103 String icon_; | |
104 bool enabled_; | 98 bool enabled_; |
105 bool checked_; | 99 bool checked_; |
106 Vector<ContextMenuItem> sub_menu_items_; | 100 Vector<ContextMenuItem> sub_menu_items_; |
107 }; | 101 }; |
108 | 102 |
109 } // namespace blink | 103 } // namespace blink |
110 | 104 |
111 #endif // ContextMenuItem_h | 105 #endif // ContextMenuItem_h |
OLD | NEW |