| 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 Profile; | 14 class Profile; |
| 15 struct GtkThemeProperties; |
| 15 | 16 |
| 16 namespace bookmark_utils { | 17 namespace bookmark_utils { |
| 17 | 18 |
| 18 extern const char kBookmarkNode[]; | 19 extern const char kBookmarkNode[]; |
| 19 | 20 |
| 20 // 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. |
| 21 extern const int kBarButtonPadding; | 22 extern const int kBarButtonPadding; |
| 22 | 23 |
| 23 // 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 |
| 24 // unreffed. | 25 // unreffed. |
| 25 GdkPixbuf* GetFolderIcon(); | 26 GdkPixbuf* GetFolderIcon(); |
| 26 GdkPixbuf* GetDefaultFavicon(); | 27 GdkPixbuf* GetDefaultFavicon(); |
| 27 | 28 |
| 28 // Get the image that is used to represent the node. This function adds a ref | 29 // Get the image that is used to represent the node. This function adds a ref |
| 29 // to the returned pixbuf, so it requires a matching call to g_object_unref(). | 30 // to the returned pixbuf, so it requires a matching call to g_object_unref(). |
| 30 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model); | 31 GdkPixbuf* GetPixbufForNode(const BookmarkNode* node, BookmarkModel* model); |
| 31 | 32 |
| 32 // Returns a GtkWindow with a visual hierarchy for passing to | 33 // Returns a GtkWindow with a visual hierarchy for passing to |
| 33 // gtk_drag_set_icon_widget(). | 34 // gtk_drag_set_icon_widget(). |
| 34 GtkWidget* GetDragRepresentation(const BookmarkNode* node, | 35 GtkWidget* GetDragRepresentation(const BookmarkNode* node, |
| 35 BookmarkModel* model); | 36 BookmarkModel* model, |
| 37 GtkThemeProperties* properties); |
| 36 | 38 |
| 37 // Helper function that sets visual properties of GtkButton |button| to the | 39 // Helper function that sets visual properties of GtkButton |button| to the |
| 38 // contents of |node|. | 40 // contents of |node|. |
| 39 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, | 41 void ConfigureButtonForNode(const BookmarkNode* node, BookmarkModel* model, |
| 40 GtkWidget* button); | 42 GtkWidget* button, GtkThemeProperties* properties); |
| 41 | 43 |
| 42 // Returns the tooltip. | 44 // Returns the tooltip. |
| 43 std::string BuildTooltipFor(const BookmarkNode* node); | 45 std::string BuildTooltipFor(const BookmarkNode* node); |
| 44 | 46 |
| 45 // Returns the "bookmark-node" property of |widget| casted to the correct type. | 47 // Returns the "bookmark-node" property of |widget| casted to the correct type. |
| 46 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); | 48 const BookmarkNode* BookmarkNodeForWidget(GtkWidget* widget); |
| 47 | 49 |
| 48 // This function is a temporary hack to fix fonts on dark system themes. | 50 // This function is a temporary hack to fix fonts on dark system themes. |
| 49 // TODO(estade): remove this function. | 51 // TODO(estade): remove this function. |
| 50 void SetButtonTextColors(GtkWidget* label); | 52 void SetButtonTextColors(GtkWidget* label, GtkThemeProperties* properties); |
| 51 | 53 |
| 52 // Drag and drop. -------------------------------------------------------------- | 54 // Drag and drop. -------------------------------------------------------------- |
| 53 | 55 |
| 54 // Pickle a node into a GtkSelection. | 56 // Pickle a node into a GtkSelection. |
| 55 void WriteBookmarkToSelection(const BookmarkNode* node, | 57 void WriteBookmarkToSelection(const BookmarkNode* node, |
| 56 GtkSelectionData* selection_data, | 58 GtkSelectionData* selection_data, |
| 57 guint target_type, | 59 guint target_type, |
| 58 Profile* profile); | 60 Profile* profile); |
| 59 | 61 |
| 60 // Pickle a vector of nodes into a GtkSelection. | 62 // Pickle a vector of nodes into a GtkSelection. |
| 61 void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, | 63 void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, |
| 62 GtkSelectionData* selection_data, | 64 GtkSelectionData* selection_data, |
| 63 guint target_type, | 65 guint target_type, |
| 64 Profile* profile); | 66 Profile* profile); |
| 65 | 67 |
| 66 // Un-pickle node(s) from a GtkSelection. | 68 // Un-pickle node(s) from a GtkSelection. |
| 67 // The last two arguments are out parameters. | 69 // The last two arguments are out parameters. |
| 68 std::vector<const BookmarkNode*> GetNodesFromSelection( | 70 std::vector<const BookmarkNode*> GetNodesFromSelection( |
| 69 GdkDragContext* context, | 71 GdkDragContext* context, |
| 70 GtkSelectionData* selection_data, | 72 GtkSelectionData* selection_data, |
| 71 guint target_type, | 73 guint target_type, |
| 72 Profile* profile, | 74 Profile* profile, |
| 73 gboolean* delete_selection_data, | 75 gboolean* delete_selection_data, |
| 74 gboolean* dnd_success); | 76 gboolean* dnd_success); |
| 75 | 77 |
| 76 } // namespace bookmark_utils | 78 } // namespace bookmark_utils |
| 77 | 79 |
| 78 #endif // CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ | 80 #endif // CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ |
| OLD | NEW |