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