OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/find_bar_gtk.h" | 5 #include "chrome/browser/gtk/find_bar_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/gfx/gtk_util.h" | 9 #include "base/gfx/gtk_util.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 find_text_ = gtk_entry_new(); | 95 find_text_ = gtk_entry_new(); |
96 // Force the text widget height so it lines up with the buttons regardless of | 96 // Force the text widget height so it lines up with the buttons regardless of |
97 // font size. | 97 // font size. |
98 gtk_widget_set_size_request(find_text_, -1, 20); | 98 gtk_widget_set_size_request(find_text_, -1, 20); |
99 gtk_entry_set_has_frame(GTK_ENTRY(find_text_), FALSE); | 99 gtk_entry_set_has_frame(GTK_ENTRY(find_text_), FALSE); |
100 GtkWidget* border_bin = gfx::CreateGtkBorderBin(find_text_, &kBorderColor, | 100 GtkWidget* border_bin = gfx::CreateGtkBorderBin(find_text_, &kBorderColor, |
101 1, 1, 1, 0); | 101 1, 1, 1, 0); |
102 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); | 102 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); |
103 gtk_box_pack_start(GTK_BOX(centering_vbox), border_bin, TRUE, FALSE, 0); | 103 gtk_box_pack_start(GTK_BOX(centering_vbox), border_bin, TRUE, FALSE, 0); |
104 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, 0); | 104 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, 0); |
105 | |
106 } | 105 } |
107 | 106 |
108 void FindBarGtk::Show() { | 107 void FindBarGtk::Show() { |
109 // TODO(tc): This should be an animated slide in. | 108 // TODO(tc): This should be an animated slide in. |
110 gtk_widget_show_all(container_.get()); | 109 gtk_widget_show_all(container_.get()); |
111 gtk_widget_grab_focus(find_text_); | 110 gtk_widget_grab_focus(find_text_); |
112 } | 111 } |
113 | 112 |
114 void FindBarGtk::Hide(bool animate) { | 113 void FindBarGtk::Hide(bool animate) { |
115 // TODO(tc): Animated slide away. | 114 // TODO(tc): Animated slide away. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 button == find_bar->find_next_button_->widget()) { | 195 button == find_bar->find_next_button_->widget()) { |
197 std::string find_text_utf8( | 196 std::string find_text_utf8( |
198 gtk_entry_get_text(GTK_ENTRY(find_bar->find_text_))); | 197 gtk_entry_get_text(GTK_ENTRY(find_bar->find_text_))); |
199 find_bar->find_bar_controller_->web_contents()->StartFinding( | 198 find_bar->find_bar_controller_->web_contents()->StartFinding( |
200 UTF8ToUTF16(find_text_utf8), | 199 UTF8ToUTF16(find_text_utf8), |
201 button == find_bar->find_next_button_->widget()); | 200 button == find_bar->find_next_button_->widget()); |
202 } else { | 201 } else { |
203 NOTREACHED(); | 202 NOTREACHED(); |
204 } | 203 } |
205 } | 204 } |
OLD | NEW |