OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/notifications/balloon_view_gtk.h" | 5 #include "chrome/browser/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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 gtk_alignment_set_padding(GTK_ALIGNMENT(label_alignment), | 260 gtk_alignment_set_padding(GTK_ALIGNMENT(label_alignment), |
261 kShelfVerticalMargin, kShelfVerticalMargin, | 261 kShelfVerticalMargin, kShelfVerticalMargin, |
262 kLeftLabelMargin, 0); | 262 kLeftLabelMargin, 0); |
263 gtk_container_add(GTK_CONTAINER(label_alignment), source_label_); | 263 gtk_container_add(GTK_CONTAINER(label_alignment), source_label_); |
264 gtk_box_pack_start(GTK_BOX(hbox_), label_alignment, FALSE, FALSE, 0); | 264 gtk_box_pack_start(GTK_BOX(hbox_), label_alignment, FALSE, FALSE, 0); |
265 | 265 |
266 // Create a button to dismiss the balloon and add it to the toolbar. | 266 // Create a button to dismiss the balloon and add it to the toolbar. |
267 close_button_.reset(new CustomDrawButton(IDR_BALLOON_CLOSE, | 267 close_button_.reset(new CustomDrawButton(IDR_BALLOON_CLOSE, |
268 IDR_BALLOON_CLOSE_HOVER, | 268 IDR_BALLOON_CLOSE_HOVER, |
269 IDR_BALLOON_CLOSE_HOVER, | 269 IDR_BALLOON_CLOSE_HOVER, |
270 IDR_BALLOON_CLOSE_HOVER)); | 270 0)); |
271 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); | 271 gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); |
272 g_signal_connect(close_button_->widget(), "clicked", | 272 g_signal_connect(close_button_->widget(), "clicked", |
273 G_CALLBACK(OnCloseButtonThunk), this); | 273 G_CALLBACK(OnCloseButtonThunk), this); |
274 GTK_WIDGET_UNSET_FLAGS(close_button_->widget(), GTK_CAN_FOCUS); | 274 GTK_WIDGET_UNSET_FLAGS(close_button_->widget(), GTK_CAN_FOCUS); |
275 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 275 GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
276 gtk_alignment_set_padding(GTK_ALIGNMENT(close_alignment), | 276 gtk_alignment_set_padding(GTK_ALIGNMENT(close_alignment), |
277 kShelfVerticalMargin, kShelfVerticalMargin, | 277 kShelfVerticalMargin, kShelfVerticalMargin, |
278 0, kButtonIconSpacing); | 278 0, kButtonIconSpacing); |
279 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); | 279 gtk_container_add(GTK_CONTAINER(close_alignment), close_button_->widget()); |
280 gtk_box_pack_end(GTK_BOX(hbox_), close_alignment, FALSE, FALSE, 0); | 280 gtk_box_pack_end(GTK_BOX(hbox_), close_alignment, FALSE, FALSE, 0); |
281 | 281 |
282 // Create a button for showing the options menu, and add it to the toolbar. | 282 // Create a button for showing the options menu, and add it to the toolbar. |
283 options_menu_button_.reset(new CustomDrawButton(IDR_BALLOON_WRENCH, | 283 options_menu_button_.reset(new CustomDrawButton(IDR_BALLOON_WRENCH, |
284 IDR_BALLOON_WRENCH_HOVER, | 284 IDR_BALLOON_WRENCH_P, |
285 IDR_BALLOON_WRENCH_HOVER, | 285 IDR_BALLOON_WRENCH_H, |
286 IDR_BALLOON_WRENCH_HOVER)); | 286 0)); |
287 gtk_widget_set_tooltip_text(options_menu_button_->widget(), | 287 gtk_widget_set_tooltip_text(options_menu_button_->widget(), |
288 options_text.c_str()); | 288 options_text.c_str()); |
289 g_signal_connect(options_menu_button_->widget(), "clicked", | 289 g_signal_connect(options_menu_button_->widget(), "clicked", |
290 G_CALLBACK(OnOptionsMenuButtonThunk), this); | 290 G_CALLBACK(OnOptionsMenuButtonThunk), this); |
291 GTK_WIDGET_UNSET_FLAGS(options_menu_button_->widget(), GTK_CAN_FOCUS); | 291 GTK_WIDGET_UNSET_FLAGS(options_menu_button_->widget(), GTK_CAN_FOCUS); |
292 GtkWidget* options_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 292 GtkWidget* options_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
293 gtk_alignment_set_padding(GTK_ALIGNMENT(options_alignment), | 293 gtk_alignment_set_padding(GTK_ALIGNMENT(options_alignment), |
294 kShelfVerticalMargin, kShelfVerticalMargin, | 294 kShelfVerticalMargin, kShelfVerticalMargin, |
295 0, kButtonIconSpacing); | 295 0, kButtonIconSpacing); |
296 gtk_container_add(GTK_CONTAINER(options_alignment), | 296 gtk_container_add(GTK_CONTAINER(options_alignment), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 void BalloonViewImpl::OnOptionsMenuButton(GtkWidget* widget) { | 414 void BalloonViewImpl::OnOptionsMenuButton(GtkWidget* widget) { |
415 options_menu_->PopupAsContext(gtk_get_current_event_time()); | 415 options_menu_->PopupAsContext(gtk_get_current_event_time()); |
416 } | 416 } |
417 | 417 |
418 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { | 418 gboolean BalloonViewImpl::OnDestroy(GtkWidget* widget) { |
419 frame_container_ = NULL; | 419 frame_container_ = NULL; |
420 Close(false); | 420 Close(false); |
421 return FALSE; // Propagate. | 421 return FALSE; // Propagate. |
422 } | 422 } |
OLD | NEW |