| 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 CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #import "ui/base/cocoa/tracking_area.h" | 11 #import "ui/base/cocoa/tracking_area.h" |
| 12 | 12 |
| 13 // Sent when a user-initiated drag to resize the container is initiated. | 13 // Sent when a user-initiated drag to resize the container is initiated. |
| 14 extern NSString* const kBrowserActionGrippyDragStartedNotification; | 14 extern NSString* const kBrowserActionGrippyDragStartedNotification; |
| 15 | 15 |
| 16 // Sent when a user-initiated drag is resizing the container. | 16 // Sent when a user-initiated drag is resizing the container. |
| 17 extern NSString* const kBrowserActionGrippyDraggingNotification; | 17 extern NSString* const kBrowserActionGrippyDraggingNotification; |
| 18 | 18 |
| 19 // Sent when a user-initiated drag to resize the container has finished. | 19 // Sent when a user-initiated drag to resize the container has finished. |
| 20 extern NSString* const kBrowserActionGrippyDragFinishedNotification; | 20 extern NSString* const kBrowserActionGrippyDragFinishedNotification; |
| 21 | 21 |
| 22 // Sent when the Browser Actions container view is about to animate. | 22 // Sent when the Browser Actions container view is about to animate. |
| 23 extern NSString* const kBrowserActionsContainerWillAnimate; | 23 extern NSString* const kBrowserActionsContainerWillAnimate; |
| 24 | 24 |
| 25 // Sent when the mouse enters the browser actions container (if tracking is | 25 // Sent when the mouse enters the browser actions container (if tracking is |
| 26 // enabled). | 26 // enabled). |
| 27 extern NSString* const kBrowserActionsContainerMouseEntered; | 27 extern NSString* const kBrowserActionsContainerMouseEntered; |
| 28 | 28 |
| 29 // Sent when a running animation has ended. |
| 30 extern NSString* const kBrowserActionsContainerAnimationEnded; |
| 31 |
| 29 // Key which is used to notify the translation with delta. | 32 // Key which is used to notify the translation with delta. |
| 30 extern NSString* const kTranslationWithDelta; | 33 extern NSString* const kTranslationWithDelta; |
| 31 | 34 |
| 35 @class ContainerAnimationHelper; |
| 36 |
| 32 class BrowserActionsContainerViewSizeDelegate { | 37 class BrowserActionsContainerViewSizeDelegate { |
| 33 public: | 38 public: |
| 34 virtual CGFloat GetMaxAllowedWidth() = 0; | 39 virtual CGFloat GetMaxAllowedWidth() = 0; |
| 35 virtual ~BrowserActionsContainerViewSizeDelegate() {} | 40 virtual ~BrowserActionsContainerViewSizeDelegate() {} |
| 36 }; | 41 }; |
| 37 | 42 |
| 38 // The view that encompasses the Browser Action buttons in the toolbar and | 43 // The view that encompasses the Browser Action buttons in the toolbar and |
| 39 // provides mechanisms for resizing. | 44 // provides mechanisms for resizing. |
| 40 @interface BrowserActionsContainerView : NSView { | 45 @interface BrowserActionsContainerView : NSView { |
| 41 @private | 46 @private |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 BOOL isHighlighting_; | 83 BOOL isHighlighting_; |
| 79 | 84 |
| 80 // A tracking area to receive mouseEntered events, if tracking is enabled. | 85 // A tracking area to receive mouseEntered events, if tracking is enabled. |
| 81 ui::ScopedCrTrackingArea trackingArea_; | 86 ui::ScopedCrTrackingArea trackingArea_; |
| 82 | 87 |
| 83 // The size delegate, if any. | 88 // The size delegate, if any. |
| 84 // Weak; delegate is responsible for adding/removing itself. | 89 // Weak; delegate is responsible for adding/removing itself. |
| 85 BrowserActionsContainerViewSizeDelegate* sizeDelegate_; | 90 BrowserActionsContainerViewSizeDelegate* sizeDelegate_; |
| 86 | 91 |
| 87 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; | 92 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; |
| 93 base::scoped_nsobject<ContainerAnimationHelper> animationHelper_; |
| 88 } | 94 } |
| 89 | 95 |
| 90 // Sets whether or not tracking (for mouseEntered events) is enabled. | 96 // Sets whether or not tracking (for mouseEntered events) is enabled. |
| 91 - (void)setTrackingEnabled:(BOOL)enabled; | 97 - (void)setTrackingEnabled:(BOOL)enabled; |
| 92 | 98 |
| 93 // Sets whether or not the container is highlighting. | 99 // Sets whether or not the container is highlighting. |
| 94 - (void)setIsHighlighting:(BOOL)isHighlighting; | 100 - (void)setIsHighlighting:(BOOL)isHighlighting; |
| 95 | 101 |
| 96 // Resizes the container to the given ideal width, optionally animating. | 102 // Resizes the container to the given ideal width, optionally animating. |
| 97 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate; | 103 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 110 @property(nonatomic) BOOL canDragRight; | 116 @property(nonatomic) BOOL canDragRight; |
| 111 @property(nonatomic) BOOL grippyPinned; | 117 @property(nonatomic) BOOL grippyPinned; |
| 112 @property(nonatomic,getter=isResizable) BOOL resizable; | 118 @property(nonatomic,getter=isResizable) BOOL resizable; |
| 113 @property(nonatomic) CGFloat maxDesiredWidth; | 119 @property(nonatomic) CGFloat maxDesiredWidth; |
| 114 @property(readonly, nonatomic) BOOL userIsResizing; | 120 @property(readonly, nonatomic) BOOL userIsResizing; |
| 115 @property(nonatomic) BrowserActionsContainerViewSizeDelegate* delegate; | 121 @property(nonatomic) BrowserActionsContainerViewSizeDelegate* delegate; |
| 116 | 122 |
| 117 @end | 123 @end |
| 118 | 124 |
| 119 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ | 125 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
| OLD | NEW |