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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/gfx/gtk_util.h" | 10 #include "base/gfx/gtk_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // color as the border that separates the toolbar from the tab contents. | 122 // color as the border that separates the toolbar from the tab contents. |
123 fixed_.Own(gtk_fixed_new()); | 123 fixed_.Own(gtk_fixed_new()); |
124 border_ = gtk_event_box_new(); | 124 border_ = gtk_event_box_new(); |
125 gtk_widget_set_size_request(border_, 1, 1); | 125 gtk_widget_set_size_request(border_, 1, 1); |
126 gtk_widget_modify_bg(border_, GTK_STATE_NORMAL, &kFrameBorderColor); | 126 gtk_widget_modify_bg(border_, GTK_STATE_NORMAL, &kFrameBorderColor); |
127 | 127 |
128 gtk_fixed_put(GTK_FIXED(widget()), border_, 0, 0); | 128 gtk_fixed_put(GTK_FIXED(widget()), border_, 0, 0); |
129 gtk_fixed_put(GTK_FIXED(widget()), slide_widget(), 0, 0); | 129 gtk_fixed_put(GTK_FIXED(widget()), slide_widget(), 0, 0); |
130 gtk_widget_set_size_request(widget(), -1, 0); | 130 gtk_widget_set_size_request(widget(), -1, 0); |
131 | 131 |
132 close_button_.reset( | 132 close_button_.reset(CustomDrawButton::CloseButton()); |
133 CustomDrawButton::AddBarCloseButton(hbox, kCloseButtonPaddingLeft)); | 133 gtk_util::CenterWidgetInHBox(hbox, close_button_->widget(), false, |
| 134 kCloseButtonPaddingLeft); |
134 g_signal_connect(G_OBJECT(close_button_->widget()), "clicked", | 135 g_signal_connect(G_OBJECT(close_button_->widget()), "clicked", |
135 G_CALLBACK(OnClicked), this); | 136 G_CALLBACK(OnClicked), this); |
136 gtk_widget_set_tooltip_text(close_button_->widget(), | 137 gtk_widget_set_tooltip_text(close_button_->widget(), |
137 l10n_util::GetStringUTF8(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP).c_str()); | 138 l10n_util::GetStringUTF8(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP).c_str()); |
138 | 139 |
139 find_next_button_.reset(new CustomDrawButton(IDR_FINDINPAGE_NEXT, | 140 find_next_button_.reset(new CustomDrawButton(IDR_FINDINPAGE_NEXT, |
140 IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_P)); | 141 IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_H, IDR_FINDINPAGE_NEXT_P)); |
141 g_signal_connect(G_OBJECT(find_next_button_->widget()), "clicked", | 142 g_signal_connect(G_OBJECT(find_next_button_->widget()), "clicked", |
142 G_CALLBACK(OnClicked), this); | 143 G_CALLBACK(OnClicked), this); |
143 gtk_widget_set_tooltip_text(find_next_button_->widget(), | 144 gtk_widget_set_tooltip_text(find_next_button_->widget(), |
(...skipping 30 matching lines...) Expand all Loading... |
174 gtk_box_pack_end(GTK_BOX(content_hbox), match_count_label_, FALSE, FALSE, 0); | 175 gtk_box_pack_end(GTK_BOX(content_hbox), match_count_label_, FALSE, FALSE, 0); |
175 gtk_box_pack_end(GTK_BOX(content_hbox), text_entry_, TRUE, TRUE, 0); | 176 gtk_box_pack_end(GTK_BOX(content_hbox), text_entry_, TRUE, TRUE, 0); |
176 | 177 |
177 // We fake anti-aliasing by having two borders. | 178 // We fake anti-aliasing by having two borders. |
178 GtkWidget* border_bin = gtk_util::CreateGtkBorderBin(content_hbox, | 179 GtkWidget* border_bin = gtk_util::CreateGtkBorderBin(content_hbox, |
179 &kTextBorderColor, | 180 &kTextBorderColor, |
180 1, 1, 1, 0); | 181 1, 1, 1, 0); |
181 GtkWidget* border_bin_aa = gtk_util::CreateGtkBorderBin(border_bin, | 182 GtkWidget* border_bin_aa = gtk_util::CreateGtkBorderBin(border_bin, |
182 &kTextBorderColorAA, | 183 &kTextBorderColorAA, |
183 1, 1, 1, 0); | 184 1, 1, 1, 0); |
184 GtkWidget* centering_vbox = gtk_vbox_new(FALSE, 0); | 185 gtk_util::CenterWidgetInHBox(hbox, border_bin_aa, true, 0); |
185 gtk_box_pack_start(GTK_BOX(centering_vbox), border_bin_aa, TRUE, FALSE, 0); | |
186 gtk_box_pack_end(GTK_BOX(hbox), centering_vbox, FALSE, FALSE, 0); | |
187 | 186 |
188 // We take care to avoid showing the slide animator widget. | 187 // We take care to avoid showing the slide animator widget. |
189 gtk_widget_show_all(container_); | 188 gtk_widget_show_all(container_); |
190 gtk_widget_show(widget()); | 189 gtk_widget_show(widget()); |
191 gtk_widget_show(border_); | 190 gtk_widget_show(border_); |
192 } | 191 } |
193 | 192 |
194 GtkWidget* FindBarGtk::slide_widget() { | 193 GtkWidget* FindBarGtk::slide_widget() { |
195 return slide_widget_->widget(); | 194 return slide_widget_->widget(); |
196 } | 195 } |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } | 415 } |
417 | 416 |
418 // static | 417 // static |
419 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, | 418 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, |
420 FindBarGtk* find_bar) { | 419 FindBarGtk* find_bar) { |
421 find_bar->StoreOutsideFocus(); | 420 find_bar->StoreOutsideFocus(); |
422 | 421 |
423 // Continue propagating the event. | 422 // Continue propagating the event. |
424 return FALSE; | 423 return FALSE; |
425 } | 424 } |
OLD | NEW |