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

Unified Diff: views/controls/menu/menu_item_view.h

Issue 6931039: Add MenuItemView API to add and remove items at a particular index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indentation in test code. Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_item_view.h
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
index 308c3e20aafd0a41f63ae966a6ef89be934615d3..8ebc64e05996afd598a55ccb77650a0f91aa67bb 100644
--- a/views/controls/menu/menu_item_view.h
+++ b/views/controls/menu/menu_item_view.h
@@ -7,6 +7,7 @@
#pragma once
#include <string>
+#include <vector>
#if defined(OS_WIN)
#include <windows.h>
@@ -127,7 +128,20 @@ class MenuItemView : public View {
// Hides and cancels the menu. This does nothing if the menu is not open.
void Cancel();
- // Adds an item to this menu.
+ // Add an item to the menu at a specified index. ChildrenChanged() should
+ // called after adding menu items if the menu may be active.
+ MenuItemView* AddMenuItemAt(int index,
+ int item_id,
+ const std::wstring& label,
+ const SkBitmap& icon,
+ Type type);
+
+ // Remove an item from the menu at a specified index.
+ // ChildrenChanged() should be called after removing menu items (whether
+ // the menu may be active or not).
+ void RemoveMenuItemAt(int index);
+
+ // Appends an item to this menu.
// item_id The id of the item, used to identify it in delegate callbacks
// or (if delegate is NULL) to identify the command associated
// with this item with the controller specified in the ctor. Note
@@ -423,6 +437,9 @@ class MenuItemView : public View {
// GetPreferredSize.
gfx::Size pref_size_;
+ // Removed items to be deleted in ChildrenChanged().
+ std::vector<View*> removed_items_;
+
DISALLOW_COPY_AND_ASSIGN(MenuItemView);
};
« no previous file with comments | « views/controls/menu/menu_controller.cc ('k') | views/controls/menu/menu_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698