OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ |
6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ | 6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "app/gtk_signal.h" |
12 #include "base/task.h" | 13 #include "base/task.h" |
13 #include "views/controls/menu/menu_wrapper.h" | 14 #include "views/controls/menu/menu_wrapper.h" |
14 | 15 |
15 namespace menus { | 16 namespace menus { |
16 class MenuModel; | 17 class MenuModel; |
17 } | 18 } |
18 | 19 |
19 namespace views { | 20 namespace views { |
20 | 21 |
21 // A Gtk implementation of MenuWrapper. | 22 // A Gtk implementation of MenuWrapper. |
(...skipping 14 matching lines...) Expand all Loading... |
36 virtual void RunMenuAt(const gfx::Point& point, int alignment); | 37 virtual void RunMenuAt(const gfx::Point& point, int alignment); |
37 virtual void CancelMenu(); | 38 virtual void CancelMenu(); |
38 virtual void Rebuild(); | 39 virtual void Rebuild(); |
39 virtual void UpdateStates(); | 40 virtual void UpdateStates(); |
40 virtual gfx::NativeMenu GetNativeMenu() const; | 41 virtual gfx::NativeMenu GetNativeMenu() const; |
41 virtual MenuAction GetMenuAction() const; | 42 virtual MenuAction GetMenuAction() const; |
42 virtual void AddMenuListener(MenuListener* listener); | 43 virtual void AddMenuListener(MenuListener* listener); |
43 virtual void RemoveMenuListener(MenuListener* listener); | 44 virtual void RemoveMenuListener(MenuListener* listener); |
44 | 45 |
45 private: | 46 private: |
46 static void OnMenuHidden(GtkWidget* widget, NativeMenuGtk* menu); | 47 CHROMEGTK_CALLBACK_0(NativeMenuGtk, void, OnMenuHidden); |
47 static void OnMenuMoveCurrent(GtkMenu* widget, | 48 CHROMEGTK_CALLBACK_1(NativeMenuGtk, void, OnMenuMoveCurrent, |
48 GtkMenuDirectionType focus_direction, | 49 GtkMenuDirectionType); |
49 NativeMenuGtk* menu); | |
50 | 50 |
51 void AddSeparatorAt(int index); | 51 void AddSeparatorAt(int index); |
52 GtkWidget* AddMenuItemAt(int index, GtkRadioMenuItem* radio_group, | 52 GtkWidget* AddMenuItemAt(int index, GtkRadioMenuItem* radio_group, |
53 GtkAccelGroup* accel_group); | 53 GtkAccelGroup* accel_group); |
54 | 54 |
55 void ResetMenu(); | 55 void ResetMenu(); |
56 | 56 |
57 // Updates the menu item's state. | 57 // Updates the menu item's state. |
58 void UpdateMenuItemState(GtkWidget* menu_item); | 58 void UpdateMenuItemState(GtkWidget* menu_item); |
59 | 59 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 // Vector of listeners to receive callbacks when the menu opens. | 125 // Vector of listeners to receive callbacks when the menu opens. |
126 std::vector<MenuListener*> listeners_; | 126 std::vector<MenuListener*> listeners_; |
127 | 127 |
128 DISALLOW_COPY_AND_ASSIGN(NativeMenuGtk); | 128 DISALLOW_COPY_AND_ASSIGN(NativeMenuGtk); |
129 }; | 129 }; |
130 | 130 |
131 } // namespace views | 131 } // namespace views |
132 | 132 |
133 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ | 133 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_GTK_H_ |
OLD | NEW |