| OLD | NEW |
| 1 // Copyright (c) 2009 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 #ifndef WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ | 5 #ifndef WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ |
| 6 #define WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ | 6 #define WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // A flag set to YES if a menu item was chosen, or NO if the menu was | 27 // A flag set to YES if a menu item was chosen, or NO if the menu was |
| 28 // dismissed without selecting an item. | 28 // dismissed without selecting an item. |
| 29 BOOL menuItemWasChosen_; | 29 BOOL menuItemWasChosen_; |
| 30 | 30 |
| 31 // The index of the selected menu item. | 31 // The index of the selected menu item. |
| 32 int index_; | 32 int index_; |
| 33 | 33 |
| 34 // The font size being used for the menu. | 34 // The font size being used for the menu. |
| 35 CGFloat fontSize_; | 35 CGFloat fontSize_; |
| 36 |
| 37 // Whether the menu should be displayed right-aligned. |
| 38 BOOL rightAligned_; |
| 36 } | 39 } |
| 37 | 40 |
| 38 // Initializes the MenuDelegate with a list of items sent from WebKit. | 41 // Initializes the MenuDelegate with a list of items sent from WebKit. |
| 39 - (id)initWithItems:(const std::vector<WebMenuItem>&)items | 42 - (id)initWithItems:(const std::vector<WebMenuItem>&)items |
| 40 fontSize:(CGFloat)fontSize | 43 fontSize:(CGFloat)fontSize |
| 41 rightAligned:(BOOL)rightAligned; | 44 rightAligned:(BOOL)rightAligned; |
| 42 | 45 |
| 43 // Returns YES if an item was selected from the menu, NO if the menu was | 46 // Returns YES if an item was selected from the menu, NO if the menu was |
| 44 // dismissed. | 47 // dismissed. |
| 45 - (BOOL)menuItemWasChosen; | 48 - (BOOL)menuItemWasChosen; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 61 // that corresponds to the menu item that was selected, |selected_index|, based | 64 // that corresponds to the menu item that was selected, |selected_index|, based |
| 62 // on the position of the mouse click. Of |item_chosen| is NO, we create a | 65 // on the position of the mouse click. Of |item_chosen| is NO, we create a |
| 63 // keyboard event that simulates an ESC (menu dismissal) action. The event is | 66 // keyboard event that simulates an ESC (menu dismissal) action. The event is |
| 64 // designed to be sent to WebKit for processing by the PopupMenu class. | 67 // designed to be sent to WebKit for processing by the PopupMenu class. |
| 65 NSEvent* EventWithMenuAction(BOOL item_chosen, int window_num, | 68 NSEvent* EventWithMenuAction(BOOL item_chosen, int window_num, |
| 66 int item_height, int selected_index, | 69 int item_height, int selected_index, |
| 67 NSRect menu_bounds, NSRect view_bounds); | 70 NSRect menu_bounds, NSRect view_bounds); |
| 68 } // namespace webkit_glue | 71 } // namespace webkit_glue |
| 69 | 72 |
| 70 #endif // WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ | 73 #endif // WEBKIT_GLUE_WEBMENURUNNER_MAC_H_ |
| OLD | NEW |