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> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual void AnimationEnded(const Animation* animation); | 77 virtual void AnimationEnded(const Animation* animation); |
78 | 78 |
79 private: | 79 private: |
80 // Helper function which generates GtkToolItems for |bookmark_toolbar_|. | 80 // Helper function which generates GtkToolItems for |bookmark_toolbar_|. |
81 void CreateAllBookmarkButtons(); | 81 void CreateAllBookmarkButtons(); |
82 | 82 |
83 // Sets the visibility of the instructional text based on whether there are | 83 // Sets the visibility of the instructional text based on whether there are |
84 // any bookmarks in the bookmark bar node. | 84 // any bookmarks in the bookmark bar node. |
85 void SetInstructionState(); | 85 void SetInstructionState(); |
86 | 86 |
| 87 // Sets the visibility of the overflow chevron. |
| 88 void SetChevronState(); |
| 89 |
87 // Helper function which destroys all the bookmark buttons in the GtkToolbar. | 90 // Helper function which destroys all the bookmark buttons in the GtkToolbar. |
88 void RemoveAllBookmarkButtons(); | 91 void RemoveAllBookmarkButtons(); |
89 | 92 |
90 // Returns the number of buttons corresponding to starred urls/groups. This | 93 // Returns the number of buttons corresponding to starred urls/groups. This |
91 // is equivalent to the number of children the bookmark bar node from the | 94 // is equivalent to the number of children the bookmark bar node from the |
92 // bookmark bar model has. | 95 // bookmark bar model has. |
93 int GetBookmarkButtonCount(); | 96 int GetBookmarkButtonCount(); |
94 | 97 |
| 98 // Set the appearance of the overflow button appropriately (either chromium |
| 99 // style or GTK style). |
| 100 void SetOverflowButtonAppearance(); |
| 101 |
| 102 // Returns the index of the first bookmark that is not visible on the bar. |
| 103 // Returns -1 if they are all visible. |
| 104 // |extra_space| is how much extra space to give the toolbar during the |
| 105 // calculation (for the purposes of determining if ditching the chevron |
| 106 // would be a good idea). |
| 107 int GetFirstHiddenBookmark(int extra_space); |
| 108 |
95 // Overridden from BookmarkModelObserver: | 109 // Overridden from BookmarkModelObserver: |
96 | 110 |
97 // Invoked when the bookmark model has finished loading. Creates a button | 111 // Invoked when the bookmark model has finished loading. Creates a button |
98 // for each of the children of the root node from the model. | 112 // for each of the children of the root node from the model. |
99 virtual void Loaded(BookmarkModel* model); | 113 virtual void Loaded(BookmarkModel* model); |
100 | 114 |
101 // Invoked when the model is being deleted. | 115 // Invoked when the model is being deleted. |
102 virtual void BookmarkModelBeingDeleted(BookmarkModel* model); | 116 virtual void BookmarkModelBeingDeleted(BookmarkModel* model); |
103 | 117 |
104 // Invoked when a node has moved. | 118 // Invoked when a node has moved. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 static gboolean OnToolbarDragMotion(GtkToolbar* toolbar, | 180 static gboolean OnToolbarDragMotion(GtkToolbar* toolbar, |
167 GdkDragContext* context, | 181 GdkDragContext* context, |
168 gint x, | 182 gint x, |
169 gint y, | 183 gint y, |
170 guint time, | 184 guint time, |
171 BookmarkBarGtk* bar); | 185 BookmarkBarGtk* bar); |
172 static void OnToolbarDragLeave(GtkToolbar* toolbar, | 186 static void OnToolbarDragLeave(GtkToolbar* toolbar, |
173 GdkDragContext* context, | 187 GdkDragContext* context, |
174 guint time, | 188 guint time, |
175 BookmarkBarGtk* bar); | 189 BookmarkBarGtk* bar); |
| 190 static void OnToolbarSizeAllocate(GtkWidget* widget, |
| 191 GtkAllocation* allocation, |
| 192 BookmarkBarGtk* bar); |
176 | 193 |
177 // Used for both folder buttons and the toolbar. | 194 // Used for both folder buttons and the toolbar. |
178 static void OnDragReceived(GtkWidget* widget, | 195 static void OnDragReceived(GtkWidget* widget, |
179 GdkDragContext* context, | 196 GdkDragContext* context, |
180 gint x, gint y, | 197 gint x, gint y, |
181 GtkSelectionData* selection_data, | 198 GtkSelectionData* selection_data, |
182 guint target_type, guint time, | 199 guint target_type, guint time, |
183 BookmarkBarGtk* bar); | 200 BookmarkBarGtk* bar); |
184 | 201 |
185 // GtkEventBox callbacks. | 202 // GtkEventBox callbacks. |
(...skipping 22 matching lines...) Expand all Loading... |
208 | 225 |
209 // Used to position all children. | 226 // Used to position all children. |
210 GtkWidget* bookmark_hbox_; | 227 GtkWidget* bookmark_hbox_; |
211 | 228 |
212 // A GtkLabel to display when there are no bookmark buttons to display. | 229 // A GtkLabel to display when there are no bookmark buttons to display. |
213 GtkWidget* instructions_; | 230 GtkWidget* instructions_; |
214 | 231 |
215 // GtkToolbar which contains all the bookmark buttons. | 232 // GtkToolbar which contains all the bookmark buttons. |
216 OwnedWidgetGtk bookmark_toolbar_; | 233 OwnedWidgetGtk bookmark_toolbar_; |
217 | 234 |
| 235 // The button that shows extra bookmarks that don't fit on the bookmark |
| 236 // bar. |
| 237 GtkWidget* overflow_button_; |
| 238 |
218 // The other bookmarks button. | 239 // The other bookmarks button. |
219 GtkWidget* other_bookmarks_button_; | 240 GtkWidget* other_bookmarks_button_; |
220 | 241 |
221 // The BookmarkNode from the model being dragged. NULL when we aren't | 242 // The BookmarkNode from the model being dragged. NULL when we aren't |
222 // dragging. | 243 // dragging. |
223 const BookmarkNode* dragged_node_; | 244 const BookmarkNode* dragged_node_; |
224 | 245 |
225 // We create a GtkToolbarItem from |dragged_node_| for display. | 246 // We create a GtkToolbarItem from |dragged_node_| for display. |
226 GtkToolItem* toolbar_drop_item_; | 247 GtkToolItem* toolbar_drop_item_; |
227 | 248 |
(...skipping 10 matching lines...) Expand all Loading... |
238 // The last displayed left click menu, or NULL if no menus have been | 259 // The last displayed left click menu, or NULL if no menus have been |
239 // displayed yet. | 260 // displayed yet. |
240 scoped_ptr<BookmarkMenuController> current_menu_; | 261 scoped_ptr<BookmarkMenuController> current_menu_; |
241 | 262 |
242 scoped_ptr<SlideAnimation> slide_animation_; | 263 scoped_ptr<SlideAnimation> slide_animation_; |
243 | 264 |
244 NotificationRegistrar registrar_; | 265 NotificationRegistrar registrar_; |
245 }; | 266 }; |
246 | 267 |
247 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ | 268 #endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |