| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Give the findbar dialog its unique shape using images. | 111 // Give the findbar dialog its unique shape using images. |
| 112 void SetDialogShape(GtkWidget* widget) { | 112 void SetDialogShape(GtkWidget* widget) { |
| 113 static NineBox* dialog_shape = NULL; | 113 static NineBox* dialog_shape = NULL; |
| 114 if (!dialog_shape) { | 114 if (!dialog_shape) { |
| 115 dialog_shape = new NineBox( | 115 dialog_shape = new NineBox( |
| 116 IDR_FIND_DLG_LEFT_BACKGROUND, | 116 IDR_FIND_DLG_LEFT_BACKGROUND, |
| 117 IDR_FIND_DLG_MIDDLE_BACKGROUND, | 117 IDR_FIND_DLG_MIDDLE_BACKGROUND, |
| 118 IDR_FIND_DLG_RIGHT_BACKGROUND, | 118 IDR_FIND_DLG_RIGHT_BACKGROUND, |
| 119 0, 0, 0, 0, 0, 0); | 119 NULL, NULL, NULL, NULL, NULL, NULL); |
| 120 dialog_shape->ChangeWhiteToTransparent(); | 120 dialog_shape->ChangeWhiteToTransparent(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 dialog_shape->ContourWidget(widget); | 123 dialog_shape->ContourWidget(widget); |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Return a ninebox that will paint the border of the findbar dialog. This is | 126 // Return a ninebox that will paint the border of the findbar dialog. This is |
| 127 // shared across all instances of the findbar. Do not free the returned pointer. | 127 // shared across all instances of the findbar. Do not free the returned pointer. |
| 128 const NineBox* GetDialogBorder() { | 128 const NineBox* GetDialogBorder() { |
| 129 static NineBox* dialog_border = NULL; | 129 static NineBox* dialog_border = NULL; |
| 130 if (!dialog_border) { | 130 if (!dialog_border) { |
| 131 dialog_border = new NineBox( | 131 dialog_border = new NineBox( |
| 132 IDR_FIND_DIALOG_LEFT, | 132 IDR_FIND_DIALOG_LEFT, |
| 133 IDR_FIND_DIALOG_MIDDLE, | 133 IDR_FIND_DIALOG_MIDDLE, |
| 134 IDR_FIND_DIALOG_RIGHT, | 134 IDR_FIND_DIALOG_RIGHT, |
| 135 0, 0, 0, 0, 0, 0); | 135 NULL, NULL, NULL, NULL, NULL, NULL); |
| 136 } | 136 } |
| 137 | 137 |
| 138 return dialog_border; | 138 return dialog_border; |
| 139 } | 139 } |
| 140 | 140 |
| 141 // Like gtk_util::CreateGtkBorderBin, but allows control over the alignment and | 141 // Like gtk_util::CreateGtkBorderBin, but allows control over the alignment and |
| 142 // returns both the event box and the alignment so we can modify it during its | 142 // returns both the event box and the alignment so we can modify it during its |
| 143 // lifetime (i.e. during a theme change). | 143 // lifetime (i.e. during a theme change). |
| 144 void BuildBorder(GtkWidget* child, | 144 void BuildBorder(GtkWidget* child, |
| 145 bool center, | 145 bool center, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, | 505 gtk_widget_modify_text(text_entry_, GTK_STATE_NORMAL, |
| 506 &kEntryTextColor); | 506 &kEntryTextColor); |
| 507 | 507 |
| 508 // Force the text widget height so it lines up with the buttons regardless | 508 // Force the text widget height so it lines up with the buttons regardless |
| 509 // of font size. | 509 // of font size. |
| 510 gtk_widget_set_size_request(content_event_box_, -1, 20); | 510 gtk_widget_set_size_request(content_event_box_, -1, 20); |
| 511 gtk_widget_modify_bg(content_event_box_, GTK_STATE_NORMAL, | 511 gtk_widget_modify_bg(content_event_box_, GTK_STATE_NORMAL, |
| 512 &kEntryBackgroundColor); | 512 &kEntryBackgroundColor); |
| 513 | 513 |
| 514 gtk_alignment_set_padding(GTK_ALIGNMENT(content_alignment_), | 514 gtk_alignment_set_padding(GTK_ALIGNMENT(content_alignment_), |
| 515 0, 0, 0, 0); | 515 0.0, 0.0, 0.0, 0.0); |
| 516 | 516 |
| 517 gtk_widget_modify_bg(border_bin_, GTK_STATE_NORMAL, &kTextBorderColor); | 517 gtk_widget_modify_bg(border_bin_, GTK_STATE_NORMAL, &kTextBorderColor); |
| 518 gtk_widget_modify_bg(border_bin_aa_, GTK_STATE_NORMAL, &kTextBorderColorAA); | 518 gtk_widget_modify_bg(border_bin_aa_, GTK_STATE_NORMAL, &kTextBorderColorAA); |
| 519 | 519 |
| 520 gtk_alignment_set_padding(GTK_ALIGNMENT(border_bin_alignment_), | 520 gtk_alignment_set_padding(GTK_ALIGNMENT(border_bin_alignment_), |
| 521 1, 1, 1, 0); | 521 1, 1, 1, 0); |
| 522 gtk_alignment_set_padding(GTK_ALIGNMENT(border_bin_aa_alignment_), | 522 gtk_alignment_set_padding(GTK_ALIGNMENT(border_bin_aa_alignment_), |
| 523 1, 1, 1, 0); | 523 1, 1, 1, 0); |
| 524 | 524 |
| 525 gtk_misc_set_alignment(GTK_MISC(match_count_label_), 0.5, 1.0); | 525 gtk_misc_set_alignment(GTK_MISC(match_count_label_), 0.5, 1.0); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 793 } |
| 794 | 794 |
| 795 // static | 795 // static |
| 796 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, | 796 gboolean FindBarGtk::OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, |
| 797 FindBarGtk* find_bar) { | 797 FindBarGtk* find_bar) { |
| 798 find_bar->StoreOutsideFocus(); | 798 find_bar->StoreOutsideFocus(); |
| 799 | 799 |
| 800 // Continue propagating the event. | 800 // Continue propagating the event. |
| 801 return FALSE; | 801 return FALSE; |
| 802 } | 802 } |
| OLD | NEW |