| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/menu/native_menu_gtk.h" | 5 #include "views/controls/menu/native_menu_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "app/keyboard_code_conversion_gtk.h" | |
| 12 #include "app/keyboard_codes.h" | |
| 13 #include "app/menus/menu_model.h" | 11 #include "app/menus/menu_model.h" |
| 14 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
| 15 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 16 #include "base/time.h" | 14 #include "base/time.h" |
| 17 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 18 #include "gfx/font.h" | 16 #include "gfx/font.h" |
| 19 #include "gfx/gtk_util.h" | 17 #include "gfx/gtk_util.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "ui/base/keycodes/keyboard_codes.h" |
| 20 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
| 21 #include "views/accelerator.h" | 21 #include "views/accelerator.h" |
| 22 #include "views/controls/menu/menu_2.h" | 22 #include "views/controls/menu/menu_2.h" |
| 23 #include "views/controls/menu/nested_dispatcher_gtk.h" | 23 #include "views/controls/menu/nested_dispatcher_gtk.h" |
| 24 | 24 |
| 25 #if defined(TOUCH_UI) | 25 #if defined(TOUCH_UI) |
| 26 #include "views/focus/accelerator_handler.h" | 26 #include "views/focus/accelerator_handler.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 381 } |
| 382 | 382 |
| 383 if (type == menus::MenuModel::TYPE_SUBMENU) { | 383 if (type == menus::MenuModel::TYPE_SUBMENU) { |
| 384 Menu2* submenu = new Menu2(model_->GetSubmenuModelAt(index)); | 384 Menu2* submenu = new Menu2(model_->GetSubmenuModelAt(index)); |
| 385 static_cast<NativeMenuGtk*>(submenu->wrapper_.get())->set_parent(this); | 385 static_cast<NativeMenuGtk*>(submenu->wrapper_.get())->set_parent(this); |
| 386 g_object_set_data(G_OBJECT(menu_item), "submenu", submenu); | 386 g_object_set_data(G_OBJECT(menu_item), "submenu", submenu); |
| 387 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), | 387 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), |
| 388 submenu->GetNativeMenu()); | 388 submenu->GetNativeMenu()); |
| 389 } | 389 } |
| 390 | 390 |
| 391 views::Accelerator accelerator(app::VKEY_UNKNOWN, false, false, false); | 391 views::Accelerator accelerator(ui::VKEY_UNKNOWN, false, false, false); |
| 392 if (accel_group && model_->GetAcceleratorAt(index, &accelerator)) { | 392 if (accel_group && model_->GetAcceleratorAt(index, &accelerator)) { |
| 393 int gdk_modifiers = 0; | 393 int gdk_modifiers = 0; |
| 394 if (accelerator.IsShiftDown()) | 394 if (accelerator.IsShiftDown()) |
| 395 gdk_modifiers |= GDK_SHIFT_MASK; | 395 gdk_modifiers |= GDK_SHIFT_MASK; |
| 396 if (accelerator.IsCtrlDown()) | 396 if (accelerator.IsCtrlDown()) |
| 397 gdk_modifiers |= GDK_CONTROL_MASK; | 397 gdk_modifiers |= GDK_CONTROL_MASK; |
| 398 if (accelerator.IsAltDown()) | 398 if (accelerator.IsAltDown()) |
| 399 gdk_modifiers |= GDK_MOD1_MASK; | 399 gdk_modifiers |= GDK_MOD1_MASK; |
| 400 gtk_widget_add_accelerator(menu_item, "activate", accel_group, | 400 gtk_widget_add_accelerator(menu_item, "activate", accel_group, |
| 401 app::GdkKeyCodeForWindowsKeyCode(accelerator.GetKeyCode(), false), | 401 app::GdkKeyCodeForWindowsKeyCode(accelerator.GetKeyCode(), false), |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 #if !defined(OS_CHROMEOS) | 558 #if !defined(OS_CHROMEOS) |
| 559 | 559 |
| 560 // static | 560 // static |
| 561 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 561 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
| 562 return new NativeMenuGtk(menu); | 562 return new NativeMenuGtk(menu); |
| 563 } | 563 } |
| 564 | 564 |
| 565 #endif // OS_CHROMEOS | 565 #endif // OS_CHROMEOS |
| 566 | 566 |
| 567 } // namespace views | 567 } // namespace views |
| OLD | NEW |