| 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 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 6 #define CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gfx/native_widget_types.h" | 12 #include "base/gfx/native_widget_types.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 14 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "chrome/common/owned_widget_gtk.h" | 15 #include "chrome/common/owned_widget_gtk.h" |
| 16 | 16 |
| 17 class BaseDownloadItemModel; | 17 class BaseDownloadItemModel; |
| 18 class Browser; | 18 class Browser; |
| 19 class CustomDrawButton; | 19 class CustomDrawButton; |
| 20 class DownloadItemGtk; | 20 class DownloadItemGtk; |
| 21 class GtkThemeProperties; |
| 21 class SlideAnimatorGtk; | 22 class SlideAnimatorGtk; |
| 22 | 23 |
| 23 class DownloadShelfGtk : public DownloadShelf { | 24 class DownloadShelfGtk : public DownloadShelf { |
| 24 public: | 25 public: |
| 25 explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view); | 26 explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view); |
| 26 | 27 |
| 27 ~DownloadShelfGtk(); | 28 ~DownloadShelfGtk(); |
| 28 | 29 |
| 29 // DownloadShelf implementation. | 30 // DownloadShelf implementation. |
| 30 virtual void AddDownload(BaseDownloadItemModel* download_model); | 31 virtual void AddDownload(BaseDownloadItemModel* download_model); |
| 31 virtual bool IsShowing() const; | 32 virtual bool IsShowing() const; |
| 32 virtual bool IsClosing() const; | 33 virtual bool IsClosing() const; |
| 33 virtual void Show(); | 34 virtual void Show(); |
| 34 virtual void Close(); | 35 virtual void Close(); |
| 35 | 36 |
| 36 // Returns the current height of the shelf. | 37 // Returns the current height of the shelf. |
| 37 int GetHeight() const; | 38 int GetHeight() const; |
| 38 | 39 |
| 40 // Changes the color of the background shelf. |
| 41 void UserChangedTheme(GtkThemeProperties* properties); |
| 42 |
| 39 private: | 43 private: |
| 40 // Remove |download_item| from the download shelf and delete it. | 44 // Remove |download_item| from the download shelf and delete it. |
| 41 void RemoveDownloadItem(DownloadItemGtk* download_item); | 45 void RemoveDownloadItem(DownloadItemGtk* download_item); |
| 42 | 46 |
| 43 // Get the leftmost non-download item widget on the shelf. | 47 // Get the leftmost non-download item widget on the shelf. |
| 44 GtkWidget* GetRightBoundingWidget() const; | 48 GtkWidget* GetRightBoundingWidget() const; |
| 45 | 49 |
| 46 // Get the hbox download items ought to pack themselves into. | 50 // Get the hbox download items ought to pack themselves into. |
| 47 GtkWidget* GetHBox() const; | 51 GtkWidget* GetHBox() const; |
| 48 | 52 |
| 49 static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar); | 53 static void OnButtonClick(GtkWidget* button, DownloadShelfGtk* toolbar); |
| 50 | 54 |
| 51 // The top level widget of the shelf. | 55 // The top level widget of the shelf. |
| 52 scoped_ptr<SlideAnimatorGtk> slide_widget_; | 56 scoped_ptr<SlideAnimatorGtk> slide_widget_; |
| 53 | 57 |
| 54 // |hbox_| holds the download items and buttons of the shelf. | 58 // |hbox_| holds the download items and buttons of the shelf. |
| 55 OwnedWidgetGtk hbox_; | 59 OwnedWidgetGtk hbox_; |
| 56 | 60 |
| 57 // |shelf_| is the second highest level widget. See the constructor | 61 // |shelf_| is the second highest level widget. See the constructor |
| 58 // for an explanation of the widget layout. | 62 // for an explanation of the widget layout. |
| 59 OwnedWidgetGtk shelf_; | 63 OwnedWidgetGtk shelf_; |
| 60 | 64 |
| 65 // A GtkEventBox which we color. |
| 66 GtkWidget* padding_bg_; |
| 67 |
| 61 // This hbox holds the link text and download icon. It also holds the | 68 // This hbox holds the link text and download icon. It also holds the |
| 62 // distinction of being the leftmost non-download item widget on the shelf. | 69 // distinction of being the leftmost non-download item widget on the shelf. |
| 63 GtkWidget* link_hbox_; | 70 GtkWidget* link_hbox_; |
| 64 | 71 |
| 65 // The 'x' that the user can press to hide the download shelf. | 72 // The 'x' that the user can press to hide the download shelf. |
| 66 scoped_ptr<CustomDrawButton> close_button_; | 73 scoped_ptr<CustomDrawButton> close_button_; |
| 67 | 74 |
| 68 // Keeps track of our current hide/show state. | 75 // Keeps track of our current hide/show state. |
| 69 bool is_showing_; | 76 bool is_showing_; |
| 70 | 77 |
| 71 // The download items we have added to our shelf. | 78 // The download items we have added to our shelf. |
| 72 std::vector<DownloadItemGtk*> download_items_; | 79 std::vector<DownloadItemGtk*> download_items_; |
| 73 | 80 |
| 74 friend class DownloadItemGtk; | 81 friend class DownloadItemGtk; |
| 75 }; | 82 }; |
| 76 | 83 |
| 77 #endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ | 84 #endif // CHROME_BROWSER_GTK_DOWNLOAD_SHELF_GTK_H_ |
| OLD | NEW |