Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Side by Side Diff: chrome/browser/gtk/bookmark_bar_gtk.h

Issue 200029: Make the bookmark toolbar folders act like a menu bar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lint Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | chrome/common/gtk_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <vector>
11 12
12 #include "app/slide_animation.h" 13 #include "app/slide_animation.h"
13 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
14 #include "chrome/browser/bookmarks/bookmark_model_observer.h" 15 #include "chrome/browser/bookmarks/bookmark_model_observer.h"
16 #include "chrome/browser/gtk/menu_bar_helper.h"
15 #include "chrome/browser/gtk/view_id_util.h" 17 #include "chrome/browser/gtk/view_id_util.h"
16 #include "chrome/common/notification_observer.h" 18 #include "chrome/common/notification_observer.h"
17 #include "chrome/common/notification_registrar.h" 19 #include "chrome/common/notification_registrar.h"
18 #include "chrome/common/owned_widget_gtk.h" 20 #include "chrome/common/owned_widget_gtk.h"
19 21
20 class BookmarkContextMenu; 22 class BookmarkContextMenu;
21 class BookmarkMenuController; 23 class BookmarkMenuController;
22 class Browser; 24 class Browser;
23 class BrowserWindowGtk; 25 class BrowserWindowGtk;
24 class CustomContainerButton; 26 class CustomContainerButton;
25 class PageNavigator; 27 class PageNavigator;
26 class Profile; 28 class Profile;
27 struct GtkThemeProvider; 29 struct GtkThemeProvider;
28 30
29 class BookmarkBarGtk : public AnimationDelegate, 31 class BookmarkBarGtk : public AnimationDelegate,
30 public BookmarkModelObserver, 32 public BookmarkModelObserver,
33 public MenuBarHelper::Delegate,
31 public NotificationObserver { 34 public NotificationObserver {
32 public: 35 public:
33 explicit BookmarkBarGtk(Profile* profile, Browser* browser, 36 explicit BookmarkBarGtk(Profile* profile, Browser* browser,
34 BrowserWindowGtk* window); 37 BrowserWindowGtk* window);
35 virtual ~BookmarkBarGtk(); 38 virtual ~BookmarkBarGtk();
36 39
37 // Resets the profile. This removes any buttons for the current profile and 40 // Resets the profile. This removes any buttons for the current profile and
38 // recreates the models. 41 // recreates the models.
39 void SetProfile(Profile* profile); 42 void SetProfile(Profile* profile);
40 43
(...skipping 28 matching lines...) Expand all
69 // Returns true if the bookmark bar is showing an animation. 72 // Returns true if the bookmark bar is showing an animation.
70 bool IsAnimating(); 73 bool IsAnimating();
71 74
72 // Returns true if the bookmarks bar preference is set to 'always show'. 75 // Returns true if the bookmarks bar preference is set to 'always show'.
73 bool IsAlwaysShown(); 76 bool IsAlwaysShown();
74 77
75 // AnimationDelegate implementation ------------------------------------------ 78 // AnimationDelegate implementation ------------------------------------------
76 virtual void AnimationProgressed(const Animation* animation); 79 virtual void AnimationProgressed(const Animation* animation);
77 virtual void AnimationEnded(const Animation* animation); 80 virtual void AnimationEnded(const Animation* animation);
78 81
82 // MenuBarHelper::Delegate implementation ------------------------------------
83 virtual void PopupForButton(GtkWidget* button);
84 virtual void PopupForButtonNextTo(GtkWidget* button,
85 GtkMenuDirectionType dir);
79 private: 86 private:
80 // Helper function which generates GtkToolItems for |bookmark_toolbar_|. 87 // Helper function which generates GtkToolItems for |bookmark_toolbar_|.
81 void CreateAllBookmarkButtons(); 88 void CreateAllBookmarkButtons();
82 89
83 // Sets the visibility of the instructional text based on whether there are 90 // Sets the visibility of the instructional text based on whether there are
84 // any bookmarks in the bookmark bar node. 91 // any bookmarks in the bookmark bar node.
85 void SetInstructionState(); 92 void SetInstructionState();
86 93
87 // Sets the visibility of the overflow chevron. 94 // Sets the visibility of the overflow chevron.
88 void SetChevronState(); 95 void SetChevronState();
89 96
90 // Helper function which destroys all the bookmark buttons in the GtkToolbar. 97 // Helper function which destroys all the bookmark buttons in the GtkToolbar.
91 void RemoveAllBookmarkButtons(); 98 void RemoveAllBookmarkButtons();
92 99
93 // Returns the number of buttons corresponding to starred urls/groups. This 100 // Returns the number of buttons corresponding to starred urls/groups. This
94 // is equivalent to the number of children the bookmark bar node from the 101 // is equivalent to the number of children the bookmark bar node from the
95 // bookmark bar model has. 102 // bookmark bar model has.
96 int GetBookmarkButtonCount(); 103 int GetBookmarkButtonCount();
97 104
98 // Set the appearance of the overflow button appropriately (either chromium 105 // Set the appearance of the overflow button appropriately (either chromium
99 // style or GTK style). 106 // style or GTK style).
100 void SetOverflowButtonAppearance(); 107 void SetOverflowButtonAppearance();
101 108
102 // Returns the index of the first bookmark that is not visible on the bar. 109 // Returns the index of the first bookmark that is not visible on the bar.
103 // Returns -1 if they are all visible. 110 // Returns -1 if they are all visible.
104 // |extra_space| is how much extra space to give the toolbar during the 111 // |extra_space| is how much extra space to give the toolbar during the
105 // calculation (for the purposes of determining if ditching the chevron 112 // calculation (for the purposes of determining if ditching the chevron
106 // would be a good idea). 113 // would be a good idea).
107 int GetFirstHiddenBookmark(int extra_space); 114 // If non-NULL, |showing_folders| is packed with all the folders that are
115 // showing on the bar.
116 int GetFirstHiddenBookmark(int extra_space,
117 std::vector<GtkWidget*>* showing_folders);
108 118
109 // Overridden from BookmarkModelObserver: 119 // Overridden from BookmarkModelObserver:
110 120
111 // Invoked when the bookmark model has finished loading. Creates a button 121 // Invoked when the bookmark model has finished loading. Creates a button
112 // for each of the children of the root node from the model. 122 // for each of the children of the root node from the model.
113 virtual void Loaded(BookmarkModel* model); 123 virtual void Loaded(BookmarkModel* model);
114 124
115 // Invoked when the model is being deleted. 125 // Invoked when the model is being deleted.
116 virtual void BookmarkModelBeingDeleted(BookmarkModel* model); 126 virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
117 127
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 255
246 // We create a GtkToolbarItem from |dragged_node_| for display. 256 // We create a GtkToolbarItem from |dragged_node_| for display.
247 GtkToolItem* toolbar_drop_item_; 257 GtkToolItem* toolbar_drop_item_;
248 258
249 // Theme provider for building buttons. 259 // Theme provider for building buttons.
250 GtkThemeProvider* theme_provider_; 260 GtkThemeProvider* theme_provider_;
251 261
252 // Whether we should show the instructional text in the bookmark bar. 262 // Whether we should show the instructional text in the bookmark bar.
253 bool show_instructions_; 263 bool show_instructions_;
254 264
265 MenuBarHelper menu_bar_helper_;
266
255 // The last displayed right click menu, or NULL if no menus have been 267 // The last displayed right click menu, or NULL if no menus have been
256 // displayed yet. 268 // displayed yet.
257 scoped_ptr<BookmarkContextMenu> current_context_menu_; 269 scoped_ptr<BookmarkContextMenu> current_context_menu_;
258 270
259 // The last displayed left click menu, or NULL if no menus have been 271 // The last displayed left click menu, or NULL if no menus have been
260 // displayed yet. 272 // displayed yet.
261 scoped_ptr<BookmarkMenuController> current_menu_; 273 scoped_ptr<BookmarkMenuController> current_menu_;
262 274
263 scoped_ptr<SlideAnimation> slide_animation_; 275 scoped_ptr<SlideAnimation> slide_animation_;
264 276
265 NotificationRegistrar registrar_; 277 NotificationRegistrar registrar_;
266 }; 278 };
267 279
268 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ 280 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_bar_gtk.cc » ('j') | chrome/common/gtk_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698