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 "chrome/browser/gtk/menu_gtk.h" | 5 #include "chrome/browser/gtk/menu_gtk.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/menus/accelerator_gtk.h" | 10 #include "app/menus/accelerator_gtk.h" |
11 #include "app/menus/menu_model.h" | 11 #include "app/menus/menu_model.h" |
| 12 #include "base/i18n/rtl.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
14 #include "base/stl_util-inl.h" | 15 #include "base/stl_util-inl.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/gtk/gtk_util.h" | 17 #include "chrome/browser/gtk/gtk_util.h" |
17 #include "chrome/browser/gtk/standard_menus.h" | 18 #include "chrome/browser/gtk/standard_menus.h" |
18 #include "gfx/gtk_util.h" | 19 #include "gfx/gtk_util.h" |
19 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
20 | 21 |
21 using gtk_util::ConvertAcceleratorsFromWindowsStyle; | 22 using gtk_util::ConvertAcceleratorsFromWindowsStyle; |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 &screen_rect); | 453 &screen_rect); |
453 | 454 |
454 if (GTK_WIDGET_NO_WINDOW(widget)) { | 455 if (GTK_WIDGET_NO_WINDOW(widget)) { |
455 *x += widget->allocation.x; | 456 *x += widget->allocation.x; |
456 *y += widget->allocation.y; | 457 *y += widget->allocation.y; |
457 } | 458 } |
458 *y += widget->allocation.height; | 459 *y += widget->allocation.height; |
459 | 460 |
460 bool start_align = | 461 bool start_align = |
461 !!g_object_get_data(G_OBJECT(widget), "left-align-popup"); | 462 !!g_object_get_data(G_OBJECT(widget), "left-align-popup"); |
462 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) | 463 if (base::i18n::IsRTL()) |
463 start_align = !start_align; | 464 start_align = !start_align; |
464 | 465 |
465 if (!start_align) | 466 if (!start_align) |
466 *x += widget->allocation.width - menu_req.width; | 467 *x += widget->allocation.width - menu_req.width; |
467 | 468 |
468 *y = CalculateMenuYPosition(&screen_rect, &menu_req, widget, *y); | 469 *y = CalculateMenuYPosition(&screen_rect, &menu_req, widget, *y); |
469 | 470 |
470 *push_in = FALSE; | 471 *push_in = FALSE; |
471 } | 472 } |
472 | 473 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 if (GTK_IS_MENU_ITEM(widget)) { | 567 if (GTK_IS_MENU_ITEM(widget)) { |
567 gtk_widget_set_sensitive(widget, menu->IsCommandEnabled(model, id)); | 568 gtk_widget_set_sensitive(widget, menu->IsCommandEnabled(model, id)); |
568 | 569 |
569 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)); | 570 GtkWidget* submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget)); |
570 if (submenu) { | 571 if (submenu) { |
571 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo, | 572 gtk_container_foreach(GTK_CONTAINER(submenu), &SetMenuItemInfo, |
572 userdata); | 573 userdata); |
573 } | 574 } |
574 } | 575 } |
575 } | 576 } |
OLD | NEW |