summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/menu/menu_item_view.cc36
-rw-r--r--views/controls/menu/menu_item_view.h6
2 files changed, 21 insertions, 21 deletions
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index 2734788..5e92186 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -165,7 +165,7 @@ void MenuItemView::SetSelected(bool selected) {
}
void MenuItemView::SetIcon(const SkBitmap& icon, int item_id) {
- MenuItemView* item = GetDescendantByID(item_id);
+ MenuItemView* item = GetMenuItemByID(item_id);
DCHECK(item);
item->SetIcon(icon);
}
@@ -216,6 +216,23 @@ wchar_t MenuItemView::GetMnemonic() {
return 0;
}
+MenuItemView* MenuItemView::GetMenuItemByID(int id) {
+ if (GetCommand() == id)
+ return this;
+ if (!HasSubmenu())
+ return NULL;
+ for (int i = 0; i < GetSubmenu()->GetChildViewCount(); ++i) {
+ View* child = GetSubmenu()->GetChildViewAt(i);
+ if (child->GetID() == MenuItemView::kMenuItemViewID) {
+ MenuItemView* result = static_cast<MenuItemView*>(child)->
+ GetMenuItemByID(id);
+ if (result)
+ return result;
+ }
+ }
+ return NULL;
+}
+
MenuItemView::MenuItemView(MenuItemView* parent,
int command,
MenuItemView::Type type) {
@@ -291,23 +308,6 @@ MenuItemView* MenuItemView::AppendMenuItemInternal(int item_id,
return item;
}
-MenuItemView* MenuItemView::GetDescendantByID(int id) {
- if (GetCommand() == id)
- return this;
- if (!HasSubmenu())
- return NULL;
- for (int i = 0; i < GetSubmenu()->GetChildViewCount(); ++i) {
- View* child = GetSubmenu()->GetChildViewAt(i);
- if (child->GetID() == MenuItemView::kMenuItemViewID) {
- MenuItemView* result = static_cast<MenuItemView*>(child)->
- GetDescendantByID(id);
- if (result)
- return result;
- }
- }
- return NULL;
-}
-
void MenuItemView::DropMenuClosed(bool notify_delegate) {
DCHECK(controller_);
DCHECK(!controller_->IsBlockingRun());
diff --git a/views/controls/menu/menu_item_view.h b/views/controls/menu/menu_item_view.h
index a85e265..c528671 100644
--- a/views/controls/menu/menu_item_view.h
+++ b/views/controls/menu/menu_item_view.h
@@ -218,6 +218,9 @@ class MenuItemView : public View {
has_icons_ = has_icons;
}
+ // Returns the descendant with the specified command.
+ MenuItemView* GetMenuItemByID(int id);
+
protected:
// Creates a MenuItemView. This is used by the various AddXXX methods.
MenuItemView(MenuItemView* parent, int command, Type type);
@@ -240,9 +243,6 @@ class MenuItemView : public View {
const SkBitmap& icon,
Type type);
- // Returns the descendant with the specified command.
- MenuItemView* GetDescendantByID(int id);
-
// Invoked by the MenuController when the menu closes as the result of
// drag and drop run.
void DropMenuClosed(bool notify_delegate);