cef/libcef/browser/gtk_util_stub.cc
Marshall Greenblatt 7bc494880f Add context menu support (issue #509):
- Add new CefContextMenuHandler, CefContextMenuParams and CefMenuModel classes.
- Add cef_strings.grd and related infrastructure for supporting translation of CEF strings.
- Generate include/cef_pack_resources.h and include/cef_pack_strings.h files at build time that include all IDs used by CEF pack files.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@595 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2012-04-19 20:31:46 +00:00

37 lines
1.1 KiB
C++

// Copyright (c) 2012 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 <gtk/gtk.h>
#include "ui/base/events.h"
// This file includes a selection of methods copied from
// chrome/browser/ui/gtk/gtk_util.cc.
namespace gtk_util {
void SetAlwaysShowImage(GtkWidget* image_menu_item) {
gtk_image_menu_item_set_always_show_image(
GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE);
}
} // namespace gtk_util
namespace event_utils {
int EventFlagsFromGdkState(guint state) {
int flags = 0;
flags |= (state & GDK_LOCK_MASK) ? ui::EF_CAPS_LOCK_DOWN : 0;
flags |= (state & GDK_CONTROL_MASK) ? ui::EF_CONTROL_DOWN : 0;
flags |= (state & GDK_SHIFT_MASK) ? ui::EF_SHIFT_DOWN : 0;
flags |= (state & GDK_MOD1_MASK) ? ui::EF_ALT_DOWN : 0;
flags |= (state & GDK_BUTTON1_MASK) ? ui::EF_LEFT_MOUSE_BUTTON : 0;
flags |= (state & GDK_BUTTON2_MASK) ? ui::EF_MIDDLE_MOUSE_BUTTON : 0;
flags |= (state & GDK_BUTTON3_MASK) ? ui::EF_RIGHT_MOUSE_BUTTON : 0;
return flags;
}
} // namespace event_utils