| 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_BOOKMARK_UTILS_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 class BookmarkModel; | 12 class BookmarkModel; |
| 13 class BookmarkNode; | 13 class BookmarkNode; |
| 14 class GtkThemeProvider; | 14 class GtkThemeProvider; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace bookmark_utils { | 17 namespace bookmark_utils { |
| 18 | 18 |
| 19 extern const char kBookmarkNode[]; | 19 extern const char kBookmarkNode[]; |
| 20 | 20 |
| 21 // Padding between the image and the label of a bookmark bar button. | 21 // Padding between the image and the label of a bookmark bar button. |
| 22 extern const int kBarButtonPadding; | 22 extern const int kBarButtonPadding; |
| 23 | 23 |
| 24 // These functions do not add a ref to the returned pixbuf, and it should not be | 24 // These functions do not add a ref to the returned pixbuf, and it should not be |
| 25 // unreffed. | 25 // unreffed. |
| 26 GdkPixbuf* GetFolderIcon(); | 26 // If |native| is true, get the GTK_STOCK version of the icon. |
| 27 GdkPixbuf* GetDefaultFavicon(); | 27 GdkPixbuf* GetFolderIcon(bool native); |
| 28 GdkPixbuf* GetDefaultFavicon(bool native); |
| 28 | 29 |
| 29 // Get the image that is used to represent the node. This function adds a ref | 30 // Get the image that is used to represent the node. This function adds a ref |
| 30 // to the returned pixbuf, so it requires a matching call to g_object_unref(). | 31 // to the returned pixbuf, so it requires a matching call to g_object_unref(). |
| 31 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model); | 32 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model, |
| 33 bool native); |
| 32 | 34 |
| 33 // Returns a GtkWindow with a visual hierarchy for passing to | 35 // Returns a GtkWindow with a visual hierarchy for passing to |
| 34 // gtk_drag_set_icon_widget(). | 36 // gtk_drag_set_icon_widget(). |
| 35 GtkWidget* GetDragRepresentation(const BookmarkNode* node, | 37 GtkWidget* GetDragRepresentation(const BookmarkNode* node, |
| 36 BookmarkModel* model, | 38 BookmarkModel* model, |
| 37 GtkThemeProvider* provider); | 39 GtkThemeProvider* provider); |
| 38 | 40 |
| 39 // Helper function that sets visual properties of GtkButton |button| to the | 41 // Helper function that sets visual properties of GtkButton |button| to the |
| 40 // contents of |node|. | 42 // contents of |node|. |
| 41 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, | 43 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, |
| 42 GtkWidget* button, GtkThemeProvider* provider); | 44 GtkWidget* button, GtkThemeProvider* provider); |
| 43 | 45 |
| 44 // Returns the tooltip. | 46 // Returns the tooltip. |
| 45 std::string BuildTooltipFor(const BookmarkNode* node); | 47 std::string BuildTooltipFor(const BookmarkNode* node); |
| 46 | 48 |
| 47 // Returns the "bookmark-node" property of |widget| casted to the correct type. | 49 // Returns the "bookmark-node" property of |widget| casted to the correct type. |
| 48 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); | 50 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); |
| 49 | 51 |
| 50 // This function is a temporary hack to fix fonts on dark system themes. | 52 // Set the colors on |label| as per the theme. |
| 51 // TODO(estade): remove this function. | |
| 52 void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider); | 53 void SetButtonTextColors(GtkWidget* label, GtkThemeProvider* provider); |
| 53 | 54 |
| 54 // Drag and drop. -------------------------------------------------------------- | 55 // Drag and drop. -------------------------------------------------------------- |
| 55 | 56 |
| 56 // Pickle a node into a GtkSelection. | 57 // Pickle a node into a GtkSelection. |
| 57 void WriteBookmarkToSelection(const BookmarkNode* node, | 58 void WriteBookmarkToSelection(const BookmarkNode* node, |
| 58 GtkSelectionData* selection_data, | 59 GtkSelectionData* selection_data, |
| 59 guint target_type, | 60 guint target_type, |
| 60 Profile* profile); | 61 Profile* profile); |
| 61 | 62 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 // will be added whether or not the URL is valid. | 88 // will be added whether or not the URL is valid. |
| 88 bool CreateNewBookmarksFromURIList( | 89 bool CreateNewBookmarksFromURIList( |
| 89 GtkSelectionData* selection_data, | 90 GtkSelectionData* selection_data, |
| 90 BookmarkModel* model, | 91 BookmarkModel* model, |
| 91 const BookmarkNode* parent, | 92 const BookmarkNode* parent, |
| 92 int idx); | 93 int idx); |
| 93 | 94 |
| 94 } // namespace bookmark_utils | 95 } // namespace bookmark_utils |
| 95 | 96 |
| 96 #endif // CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ | 97 #endif // CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ |
| OLD | NEW |