summaryrefslogtreecommitdiffstats
path: root/views/controls/menu
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 17:13:25 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 17:13:25 +0000
commit98aa9e2067282f7dd30e63502806b22518e0817b (patch)
treebc2f8a870415dce71c7a491833d6e7ad15671bf2 /views/controls/menu
parentd928570ffba669f58d7c0b7a6d2707c6b702be31 (diff)
downloadchromium_src-98aa9e2067282f7dd30e63502806b22518e0817b.zip
chromium_src-98aa9e2067282f7dd30e63502806b22518e0817b.tar.gz
chromium_src-98aa9e2067282f7dd30e63502806b22518e0817b.tar.bz2
Revert 102512 - views: Factor out MenuListener into its own header file.
R=sky@chromium.org Review URL: http://codereview.chromium.org/7969011 TBR=tfarina@chromium.org Review URL: http://codereview.chromium.org/8018007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu')
-rw-r--r--views/controls/menu/menu_2.cc6
-rw-r--r--views/controls/menu/menu_2.h22
-rw-r--r--views/controls/menu/menu_listener.h25
-rw-r--r--views/controls/menu/menu_wrapper.h8
-rw-r--r--views/controls/menu/native_menu_aura.cc1
-rw-r--r--views/controls/menu/native_menu_gtk.cc1
-rw-r--r--views/controls/menu/native_menu_gtk.h22
-rw-r--r--views/controls/menu/native_menu_linux.cc2
-rw-r--r--views/controls/menu/native_menu_linux.h31
-rw-r--r--views/controls/menu/native_menu_win.cc1
-rw-r--r--views/controls/menu/native_menu_win.h20
11 files changed, 52 insertions, 87 deletions
diff --git a/views/controls/menu/menu_2.cc b/views/controls/menu/menu_2.cc
index accd581..4fa5851 100644
--- a/views/controls/menu/menu_2.cc
+++ b/views/controls/menu/menu_2.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/controls/menu/menu_2.h"
-#include "ui/base/models/menu_model.h"
-#include "views/controls/menu/menu_listener.h"
+#include "base/compiler_specific.h"
+#include "views/controls/menu/menu_wrapper.h"
namespace views {
diff --git a/views/controls/menu/menu_2.h b/views/controls/menu/menu_2.h
index 4460eea..5a93179 100644
--- a/views/controls/menu/menu_2.h
+++ b/views/controls/menu/menu_2.h
@@ -6,9 +6,8 @@
#define VIEWS_CONTROLS_MENU_MENU_2_H_
#pragma once
-#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "ui/gfx/native_widget_types.h"
+#include "ui/base/models/menu_model.h"
#include "views/controls/menu/menu_wrapper.h"
#include "views/views_export.h"
@@ -16,13 +15,10 @@ namespace gfx {
class Point;
}
-namespace ui {
-class MenuModel;
-}
-
namespace views {
class NativeMenuGtk;
+class View;
// A menu. Populated from a model, and relies on a delegate to execute commands.
//
@@ -31,13 +27,6 @@ class NativeMenuGtk;
// ActivatedAt is never invoked.
class VIEWS_EXPORT Menu2 {
public:
- // How the menu is aligned relative to the point it is shown at.
- // The alignment is reversed by menu if text direction is right to left.
- enum Alignment {
- ALIGN_TOPLEFT,
- ALIGN_TOPRIGHT
- };
-
// Creates a new menu populated with the contents of |model|.
// WARNING: this populates the menu on construction by invoking methods on
// the model. As such, it is typically not safe to use this as the model
@@ -47,6 +36,13 @@ class VIEWS_EXPORT Menu2 {
explicit Menu2(ui::MenuModel* model);
virtual ~Menu2();
+ // How the menu is aligned relative to the point it is shown at.
+ // The alignment is reversed by menu if text direction is right to left.
+ enum Alignment {
+ ALIGN_TOPLEFT,
+ ALIGN_TOPRIGHT
+ };
+
// Runs the menu at the specified point. This method blocks until done.
// RunContextMenuAt is the same, but the alignment is the default for a
// context menu.
diff --git a/views/controls/menu/menu_listener.h b/views/controls/menu/menu_listener.h
deleted file mode 100644
index 332eee7..0000000
--- a/views/controls/menu/menu_listener.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef VIEWS_CONTROLS_MENU_MENU_LISTENER_H_
-#define VIEWS_CONTROLS_MENU_MENU_LISTENER_H_
-#pragma once
-
-#include "views/views_export.h"
-
-namespace views {
-
-// An interface for clients that want a notification when a menu is opened.
-class VIEWS_EXPORT MenuListener {
- public:
- // This will be called after the menu has actually opened.
- virtual void OnMenuOpened() = 0;
-
- protected:
- virtual ~MenuListener() {}
-};
-
-} // namespace views
-
-#endif // VIEWS_CONTROLS_MENU_MENU_LISTENER_H_
diff --git a/views/controls/menu/menu_wrapper.h b/views/controls/menu/menu_wrapper.h
index ad171e4..9281e70 100644
--- a/views/controls/menu/menu_wrapper.h
+++ b/views/controls/menu/menu_wrapper.h
@@ -16,7 +16,13 @@ class Point;
namespace views {
class Menu2;
-class MenuListener;
+
+// An interface for clients that want a notification when a menu is opened.
+class MenuListener {
+ public:
+ // This will be called after the menu has actually opened.
+ virtual void OnMenuOpened() = 0;
+};
// An interface that wraps an object that implements a menu.
class VIEWS_EXPORT MenuWrapper {
diff --git a/views/controls/menu/native_menu_aura.cc b/views/controls/menu/native_menu_aura.cc
index 602e9d1..d441712 100644
--- a/views/controls/menu/native_menu_aura.cc
+++ b/views/controls/menu/native_menu_aura.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "views/controls/menu/menu_2.h"
-#include "views/controls/menu/menu_listener.h"
#include "views/controls/menu/menu_wrapper.h"
namespace views {
diff --git a/views/controls/menu/native_menu_gtk.cc b/views/controls/menu/native_menu_gtk.cc
index d661d7f..7e60d45 100644
--- a/views/controls/menu/native_menu_gtk.cc
+++ b/views/controls/menu/native_menu_gtk.cc
@@ -20,7 +20,6 @@
#include "ui/gfx/gtk_util.h"
#include "views/accelerator.h"
#include "views/controls/menu/menu_2.h"
-#include "views/controls/menu/menu_listener.h"
#include "views/controls/menu/nested_dispatcher_gtk.h"
#include "views/views_delegate.h"
#include "views/widget/native_widget_gtk.h"
diff --git a/views/controls/menu/native_menu_gtk.h b/views/controls/menu/native_menu_gtk.h
index 9d90cb5..de9ff7e 100644
--- a/views/controls/menu/native_menu_gtk.h
+++ b/views/controls/menu/native_menu_gtk.h
@@ -8,8 +8,6 @@
#include <gtk/gtk.h>
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/observer_list.h"
#include "ui/base/gtk/gtk_signal.h"
@@ -39,18 +37,18 @@ class NativeMenuGtk : public MenuWrapper,
virtual ~NativeMenuGtk();
// Overridden from MenuWrapper:
- virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE;
- virtual void CancelMenu() OVERRIDE;
- virtual void Rebuild() OVERRIDE;
- virtual void UpdateStates() OVERRIDE;
- virtual gfx::NativeMenu GetNativeMenu() const OVERRIDE;
- virtual MenuAction GetMenuAction() const OVERRIDE;
- virtual void AddMenuListener(MenuListener* listener) OVERRIDE;
- virtual void RemoveMenuListener(MenuListener* listener) OVERRIDE;
- virtual void SetMinimumWidth(int width) OVERRIDE;
+ virtual void RunMenuAt(const gfx::Point& point, int alignment);
+ virtual void CancelMenu();
+ virtual void Rebuild();
+ virtual void UpdateStates();
+ virtual gfx::NativeMenu GetNativeMenu() const;
+ virtual MenuAction GetMenuAction() const;
+ virtual void AddMenuListener(MenuListener* listener);
+ virtual void RemoveMenuListener(MenuListener* listener);
+ virtual void SetMinimumWidth(int width);
// Overriden from MessageLoopForUI::Dispatcher:
- virtual bool Dispatch(GdkEvent* event) OVERRIDE;
+ virtual bool Dispatch(GdkEvent* event);
private:
CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden);
diff --git a/views/controls/menu/native_menu_linux.cc b/views/controls/menu/native_menu_linux.cc
index f1f2b7b..7556874 100644
--- a/views/controls/menu/native_menu_linux.cc
+++ b/views/controls/menu/native_menu_linux.cc
@@ -9,8 +9,6 @@
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/skia_util.h"
#include "views/controls/menu/menu_2.h"
-#include "views/controls/menu/menu_item_view.h"
-#include "views/controls/menu/menu_listener.h"
#include "views/controls/menu/menu_runner.h"
#include "views/controls/menu/submenu_view.h"
diff --git a/views/controls/menu/native_menu_linux.h b/views/controls/menu/native_menu_linux.h
index 131080d..bfec464 100644
--- a/views/controls/menu/native_menu_linux.h
+++ b/views/controls/menu/native_menu_linux.h
@@ -6,10 +6,8 @@
#define VIEWS_CONTROLS_MENU_NATIVE_MENU_LINUX_H_
#pragma once
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
#include "views/controls/menu/menu_delegate.h"
+#include "views/controls/menu/menu_item_view.h"
#include "views/controls/menu/menu_wrapper.h"
namespace ui {
@@ -18,7 +16,6 @@ class MenuModel;
namespace views {
-class MenuItemView;
class MenuRunner;
// A non-GTK implementation of MenuWrapper, used currently for touchui.
@@ -29,21 +26,21 @@ class NativeMenuLinux : public MenuWrapper,
virtual ~NativeMenuLinux();
// Overridden from MenuWrapper:
- virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE;
- virtual void CancelMenu() OVERRIDE;
- virtual void Rebuild() OVERRIDE;
- virtual void UpdateStates() OVERRIDE;
- virtual gfx::NativeMenu GetNativeMenu() const OVERRIDE;
- virtual MenuAction GetMenuAction() const OVERRIDE;
- virtual void AddMenuListener(MenuListener* listener) OVERRIDE;
- virtual void RemoveMenuListener(MenuListener* listener) OVERRIDE;
- virtual void SetMinimumWidth(int width) OVERRIDE;
+ virtual void RunMenuAt(const gfx::Point& point, int alignment);
+ virtual void CancelMenu();
+ virtual void Rebuild();
+ virtual void UpdateStates();
+ virtual gfx::NativeMenu GetNativeMenu() const;
+ virtual MenuAction GetMenuAction() const;
+ virtual void AddMenuListener(MenuListener* listener);
+ virtual void RemoveMenuListener(MenuListener* listener);
+ virtual void SetMinimumWidth(int width);
// Overridden from MenuDelegate:
- virtual bool IsItemChecked(int id) const OVERRIDE;
- virtual bool IsCommandEnabled(int id) const OVERRIDE;
- virtual void ExecuteCommand(int id) OVERRIDE;
- virtual bool GetAccelerator(int id, views::Accelerator* accelerator) OVERRIDE;
+ virtual bool IsItemChecked(int id) const;
+ virtual bool IsCommandEnabled(int id) const;
+ virtual void ExecuteCommand(int id);
+ virtual bool GetAccelerator(int id, views::Accelerator* accelerator);
private:
void AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model);
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index fd82353..55cfefe 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -23,7 +23,6 @@
#include "views/accelerator.h"
#include "views/controls/menu/menu_2.h"
#include "views/controls/menu/menu_config.h"
-#include "views/controls/menu/menu_listener.h"
using gfx::NativeTheme;
diff --git a/views/controls/menu/native_menu_win.h b/views/controls/menu/native_menu_win.h
index 7419196..489cbd3 100644
--- a/views/controls/menu/native_menu_win.h
+++ b/views/controls/menu/native_menu_win.h
@@ -8,8 +8,6 @@
#include <vector>
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "ui/base/models/simple_menu_model.h"
@@ -29,15 +27,15 @@ class VIEWS_EXPORT NativeMenuWin : public MenuWrapper {
virtual ~NativeMenuWin();
// Overridden from MenuWrapper:
- virtual void RunMenuAt(const gfx::Point& point, int alignment) OVERRIDE;
- virtual void CancelMenu() OVERRIDE;
- virtual void Rebuild() OVERRIDE;
- virtual void UpdateStates() OVERRIDE;
- virtual gfx::NativeMenu GetNativeMenu() const OVERRIDE;
- virtual MenuAction GetMenuAction() const OVERRIDE;
- virtual void AddMenuListener(MenuListener* listener) OVERRIDE;
- virtual void RemoveMenuListener(MenuListener* listener) OVERRIDE;
- virtual void SetMinimumWidth(int width) OVERRIDE;
+ virtual void RunMenuAt(const gfx::Point& point, int alignment);
+ virtual void CancelMenu();
+ virtual void Rebuild();
+ virtual void UpdateStates();
+ virtual gfx::NativeMenu GetNativeMenu() const;
+ virtual MenuAction GetMenuAction() const;
+ virtual void AddMenuListener(MenuListener* listener);
+ virtual void RemoveMenuListener(MenuListener* listener);
+ virtual void SetMinimumWidth(int width);
private:
// IMPORTANT: Note about indices.