OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This class replicates some menubar behaviors that are tricky to get right. | 5 // This class replicates some menubar behaviors that are tricky to get right. |
6 // It is used to create a more native feel for the bookmark bar. | 6 // It is used to create a more native feel for the bookmark bar. |
7 | 7 |
8 #ifndef CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ | 8 #ifndef CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ |
9 #define CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ | 9 #define CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 16 matching lines...) Expand all Loading... |
27 virtual ~Delegate() {} | 27 virtual ~Delegate() {} |
28 | 28 |
29 // Called when a the menu for a button ought to be triggered. | 29 // Called when a the menu for a button ought to be triggered. |
30 virtual void PopupForButton(GtkWidget* button) = 0; | 30 virtual void PopupForButton(GtkWidget* button) = 0; |
31 virtual void PopupForButtonNextTo(GtkWidget* button, | 31 virtual void PopupForButtonNextTo(GtkWidget* button, |
32 GtkMenuDirectionType dir) = 0; | 32 GtkMenuDirectionType dir) = 0; |
33 }; | 33 }; |
34 | 34 |
35 // |delegate| cannot be null. | 35 // |delegate| cannot be null. |
36 explicit MenuBarHelper(Delegate* delegate); | 36 explicit MenuBarHelper(Delegate* delegate); |
37 virtual ~MenuBarHelper(); | 37 ~MenuBarHelper(); |
38 | 38 |
39 // Must be called whenever a button's menu starts showing. It triggers the | 39 // Must be called whenever a button's menu starts showing. It triggers the |
40 // MenuBarHelper to start listening for certain events. | 40 // MenuBarHelper to start listening for certain events. |
41 void MenuStartedShowing(GtkWidget* button, GtkWidget* menu); | 41 void MenuStartedShowing(GtkWidget* button, GtkWidget* menu); |
42 | 42 |
43 // Add |button| to the set of buttons we care about. | 43 // Add |button| to the set of buttons we care about. |
44 void Add(GtkWidget* button); | 44 void Add(GtkWidget* button); |
45 | 45 |
46 // Remove |button| from the set of buttons we care about. | 46 // Remove |button| from the set of buttons we care about. |
47 void Remove(GtkWidget* button); | 47 void Remove(GtkWidget* button); |
(...skipping 23 matching lines...) Expand all Loading... |
71 std::vector<GtkWidget*> submenus_; | 71 std::vector<GtkWidget*> submenus_; |
72 | 72 |
73 // Signal handlers that are attached only between the "show" and "hide" events | 73 // Signal handlers that are attached only between the "show" and "hide" events |
74 // for the menu. | 74 // for the menu. |
75 scoped_ptr<ui::GtkSignalRegistrar> signal_handlers_; | 75 scoped_ptr<ui::GtkSignalRegistrar> signal_handlers_; |
76 | 76 |
77 Delegate* delegate_; | 77 Delegate* delegate_; |
78 }; | 78 }; |
79 | 79 |
80 #endif // CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ | 80 #endif // CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ |
OLD | NEW |