| 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/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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 close_button_.reset(new CustomDrawButton(IDR_TAB_CLOSE, | 280 close_button_.reset(new CustomDrawButton(IDR_TAB_CLOSE, |
| 281 IDR_TAB_CLOSE_P, | 281 IDR_TAB_CLOSE_P, |
| 282 IDR_TAB_CLOSE_H, | 282 IDR_TAB_CLOSE_H, |
| 283 IDR_TAB_CLOSE)); | 283 IDR_TAB_CLOSE)); |
| 284 close_button_->SetBackground(SK_ColorBLACK, | 284 close_button_->SetBackground(SK_ColorBLACK, |
| 285 rb.GetBitmapNamed(IDR_TAB_CLOSE), | 285 rb.GetBitmapNamed(IDR_TAB_CLOSE), |
| 286 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); | 286 rb.GetBitmapNamed(IDR_TAB_CLOSE_MASK)); |
| 287 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); | 287 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); |
| 288 g_signal_connect(close_button_->widget(), "clicked", | 288 g_signal_connect(close_button_->widget(), "clicked", |
| 289 G_CALLBACK(OnCloseButtonThunk), this); | 289 G_CALLBACK(OnCloseButtonThunk), this); |
| 290 gtk_widget_set_can_focus(close_button_->widget(), FALSE); | 290 GTK_WIDGET_UNSET_FLAGS(close_button_->widget(), GTK_CAN_FOCUS); |
| 291 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 291 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 292 gtk_alignment_set_padding(GTK_ALIGNMENT(close_alignment), | 292 gtk_alignment_set_padding(GTK_ALIGNMENT(close_alignment), |
| 293 kShelfVerticalMargin, kShelfVerticalMargin, | 293 kShelfVerticalMargin, kShelfVerticalMargin, |
| 294 0, kButtonSpacing); | 294 0, kButtonSpacing); |
| 295 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); | 295 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); |
| 296 gtk_box_pack_end(GTK_BOX(hbox_), close_alignment, FALSE, FALSE, 0); | 296 gtk_box_pack_end(GTK_BOX(hbox_), close_alignment, FALSE, FALSE, 0); |
| 297 | 297 |
| 298 // Create a button for showing the options menu, and add it to the toolbar. | 298 // Create a button for showing the options menu, and add it to the toolbar. |
| 299 options_menu_button_.reset(new CustomDrawButton(IDR_BALLOON_WRENCH, | 299 options_menu_button_.reset(new CustomDrawButton(IDR_BALLOON_WRENCH, |
| 300 IDR_BALLOON_WRENCH_P, | 300 IDR_BALLOON_WRENCH_P, |
| 301 IDR_BALLOON_WRENCH_H, | 301 IDR_BALLOON_WRENCH_H, |
| 302 0)); | 302 0)); |
| 303 gtk_widget_set_tooltip_text(options_menu_button_->widget(), | 303 gtk_widget_set_tooltip_text(options_menu_button_->widget(), |
| 304 options_text.c_str()); | 304 options_text.c_str()); |
| 305 g_signal_connect(options_menu_button_->widget(), "button-press-event", | 305 g_signal_connect(options_menu_button_->widget(), "button-press-event", |
| 306 G_CALLBACK(OnOptionsMenuButtonThunk), this); | 306 G_CALLBACK(OnOptionsMenuButtonThunk), this); |
| 307 gtk_widget_set_can_focus(options_menu_button_->widget(), FALSE); | 307 GTK_WIDGET_UNSET_FLAGS(options_menu_button_->widget(), GTK_CAN_FOCUS); |
| 308 GtkWidget* options_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 308 GtkWidget* options_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
| 309 gtk_alignment_set_padding(GTK_ALIGNMENT(options_alignment), | 309 gtk_alignment_set_padding(GTK_ALIGNMENT(options_alignment), |
| 310 kShelfVerticalMargin, kShelfVerticalMargin, | 310 kShelfVerticalMargin, kShelfVerticalMargin, |
| 311 0, kButtonSpacing); | 311 0, kButtonSpacing); |
| 312 gtk_container_add(GTK_CONTAINER(options_alignment), | 312 gtk_container_add(GTK_CONTAINER(options_alignment), |
| 313 options_menu_button_->widget()); | 313 options_menu_button_->widget()); |
| 314 gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); | 314 gtk_box_pack_end(GTK_BOX(hbox_), options_alignment, FALSE, FALSE, 0); |
| 315 | 315 |
| 316 notification_registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 316 notification_registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, |
| 317 Source<ThemeService>(theme_service_)); | 317 Source<ThemeService>(theme_service_)); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 method_factory_.NewRunnableMethod( | 471 method_factory_.NewRunnableMethod( |
| 472 &BalloonViewImpl::DelayedClose, false)); | 472 &BalloonViewImpl::DelayedClose, false)); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| 476 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 476 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
| 477 frame_container_ = NULL; | 477 frame_container_ = NULL; |
| 478 Close(false); | 478 Close(false); |
| 479 return FALSE; // Propagate. | 479 return FALSE; // Propagate. |
| 480 } | 480 } |
| OLD | NEW |