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

Side by Side Diff: webkit/glue/webmenurunner_mac.h

Issue 92062: Clean up cocoa popup menu handling for test_shell (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | webkit/glue/webmenurunner_mac.mm » ('j') | webkit/glue/webmenurunner_mac.mm » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_GLUE_WEBMENURUNNER_MAC_H_
6 #define WEBKIT_GLUE_WEBMENURUNNER_MAC_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #include <vector>
11
12 #include "webkit/glue/webwidget_delegate.h"
13
14
15 // WebMenuRunner ---------------------------------------------------------------
16 // A class for determining whether an item was selected from an HTML select
17 // control, or if the menu was dismissed without making a selection. If a menu
18 // item is selected, MenuDelegate is informed and sets a flag which can be
19 // queried after the menu has finished running.
20
21 @interface WebMenuRunner : NSObject {
22 @private
23 // The actual menu object, which we own.
24 NSMenu* menu_;
pink (ping after 24hrs) 2009/04/27 14:14:59 if owned, you should probably use a scoped_nsobjec
25
26 // A flag set to YES if a menu item was chosen, or NO if the menu was
27 // dismissed without selecting an item.
28 BOOL menuItemWasChosen_;
29
30 // The index of the selected menu item.
31 int index_;
32 }
33
34 // Initializes the MenuDelegate with a list of items sent from WebKit.
35 - (id)initWithItems:(const std::vector<WebMenuItem>&)items;
36 - (void)dealloc;
pink (ping after 24hrs) 2009/04/27 14:14:59 no need to declare methods that are simply overrid
37
38 // Worker function used during initialization.
39 - (void)addItem:(const WebMenuItem&)item;
pink (ping after 24hrs) 2009/04/27 14:14:59 if it's internal, don't make it part of the public
40
41 // Returns YES if an item was selected from the menu, NO if the menu was
42 // dismissed.
43 - (BOOL)menuItemWasChosen;
44
45 // A callback for the menu controller object to call when an item is selected
46 // from the menu. This is not called if the menu is dismissed without a
47 // selection.
48 - (void)menuItemSelected:(id)sender;
pink (ping after 24hrs) 2009/04/27 14:14:59 again, this sounds like an implementation-specific
49
50 // Displays and runs a native popup menu.
51 - (void)runMenuInView:(NSView*)view
52 withBounds:(NSRect)bounds
53 initialIndex:(int)index;
54
55 // Returns the index of selected menu item, or its initial value (-1) if no item
56 // was selected.
57 - (int)indexOfSelectedItem;
58
59 @end // @interface WebMenuRunner
60
61 // Helper function for manufacturing input events to send to WebKit. If
62 // |item_chosen| is YES, we manufacture a mouse click event that corresponds to
63 // the menu item that was selected, |selected_index|, based on the position of
64 // the mouse click. Of |item_chosen| is NO, we create a keyboard event that
65 // simulates an ESC (menu dismissal) action. The event is designed to be sent to
66 // WebKit for processing by the PopupMenu class.
67 NSEvent* CreateEventForMenuAction(BOOL item_chosen, int window_num,
pink (ping after 24hrs) 2009/04/27 14:14:59 should this go into any particular namespace? Also
68 int item_height, int selected_index,
69 NSRect menu_bounds, NSRect view_bounds);
70
71 #endif // WEBKIT_GLUE_WEBMENURUNNER_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/webmenurunner_mac.mm » ('j') | webkit/glue/webmenurunner_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698