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

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

Issue 149355: Make bookmark bar folder buttons look active so long as the menu is open.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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_menu_controller_gtk.cc » ('j') | no next file with comments »
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_MENU_CONTROLLER_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
6 #define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ 6 #define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 16 matching lines...) Expand all
27 // at index |start_child_index|. 27 // at index |start_child_index|.
28 BookmarkMenuController(Browser* browser, 28 BookmarkMenuController(Browser* browser,
29 Profile* profile, 29 Profile* profile,
30 PageNavigator* page_navigator, 30 PageNavigator* page_navigator,
31 GtkWindow* window, 31 GtkWindow* window,
32 const BookmarkNode* node, 32 const BookmarkNode* node,
33 int start_child_index, 33 int start_child_index,
34 bool show_other_folder); 34 bool show_other_folder);
35 virtual ~BookmarkMenuController(); 35 virtual ~BookmarkMenuController();
36 36
37 // Pops up the menu. 37 // Pops up the menu. |widget| must be a GtkChromeButton.
38 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp); 38 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
39 39
40 // Overridden from BaseBookmarkModelObserver: 40 // Overridden from BaseBookmarkModelObserver:
41 virtual void BookmarkModelChanged(); 41 virtual void BookmarkModelChanged();
42 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, 42 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
43 const BookmarkNode* node); 43 const BookmarkNode* node);
44 44
45 private: 45 private:
46 // Recursively change the bookmark hierarchy rooted in |parent| into a set of 46 // Recursively change the bookmark hierarchy rooted in |parent| into a set of
47 // gtk menus rooted in |menu|. 47 // gtk menus rooted in |menu|.
48 void BuildMenu(const BookmarkNode* parent, 48 void BuildMenu(const BookmarkNode* parent,
49 int start_child_index, 49 int start_child_index,
50 GtkWidget* menu); 50 GtkWidget* menu);
51 51
52 // Calls the page navigator to navigate to the node represented by 52 // Calls the page navigator to navigate to the node represented by
53 // |menu_item|. 53 // |menu_item|.
54 void NavigateToMenuItem(GtkWidget* menu_item, 54 void NavigateToMenuItem(GtkWidget* menu_item,
55 WindowOpenDisposition disposition); 55 WindowOpenDisposition disposition);
56 56
57 // Button press and release events for a GtkMenuItem. We have to override 57 // Button press and release events for a GtkMenuItem. We have to override
58 // these separate from OnMenuItemActivated because we need to handle right 58 // these separate from OnMenuItemActivated because we need to handle right
59 // clicks and opening bookmarks with different dispositions. 59 // clicks and opening bookmarks with different dispositions.
60 static gboolean OnButtonPressed(GtkWidget* sender, 60 static gboolean OnButtonPressed(GtkWidget* sender,
61 GdkEventButton* event, 61 GdkEventButton* event,
62 BookmarkMenuController* controller); 62 BookmarkMenuController* controller);
63 static gboolean OnButtonReleased(GtkWidget* sender, 63 static gboolean OnButtonReleased(GtkWidget* sender,
64 GdkEventButton* event, 64 GdkEventButton* event,
65 BookmarkMenuController* controller); 65 BookmarkMenuController* controller);
66 66
67 // We have to stop drawing |triggering_widget_| as active when the menu
68 // closes.
69 static void OnMenuHidden(GtkWidget* menu, BookmarkMenuController* controller);
70
67 // We respond to the activate signal because things other than mouse button 71 // We respond to the activate signal because things other than mouse button
68 // events can trigger it. 72 // events can trigger it.
69 static void OnMenuItemActivated(GtkMenuItem* menuitem, 73 static void OnMenuItemActivated(GtkMenuItem* menuitem,
70 BookmarkMenuController* controller); 74 BookmarkMenuController* controller);
71 75
72 // The individual GtkMenuItems in the BookmarkMenu are all drag sources. 76 // The individual GtkMenuItems in the BookmarkMenu are all drag sources.
73 static void OnMenuItemDragBegin(GtkWidget* menu_item, 77 static void OnMenuItemDragBegin(GtkWidget* menu_item,
74 GdkDragContext* drag_context, 78 GdkDragContext* drag_context,
75 BookmarkMenuController* bar); 79 BookmarkMenuController* bar);
76 static void OnMenuItemDragEnd(GtkWidget* menu_item, 80 static void OnMenuItemDragEnd(GtkWidget* menu_item,
(...skipping 21 matching lines...) Expand all
98 // Our bookmark menus. We don't use the MenuGtk class because we have to do 102 // Our bookmark menus. We don't use the MenuGtk class because we have to do
99 // all sorts of weird non-standard things with this menu, like: 103 // all sorts of weird non-standard things with this menu, like:
100 // - The menu is a drag target 104 // - The menu is a drag target
101 // - The menu items have context menus. 105 // - The menu items have context menus.
102 OwnedWidgetGtk menu_; 106 OwnedWidgetGtk menu_;
103 107
104 // Whether we should ignore the next button release event (because we were 108 // Whether we should ignore the next button release event (because we were
105 // dragging). 109 // dragging).
106 bool ignore_button_release_; 110 bool ignore_button_release_;
107 111
112 // The widget we are showing for (i.e. the bookmark bar folder button).
113 GtkWidget* triggering_widget_;
114
108 // Mapping from node to GtkMenuItem menu id. This only contains entries for 115 // Mapping from node to GtkMenuItem menu id. This only contains entries for
109 // nodes of type URL. 116 // nodes of type URL.
110 std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_; 117 std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_;
111 118
112 // Owns our right click context menu. 119 // Owns our right click context menu.
113 scoped_ptr<BookmarkContextMenu> context_menu_; 120 scoped_ptr<BookmarkContextMenu> context_menu_;
114 121
115 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); 122 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
116 }; 123 };
117 124
118 #endif // CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ 125 #endif // CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/bookmark_menu_controller_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698