summaryrefslogtreecommitdiffstats
path: root/views/controls/menu/menu_host_gtk.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 16:55:41 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-31 16:55:41 +0000
commit95685c9c93543056a18adf176d657c77590fb9f6 (patch)
treeeb8f4cd894bfd84129989ee1dab8331f249e0ca8 /views/controls/menu/menu_host_gtk.cc
parentd9f43efd11eec33be6e146a5b36c1691d66b39ca (diff)
downloadchromium_src-95685c9c93543056a18adf176d657c77590fb9f6.zip
chromium_src-95685c9c93543056a18adf176d657c77590fb9f6.tar.gz
chromium_src-95685c9c93543056a18adf176d657c77590fb9f6.tar.bz2
Make MenuHost concrete, hide platform specific implementation behind NativeMenuHost.
This is the first step, creating this structure. Will consolidate common functionality and state next. BUG=72040 TEST=all menu tests for bookmark bar, wrench menu Review URL: http://codereview.chromium.org/6740022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/menu_host_gtk.cc')
-rw-r--r--views/controls/menu/menu_host_gtk.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc
index 5552fbe..9ec992b9 100644
--- a/views/controls/menu/menu_host_gtk.cc
+++ b/views/controls/menu/menu_host_gtk.cc
@@ -22,24 +22,14 @@
namespace views {
-// static
-MenuHost* MenuHost::Create(SubmenuView* submenu_view) {
- return new MenuHostGtk(submenu_view);
-}
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostGtk, public:
MenuHostGtk::MenuHostGtk(SubmenuView* submenu)
: WidgetGtk(WidgetGtk::TYPE_POPUP),
destroying_(false),
submenu_(submenu),
did_input_grab_(false) {
- GdkEvent* event = gtk_get_current_event();
- if (event) {
- if (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS ||
- event->type == GDK_3BUTTON_PRESS) {
- set_mouse_down(true);
- }
- gdk_event_free(event);
- }
CreateParams params;
params.type = CreateParams::TYPE_MENU;
params.has_dropshadow = true;
@@ -49,6 +39,9 @@ MenuHostGtk::MenuHostGtk(SubmenuView* submenu)
MenuHostGtk::~MenuHostGtk() {
}
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostGtk, NativeMenuHost implementation:
+
void MenuHostGtk::InitMenuHost(gfx::NativeWindow parent,
const gfx::Rect& bounds,
View* contents_view,
@@ -103,6 +96,9 @@ gfx::NativeWindow MenuHostGtk::GetMenuHostWindow() {
return GTK_WINDOW(GetNativeView());
}
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostGtk, WidgetGtk overrides:
+
RootView* MenuHostGtk::CreateRootView() {
return new MenuHostRootView(this, submenu_);
}
@@ -152,6 +148,9 @@ void MenuHostGtk::HandleGtkGrabBroke() {
WidgetGtk::HandleGtkGrabBroke();
}
+////////////////////////////////////////////////////////////////////////////////
+// MenuHostGtk, private:
+
void MenuHostGtk::DoCapture() {
DCHECK(!did_input_grab_);
@@ -201,4 +200,12 @@ void MenuHostGtk::CancelAllIfNoDrag() {
menu_controller->CancelAll();
}
+////////////////////////////////////////////////////////////////////////////////
+// NativeMenuHost, public:
+
+// static
+NativeMenuHost* NativeMenuHost::CreateNativeMenuHost(SubmenuView* submenu) {
+ return new MenuHostGtk(submenu);
+}
+
} // namespace views