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/download_item_gtk.h" | 5 #include "chrome/browser/gtk/download_item_gtk.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
10 #include "app/slide_animation.h" | 10 #include "app/slide_animation.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // static | 471 // static |
472 gboolean DownloadItemGtk::OnMenuButtonPressEvent(GtkWidget* button, | 472 gboolean DownloadItemGtk::OnMenuButtonPressEvent(GtkWidget* button, |
473 GdkEvent* event, | 473 GdkEvent* event, |
474 DownloadItemGtk* item) { | 474 DownloadItemGtk* item) { |
475 // Stop any completion animation. | 475 // Stop any completion animation. |
476 if (item->complete_animation_.get() && | 476 if (item->complete_animation_.get() && |
477 item->complete_animation_->IsAnimating()) { | 477 item->complete_animation_->IsAnimating()) { |
478 item->complete_animation_->End(); | 478 item->complete_animation_->End(); |
479 } | 479 } |
480 | 480 |
481 item->complete_animation_->End(); | |
482 | |
483 // TODO(port): this never puts the button into the "active" state, | 481 // TODO(port): this never puts the button into the "active" state, |
484 // so this may need to be changed. See note in BrowserToolbarGtk. | 482 // so this may need to be changed. See note in BrowserToolbarGtk. |
485 if (event->type == GDK_BUTTON_PRESS) { | 483 if (event->type == GDK_BUTTON_PRESS) { |
486 GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event); | 484 GdkEventButton* event_button = reinterpret_cast<GdkEventButton*>(event); |
487 if (event_button->button == 1) { | 485 if (event_button->button == 1) { |
488 if (item->menu_.get() == NULL) { | 486 if (item->menu_.get() == NULL) { |
489 item->menu_.reset(new DownloadShelfContextMenuGtk( | 487 item->menu_.reset(new DownloadShelfContextMenuGtk( |
490 item->download_model_.get(), item)); | 488 item->download_model_.get(), item)); |
491 } | 489 } |
492 item->menu_->Popup(button, event); | 490 item->menu_->Popup(button, event); |
493 item->menu_showing_ = true; | 491 item->menu_showing_ = true; |
494 gtk_widget_queue_draw(button); | 492 gtk_widget_queue_draw(button); |
495 } | 493 } |
496 } | 494 } |
497 | 495 |
498 return FALSE; | 496 return FALSE; |
499 } | 497 } |
500 | 498 |
501 // static | 499 // static |
502 void DownloadItemGtk::OnShelfResized(GtkWidget *widget, | 500 void DownloadItemGtk::OnShelfResized(GtkWidget *widget, |
503 GtkAllocation *allocation, | 501 GtkAllocation *allocation, |
504 DownloadItemGtk* item) { | 502 DownloadItemGtk* item) { |
505 if (item->hbox_->allocation.x + item->hbox_->allocation.width > | 503 if (item->hbox_->allocation.x + item->hbox_->allocation.width > |
506 item->bounding_widget_->allocation.x) | 504 item->bounding_widget_->allocation.x) |
507 gtk_widget_hide(item->hbox_); | 505 gtk_widget_hide(item->hbox_); |
508 else | 506 else |
509 gtk_widget_show(item->hbox_); | 507 gtk_widget_show(item->hbox_); |
510 } | 508 } |
OLD | NEW |