summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/bookmark_bar_gtk.h
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 01:05:13 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 01:05:13 +0000
commite4eed283dccc643388bc7f211ff008611d5ce997 (patch)
treecd1ac97033792276dadb739b5066a8f7670a1145 /chrome/browser/gtk/bookmark_bar_gtk.h
parent1e744f200179976645ef75859569eaa475b820be (diff)
downloadchromium_src-e4eed283dccc643388bc7f211ff008611d5ce997.zip
chromium_src-e4eed283dccc643388bc7f211ff008611d5ce997.tar.gz
chromium_src-e4eed283dccc643388bc7f211ff008611d5ce997.tar.bz2
Reimplement the bookmark bar to use a GtkToolbar.
Add all bookmark buttons to a GtkToolbar. All bookmark buttons are draggable, though we don't accept drops yet since I still need to figure out how to communicate with the model. Review URL: http://codereview.chromium.org/63099 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13322 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_bar_gtk.h')
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.h56
1 files changed, 52 insertions, 4 deletions
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h
index 003bf4b..53f6beb 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_gtk.h
@@ -15,6 +15,7 @@
class Browser;
class CustomContainerButton;
+class NineBox;
class PageNavigator;
class Profile;
@@ -109,12 +110,41 @@ class BookmarkBarGtk : public BookmarkModelObserver {
}
private:
- CustomContainerButton* CreateBookmarkButton(BookmarkNode* node);
+ GtkWidget* CreateBookmarkButton(BookmarkNode* node);
+ GtkToolItem* CreateBookmarkToolItem(BookmarkNode* node);
std::string BuildTooltip(BookmarkNode* node);
+ void LoadNineboxImages();
+
+ // GtkButton callbacks
+ static gboolean OnButtonPressed(GtkWidget* sender,
+ GdkEventButton* event,
+ BookmarkBarGtk* bar);
static gboolean OnButtonReleased(GtkWidget* sender, GdkEventButton* event,
BookmarkBarGtk* bar);
+ static gboolean OnButtonExpose(GtkWidget* widget, GdkEventExpose* e,
+ BookmarkBarGtk* button);
+ static void OnButtonDragBegin(GtkWidget* widget,
+ GdkDragContext* drag_context,
+ BookmarkBarGtk* bar);
+ static void OnButtonDragEnd(GtkWidget* button,
+ GdkDragContext* drag_context,
+ BookmarkBarGtk* bar);
+
+ // GtkToolbar callbacks
+ static gboolean OnToolbarExpose(GtkWidget* widget, GdkEventExpose* event,
+ BookmarkBarGtk* window);
+ static gboolean OnToolbarDragMotion(GtkToolbar* toolbar,
+ GdkDragContext* context,
+ gint x,
+ gint y,
+ guint time,
+ BookmarkBarGtk* bar);
+ static gboolean OnToolbarDragLeave(GtkToolbar* toolbar,
+ GdkDragContext* context,
+ guint time,
+ BookmarkBarGtk* bar);
Profile* profile_;
@@ -137,12 +167,30 @@ class BookmarkBarGtk : public BookmarkModelObserver {
// A GtkLabel to display when there are no bookmark buttons to display.
GtkWidget* instructions_;
+ // GtkToolbar which contains all the bookmark buttons.
+ OwnedWidgetGtk bookmark_toolbar_;
+
+ // The other bookmarks button.
+ CustomContainerButton* other_bookmarks_button_;
+
+ // Whether we should ignore the next button release event (because we were
+ // dragging).
+ bool ignore_button_release_;
+
+ // The BookmarkNode from the model being dragged. NULL when we aren't
+ // dragging.
+ BookmarkNode* dragged_node_;
+
+ // We create a GtkToolbarItem from |dragged_node_| for display.
+ GtkToolItem* toolbar_drop_item_;
+
// Whether we should show the instructional text in the bookmark bar.
bool show_instructions_;
- // Bookmark buttons. We keep these references so we can deallocate them
- // properly.
- std::vector<CustomContainerButton*> current_bookmark_buttons_;
+ // The theme graphics for when the mouse is over the button.
+ scoped_ptr<NineBox> nine_box_prelight_;
+ // The theme graphics for when the button is clicked.
+ scoped_ptr<NineBox> nine_box_active_;
};
#endif // CHROME_BROWSER_GTK_BOOKMARK_BAR_GTK_H_