diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 22:49:58 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 22:49:58 +0000 |
commit | 0f28580a84220d218288bfdec6bb689b2e1b8d29 (patch) | |
tree | 2034a137103f04f513b6ab0d4cc3cbb13ccdd30f /app/menus | |
parent | 4a4d141960653d52e80b52c92358b6f19fc21b1b (diff) | |
download | chromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.zip chromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.tar.gz chromium_src-0f28580a84220d218288bfdec6bb689b2e1b8d29.tar.bz2 |
GTK: make tab context menu use tab_menu_model
flesh out some more menu model implementation for MenuGtk
BUG=28977
TEST=menu still works as before
Review URL: http://codereview.chromium.org/523049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/menus')
-rw-r--r-- | app/menus/accelerator_gtk.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/menus/accelerator_gtk.h b/app/menus/accelerator_gtk.h new file mode 100644 index 0000000..ad74b4e --- /dev/null +++ b/app/menus/accelerator_gtk.h @@ -0,0 +1,46 @@ +// Copyright (c) 2009 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 APP_MENUS_ACCELERATOR_GTK_H_ +#define APP_MENUS_ACCELERATOR_GTK_H_ + +#include <gdk/gdk.h> + +#include "app/menus/accelerator.h" +#include "base/keyboard_code_conversion_gtk.h" +#include "base/keyboard_codes_posix.h" + +namespace menus { + +class AcceleratorGtk : public Accelerator { + public: + AcceleratorGtk(base::KeyboardCode key_code, + bool shift_pressed, bool ctrl_pressed, bool alt_pressed) { + key_code_ = key_code; + modifiers_ = 0; + if (shift_pressed) + modifiers_ |= GDK_SHIFT_MASK; + if (ctrl_pressed) + modifiers_ |= GDK_CONTROL_MASK; + if (alt_pressed) + modifiers_ |= GDK_MOD1_MASK; + } + + AcceleratorGtk() { } + virtual ~AcceleratorGtk() { } + + guint GetGdkKeyCode() { + // The second parameter is false because accelerator keys are expressed in + // terms of the non-shift-modified key. + return base::GdkKeyCodeForWindowsKeyCode(GetKeyCode(), false); + } + + GdkModifierType gdk_modifier_type() { + return static_cast<GdkModifierType>(modifiers()); + } +}; + +} + +#endif // APP_MENUS_ACCELERATOR_GTK_H_ |