OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/notifications/balloon_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/notifications/balloon_view_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 gtk_label_set_ellipsize(GTK_LABEL(source_label_), PANGO_ELLIPSIZE_END); | 261 gtk_label_set_ellipsize(GTK_LABEL(source_label_), PANGO_ELLIPSIZE_END); |
262 GtkWidget* label_alignment = gtk_alignment_new(0, 0.5, 0, 0); | 262 GtkWidget* label_alignment = gtk_alignment_new(0, 0.5, 0, 0); |
263 gtk_alignment_set_padding(GTK_ALIGNMENT(label_alignment), | 263 gtk_alignment_set_padding(GTK_ALIGNMENT(label_alignment), |
264 0, 0, kLeftLabelMargin, 0); | 264 0, 0, kLeftLabelMargin, 0); |
265 gtk_container_add(GTK_CONTAINER(label_alignment), source_label_); | 265 gtk_container_add(GTK_CONTAINER(label_alignment), source_label_); |
266 gtk_box_pack_start(GTK_BOX(shelf_), label_alignment, FALSE, FALSE, 0); | 266 gtk_box_pack_start(GTK_BOX(shelf_), label_alignment, FALSE, FALSE, 0); |
267 | 267 |
268 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 268 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
269 | 269 |
270 // Create a button to dismiss the balloon and add it to the toolbar. | 270 // Create a button to dismiss the balloon and add it to the toolbar. |
271 close_button_.reset(new CustomDrawButton(IDR_TAB_CLOSE, | 271 close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_)); |
272 IDR_TAB_CLOSE_P, | |
273 IDR_TAB_CLOSE_H, | |
274 IDR_TAB_CLOSE)); | |
275 close_button_->SetBackground( | 272 close_button_->SetBackground( |
276 SK_ColorBLACK, | 273 SK_ColorBLACK, |
277 rb.GetImageNamed(IDR_TAB_CLOSE).AsBitmap(), | 274 rb.GetImageNamed(IDR_CLOSE_1).AsBitmap(), |
278 rb.GetImageNamed(IDR_TAB_CLOSE_MASK).AsBitmap()); | 275 rb.GetImageNamed(IDR_CLOSE_1_MASK).AsBitmap()); |
279 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); | 276 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); |
280 g_signal_connect(close_button_->widget(), "clicked", | 277 g_signal_connect(close_button_->widget(), "clicked", |
281 G_CALLBACK(OnCloseButtonThunk), this); | 278 G_CALLBACK(OnCloseButtonThunk), this); |
282 gtk_widget_set_can_focus(close_button_->widget(), FALSE); | 279 gtk_widget_set_can_focus(close_button_->widget(), FALSE); |
283 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.5, 0, 0); | 280 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.5, 0, 0); |
284 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); | 281 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); |
285 gtk_box_pack_end(GTK_BOX(shelf_), close_alignment, FALSE, FALSE, | 282 gtk_box_pack_end(GTK_BOX(shelf_), close_alignment, FALSE, FALSE, |
286 kButtonSpacing); | 283 kButtonSpacing); |
287 | 284 |
288 // Create a button for showing the options menu, and add it to the toolbar. | 285 // Create a button for showing the options menu, and add it to the toolbar. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 weak_factory_.GetWeakPtr(), | 473 weak_factory_.GetWeakPtr(), |
477 false)); | 474 false)); |
478 } | 475 } |
479 } | 476 } |
480 | 477 |
481 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 478 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
482 frame_container_ = NULL; | 479 frame_container_ = NULL; |
483 Close(false); | 480 Close(false); |
484 return FALSE; // Propagate. | 481 return FALSE; // Propagate. |
485 } | 482 } |
OLD | NEW |