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

Side by Side Diff: ios/chrome/browser/ui/popup_menu/popup_menu_controller.h

Issue 2589803002: Upstream Chrome on iOS source code [6/11]. (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
1 // Copyright 2012 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 IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_
6 #define IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_
7
8 #import <UIKit/UIKit.h>
9
10 @class PopupMenuController;
11 @class PopupMenuView;
12
13 // A protocol required by delegates of the PopupMenuController.
14 @protocol PopupMenuDelegate
15 // Instructs the delegate the PopupMenuController is done and should be
16 // dismissed.
17 - (void)dismissPopupMenu:(PopupMenuController*)controller;
18 @end
19
20 // The base view controller for popup menus within the top toolbar like the
21 // Tools menu.
22 @interface PopupMenuController : NSObject
23
24 // View that contains all subviews. Subclasses should add their views to
25 // |containerView_|.
26 @property(nonatomic, readonly, retain) UIView* containerView;
27 // Displays the background and border of the popup.
28 @property(nonatomic, readonly, retain) PopupMenuView* popupContainer;
29 // Button used to dismiss the popup. Covers the entire window behind the popup
30 // menu. Catches any touch events outside of the popup and invokes
31 // |-tappedBehindPopup:| if there are any.
32 @property(nonatomic, readonly, retain) UIButton* backgroundButton;
33 // Delegate for the popup menu.
34 @property(nonatomic, assign) id<PopupMenuDelegate> delegate;
35
36 // Initializes the PopupMenuController and adds its views inside of parent.
37 - (id)initWithParentView:(UIView*)parent;
38
39 // The designated initializer.
40 // Initializes the PopupMenuController and adds its views inside of parent.
41 // Additional backgroundButton params are used to change the look and behavior
42 // of |backgroundButton_|.
43 // backgroundButtonParent is the view to add |backgroundButton_| to. If nil,
44 // |backgroundButton_| is added to |containerView_|.
45 // backgroundButtonColor is the backgroundColor to set for |backgroundButton_|.
46 // backgroundButtonAlpha is the alpha to set for |backgroundButton_|.
47 // backgroundButtonTag is the tag to set for |backgroundButton_|.
48 // backgroundButtonSelector is the action to add for touch down events on
49 // |backgroundButton_|.
50 - (id)initWithParentView:(UIView*)parent
51 backgroundButtonParent:(UIView*)backgroundButtonParent
52 backgroundButtonColor:(UIColor*)backgroundButtonColor
53 backgroundButtonAlpha:(CGFloat)backgroundButtonAlpha
54 backgroundButtonTag:(NSInteger)backgroundButtonTag
55 backgroundButtonSelector:(SEL)backgroundButtonSelector;
56
57 // Sets the optimal size of the popup needed to display its contents without
58 // exceeding the bounds of the window. Also positions the arrow to point at
59 // |origin|.
60 - (void)setOptimalSize:(CGSize)optimalSize atOrigin:(CGPoint)origin;
61
62 // Called when the user taps outside of the popup.
63 - (void)tappedBehindPopup:(id)sender;
64
65 // Called to display the popup with a fade in animation. |completionBlock| is
66 // executed once the fade animation is complete.
67 - (void)fadeInPopupFromSource:(CGPoint)source
68 toDestination:(CGPoint)destination;
69 - (void)dismissAnimatedWithCompletion:(void (^)(void))completion;
70
71 // Called to display the popup with a fade in animation. |completionBlock| is
72 // executed once the fade animation is complete.
73 - (void)fadeInPopup:(void (^)(BOOL finished))completionBlock;
74
75 @end
76
77 #endif // IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698