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_BAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
6 #define CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "app/slide_animation.h" | 12 #include "app/slide_animation.h" |
13 #include "chrome/common/owned_widget_gtk.h" | 13 #include "chrome/common/owned_widget_gtk.h" |
14 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
15 | 15 |
16 class BookmarkContextMenu; | 16 class BookmarkContextMenu; |
17 class BookmarkMenuController; | 17 class BookmarkMenuController; |
18 class Browser; | 18 class Browser; |
19 class BrowserWindowGtk; | 19 class BrowserWindowGtk; |
20 class CustomContainerButton; | 20 class CustomContainerButton; |
21 class NineBox; | 21 class NineBox; |
22 class PageNavigator; | 22 class PageNavigator; |
23 class Profile; | 23 class Profile; |
| 24 struct GtkThemeProperties; |
24 | 25 |
25 class BookmarkBarGtk : public AnimationDelegate, | 26 class BookmarkBarGtk : public AnimationDelegate, |
26 public BookmarkModelObserver { | 27 public BookmarkModelObserver { |
27 public: | 28 public: |
28 explicit BookmarkBarGtk(Profile* profile, Browser* browser, | 29 explicit BookmarkBarGtk(Profile* profile, Browser* browser, |
29 BrowserWindowGtk* window); | 30 BrowserWindowGtk* window); |
30 virtual ~BookmarkBarGtk(); | 31 virtual ~BookmarkBarGtk(); |
31 | 32 |
32 // Resets the profile. This removes any buttons for the current profile and | 33 // Resets the profile. This removes any buttons for the current profile and |
33 // recreates the models. | 34 // recreates the models. |
(...skipping 27 matching lines...) Expand all Loading... |
61 // Get the current height of the bookmark bar. | 62 // Get the current height of the bookmark bar. |
62 int GetHeight(); | 63 int GetHeight(); |
63 | 64 |
64 // Returns true if the bookmark bar is showing the close animation. | 65 // Returns true if the bookmark bar is showing the close animation. |
65 bool IsClosing(); | 66 bool IsClosing(); |
66 | 67 |
67 // Returns true if the bookmarks bar preference is set to 'always show'. | 68 // Returns true if the bookmarks bar preference is set to 'always show'. |
68 bool IsAlwaysShown(); | 69 bool IsAlwaysShown(); |
69 | 70 |
70 // Alerts us that the theme changed, and we might need to change theme images. | 71 // Alerts us that the theme changed, and we might need to change theme images. |
71 void UserChangedTheme(Profile* profile); | 72 void UserChangedTheme(GtkThemeProperties* properties); |
72 | 73 |
73 // AnimationDelegate implementation ------------------------------------------ | 74 // AnimationDelegate implementation ------------------------------------------ |
74 virtual void AnimationProgressed(const Animation* animation); | 75 virtual void AnimationProgressed(const Animation* animation); |
75 virtual void AnimationEnded(const Animation* animation); | 76 virtual void AnimationEnded(const Animation* animation); |
76 | 77 |
77 private: | 78 private: |
78 // Helper function which generates GtkToolItems for |bookmark_toolbar_|. | 79 // Helper function which generates GtkToolItems for |bookmark_toolbar_|. |
79 void CreateAllBookmarkButtons(const BookmarkNode* node); | 80 void CreateAllBookmarkButtons(const BookmarkNode* node); |
80 | 81 |
81 // Sets the visibility of the instructional text based on whether there are | 82 // Sets the visibility of the instructional text based on whether there are |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 205 |
205 // A GtkLabel to display when there are no bookmark buttons to display. | 206 // A GtkLabel to display when there are no bookmark buttons to display. |
206 GtkWidget* instructions_; | 207 GtkWidget* instructions_; |
207 | 208 |
208 // GtkToolbar which contains all the bookmark buttons. | 209 // GtkToolbar which contains all the bookmark buttons. |
209 OwnedWidgetGtk bookmark_toolbar_; | 210 OwnedWidgetGtk bookmark_toolbar_; |
210 | 211 |
211 // The other bookmarks button. | 212 // The other bookmarks button. |
212 GtkWidget* other_bookmarks_button_; | 213 GtkWidget* other_bookmarks_button_; |
213 | 214 |
| 215 // The label inside |other_bookmarks_button_|. We keep a reference so we can |
| 216 // change the text color. |
| 217 GtkWidget* other_bookmarks_label_; |
| 218 |
214 // Whether we should ignore the next button release event (because we were | 219 // Whether we should ignore the next button release event (because we were |
215 // dragging). | 220 // dragging). |
216 bool ignore_button_release_; | 221 bool ignore_button_release_; |
217 | 222 |
218 // The BookmarkNode from the model being dragged. NULL when we aren't | 223 // The BookmarkNode from the model being dragged. NULL when we aren't |
219 // dragging. | 224 // dragging. |
220 const BookmarkNode* dragged_node_; | 225 const BookmarkNode* dragged_node_; |
221 | 226 |
222 // We create a GtkToolbarItem from |dragged_node_| for display. | 227 // We create a GtkToolbarItem from |dragged_node_| for display. |
223 GtkToolItem* toolbar_drop_item_; | 228 GtkToolItem* toolbar_drop_item_; |
224 | 229 |
225 // Whether we should show the instructional text in the bookmark bar. | 230 // Whether we should show the instructional text in the bookmark bar. |
226 bool show_instructions_; | 231 bool show_instructions_; |
227 | 232 |
228 // The last displayed right click menu, or NULL if no menus have been | 233 // The last displayed right click menu, or NULL if no menus have been |
229 // displayed yet. | 234 // displayed yet. |
230 scoped_ptr<BookmarkContextMenu> current_context_menu_; | 235 scoped_ptr<BookmarkContextMenu> current_context_menu_; |
231 | 236 |
232 // The last displayed left click menu, or NULL if no menus have been | 237 // The last displayed left click menu, or NULL if no menus have been |
233 // displayed yet. | 238 // displayed yet. |
234 scoped_ptr<BookmarkMenuController> current_menu_; | 239 scoped_ptr<BookmarkMenuController> current_menu_; |
235 | 240 |
236 // Paints the background for our bookmark bar. | 241 // Paints the background for our bookmark bar. |
237 scoped_ptr<NineBox> background_ninebox_; | 242 scoped_ptr<NineBox> background_ninebox_; |
238 | 243 |
239 scoped_ptr<SlideAnimation> slide_animation_; | 244 scoped_ptr<SlideAnimation> slide_animation_; |
240 }; | 245 }; |
241 | 246 |
242 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 247 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |