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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/popup_menu/popup_menu_controller.h
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_controller.h b/ios/chrome/browser/ui/popup_menu/popup_menu_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..917912b072436b9c04edc2f44af475da1bd411fc
--- /dev/null
+++ b/ios/chrome/browser/ui/popup_menu/popup_menu_controller.h
@@ -0,0 +1,77 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_
+#define IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_
+
+#import <UIKit/UIKit.h>
+
+@class PopupMenuController;
+@class PopupMenuView;
+
+// A protocol required by delegates of the PopupMenuController.
+@protocol PopupMenuDelegate
+// Instructs the delegate the PopupMenuController is done and should be
+// dismissed.
+- (void)dismissPopupMenu:(PopupMenuController*)controller;
+@end
+
+// The base view controller for popup menus within the top toolbar like the
+// Tools menu.
+@interface PopupMenuController : NSObject
+
+// View that contains all subviews. Subclasses should add their views to
+// |containerView_|.
+@property(nonatomic, readonly, retain) UIView* containerView;
+// Displays the background and border of the popup.
+@property(nonatomic, readonly, retain) PopupMenuView* popupContainer;
+// Button used to dismiss the popup. Covers the entire window behind the popup
+// menu. Catches any touch events outside of the popup and invokes
+// |-tappedBehindPopup:| if there are any.
+@property(nonatomic, readonly, retain) UIButton* backgroundButton;
+// Delegate for the popup menu.
+@property(nonatomic, assign) id<PopupMenuDelegate> delegate;
+
+// Initializes the PopupMenuController and adds its views inside of parent.
+- (id)initWithParentView:(UIView*)parent;
+
+// The designated initializer.
+// Initializes the PopupMenuController and adds its views inside of parent.
+// Additional backgroundButton params are used to change the look and behavior
+// of |backgroundButton_|.
+// backgroundButtonParent is the view to add |backgroundButton_| to. If nil,
+// |backgroundButton_| is added to |containerView_|.
+// backgroundButtonColor is the backgroundColor to set for |backgroundButton_|.
+// backgroundButtonAlpha is the alpha to set for |backgroundButton_|.
+// backgroundButtonTag is the tag to set for |backgroundButton_|.
+// backgroundButtonSelector is the action to add for touch down events on
+// |backgroundButton_|.
+- (id)initWithParentView:(UIView*)parent
+ backgroundButtonParent:(UIView*)backgroundButtonParent
+ backgroundButtonColor:(UIColor*)backgroundButtonColor
+ backgroundButtonAlpha:(CGFloat)backgroundButtonAlpha
+ backgroundButtonTag:(NSInteger)backgroundButtonTag
+ backgroundButtonSelector:(SEL)backgroundButtonSelector;
+
+// Sets the optimal size of the popup needed to display its contents without
+// exceeding the bounds of the window. Also positions the arrow to point at
+// |origin|.
+- (void)setOptimalSize:(CGSize)optimalSize atOrigin:(CGPoint)origin;
+
+// Called when the user taps outside of the popup.
+- (void)tappedBehindPopup:(id)sender;
+
+// Called to display the popup with a fade in animation. |completionBlock| is
+// executed once the fade animation is complete.
+- (void)fadeInPopupFromSource:(CGPoint)source
+ toDestination:(CGPoint)destination;
+- (void)dismissAnimatedWithCompletion:(void (^)(void))completion;
+
+// Called to display the popup with a fade in animation. |completionBlock| is
+// executed once the fade animation is complete.
+- (void)fadeInPopup:(void (^)(BOOL finished))completionBlock;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_POPUP_MENU_POPUP_MENU_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698