OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/find_bar_gtk.h" | 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 34 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
35 #include "chrome/common/chrome_notification_types.h" | 35 #include "chrome/common/chrome_notification_types.h" |
36 #include "content/browser/renderer_host/render_view_host.h" | 36 #include "content/browser/renderer_host/render_view_host.h" |
37 #include "content/browser/tab_contents/tab_contents.h" | 37 #include "content/browser/tab_contents/tab_contents.h" |
38 #include "content/common/native_web_keyboard_event.h" | 38 #include "content/common/native_web_keyboard_event.h" |
39 #include "content/common/notification_service.h" | 39 #include "content/common/notification_service.h" |
40 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
41 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
42 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
43 #include "grit/theme_resources_standard.h" | 43 #include "grit/theme_resources_standard.h" |
| 44 #include "ui/base/gtk/gtk_hig_constants.h" |
44 #include "ui/base/l10n/l10n_util.h" | 45 #include "ui/base/l10n/l10n_util.h" |
45 #include "ui/base/resource/resource_bundle.h" | 46 #include "ui/base/resource/resource_bundle.h" |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
49 // Used as the color of the text in the entry box and the text for the results | 50 // Used as the color of the text in the entry box and the text for the results |
50 // label for failure searches. | 51 // label for failure searches. |
51 const GdkColor kEntryTextColor = gtk_util::kGdkBlack; | 52 const GdkColor kEntryTextColor = ui::kGdkBlack; |
52 | 53 |
53 // Used as the color of the background of the entry box and the background of | 54 // Used as the color of the background of the entry box and the background of |
54 // the find label for successful searches. | 55 // the find label for successful searches. |
55 const GdkColor kEntryBackgroundColor = gtk_util::kGdkWhite; | 56 const GdkColor kEntryBackgroundColor = ui::kGdkWhite; |
56 const GdkColor kFindFailureBackgroundColor = GDK_COLOR_RGB(255, 102, 102); | 57 const GdkColor kFindFailureBackgroundColor = GDK_COLOR_RGB(255, 102, 102); |
57 const GdkColor kFindSuccessTextColor = GDK_COLOR_RGB(178, 178, 178); | 58 const GdkColor kFindSuccessTextColor = GDK_COLOR_RGB(178, 178, 178); |
58 | 59 |
59 // Padding around the container. | 60 // Padding around the container. |
60 const int kBarPaddingTopBottom = 4; | 61 const int kBarPaddingTopBottom = 4; |
61 const int kEntryPaddingLeft = 6; | 62 const int kEntryPaddingLeft = 6; |
62 const int kCloseButtonPaddingLeft = 3; | 63 const int kCloseButtonPaddingLeft = 3; |
63 const int kBarPaddingRight = 4; | 64 const int kBarPaddingRight = 4; |
64 | 65 |
65 // The height of the findbar dialog, as dictated by the size of the background | 66 // The height of the findbar dialog, as dictated by the size of the background |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 0, 0, 1, 0); | 495 0, 0, 1, 0); |
495 | 496 |
496 // We need this event box to have its own window in GTK mode for doing the | 497 // We need this event box to have its own window in GTK mode for doing the |
497 // hacky widget rendering. | 498 // hacky widget rendering. |
498 gtk_event_box_set_visible_window(GTK_EVENT_BOX(border_bin_), TRUE); | 499 gtk_event_box_set_visible_window(GTK_EVENT_BOX(border_bin_), TRUE); |
499 gtk_widget_set_app_paintable(border_bin_, TRUE); | 500 gtk_widget_set_app_paintable(border_bin_, TRUE); |
500 | 501 |
501 gtk_misc_set_alignment(GTK_MISC(match_count_label_), 0.5, 0.5); | 502 gtk_misc_set_alignment(GTK_MISC(match_count_label_), 0.5, 0.5); |
502 } else { | 503 } else { |
503 gtk_widget_modify_cursor( | 504 gtk_widget_modify_cursor( |
504 text_entry_, >k_util::kGdkBlack, >k_util::kGdkGray); | 505 text_entry_, &ui::kGdkBlack, &ui::kGdkGray); |
505 gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, | 506 gtk_widget_modify_base(text_entry_, GTK_STATE_NORMAL, |
506 &kEntryBackgroundColor); | 507 &kEntryBackgroundColor); |
507 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, | 508 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, |
508 &kEntryTextColor); | 509 &kEntryTextColor); |
509 | 510 |
510 // Until we switch to vector graphics, force the font size. | 511 // Until we switch to vector graphics, force the font size. |
511 gtk_util::ForceFontSizePixels(text_entry_, 13.4); // 13.4px == 10pt @ 96dpi | 512 gtk_util::ForceFontSizePixels(text_entry_, 13.4); // 13.4px == 10pt @ 96dpi |
512 gtk_util::ForceFontSizePixels(match_count_label_, 13.4); | 513 gtk_util::ForceFontSizePixels(match_count_label_, 13.4); |
513 | 514 |
514 // Force the text widget height so it lines up with the buttons regardless | 515 // Force the text widget height so it lines up with the buttons regardless |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 982 |
982 // static | 983 // static |
983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 984 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
984 FindBarGtk* find_bar) { | 985 FindBarGtk* find_bar) { |
985 g_signal_handlers_disconnect_by_func( | 986 g_signal_handlers_disconnect_by_func( |
986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
988 | 989 |
989 return FALSE; // Continue propagation. | 990 return FALSE; // Continue propagation. |
990 } | 991 } |
OLD | NEW |