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 |
11 | 11 |
12 #include <gtk/gtk.h> | 12 #include <gtk/gtk.h> |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "app/gtk_signal.h" | |
17 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "ui/base/gtk/gtk_signal.h" |
18 | 18 |
| 19 namespace ui { |
19 class GtkSignalRegistrar; | 20 class GtkSignalRegistrar; |
| 21 } |
20 | 22 |
21 class MenuBarHelper { | 23 class MenuBarHelper { |
22 public: | 24 public: |
23 class Delegate { | 25 class Delegate { |
24 public: | 26 public: |
25 virtual ~Delegate() {} | 27 virtual ~Delegate() {} |
26 | 28 |
27 // 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. |
28 virtual void PopupForButton(GtkWidget* button) = 0; | 30 virtual void PopupForButton(GtkWidget* button) = 0; |
29 virtual void PopupForButtonNextTo(GtkWidget* button, | 31 virtual void PopupForButtonNextTo(GtkWidget* button, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 65 |
64 // The highest level menu that is currently showing, or NULL. | 66 // The highest level menu that is currently showing, or NULL. |
65 GtkWidget* showing_menu_; | 67 GtkWidget* showing_menu_; |
66 | 68 |
67 // All the submenus of |showing_menu_|. We connect to motion events on all | 69 // All the submenus of |showing_menu_|. We connect to motion events on all |
68 // of them. | 70 // of them. |
69 std::vector<GtkWidget*> submenus_; | 71 std::vector<GtkWidget*> submenus_; |
70 | 72 |
71 // 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 |
72 // for the menu. | 74 // for the menu. |
73 scoped_ptr<GtkSignalRegistrar> signal_handlers_; | 75 scoped_ptr<ui::GtkSignalRegistrar> signal_handlers_; |
74 | 76 |
75 Delegate* delegate_; | 77 Delegate* delegate_; |
76 }; | 78 }; |
77 | 79 |
78 #endif // CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ | 80 #endif // CHROME_BROWSER_UI_GTK_MENU_BAR_HELPER_H_ |
OLD | NEW |