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" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // provides mechanisms for resizing. | 39 // provides mechanisms for resizing. |
40 @interface BrowserActionsContainerView : NSView { | 40 @interface BrowserActionsContainerView : NSView { |
41 @private | 41 @private |
42 // The frame encompasing the grippy used for resizing the container. | 42 // The frame encompasing the grippy used for resizing the container. |
43 NSRect grippyRect_; | 43 NSRect grippyRect_; |
44 | 44 |
45 // Used to cache the original position within the container that initiated the | 45 // Used to cache the original position within the container that initiated the |
46 // drag. | 46 // drag. |
47 NSPoint initialDragPoint_; | 47 NSPoint initialDragPoint_; |
48 | 48 |
49 // Used to cache the previous x-pos of the frame rect for resizing purposes. | |
50 CGFloat lastXPos_; | |
51 | |
52 // The maximum width the container could want; i.e., the width required to | 49 // The maximum width the container could want; i.e., the width required to |
53 // display all the icons. | 50 // display all the icons. |
54 CGFloat maxDesiredWidth_; | 51 CGFloat maxDesiredWidth_; |
55 | 52 |
56 // Whether the container is currently being resized by the user. | 53 // Whether the container is currently being resized by the user. |
57 BOOL userIsResizing_; | 54 BOOL userIsResizing_; |
58 | 55 |
59 // Whether the user can resize this at all. Resizing is disabled in incognito | 56 // Whether the user can resize this at all. Resizing is disabled in incognito |
60 // mode since any changes done in incognito mode are not saved anyway, and | 57 // mode since any changes done in incognito mode are not saved anyway, and |
61 // also to avoid a crash. http://crbug.com/42848 | 58 // also to avoid a crash. http://crbug.com/42848 |
(...skipping 20 matching lines...) Expand all Loading... |
82 // The size delegate, if any. | 79 // The size delegate, if any. |
83 // Weak; delegate is responsible for adding/removing itself. | 80 // Weak; delegate is responsible for adding/removing itself. |
84 BrowserActionsContainerViewSizeDelegate* sizeDelegate_; | 81 BrowserActionsContainerViewSizeDelegate* sizeDelegate_; |
85 | 82 |
86 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; | 83 base::scoped_nsobject<NSViewAnimation> resizeAnimation_; |
87 } | 84 } |
88 | 85 |
89 // Sets whether or not tracking (for mouseEntered events) is enabled. | 86 // Sets whether or not tracking (for mouseEntered events) is enabled. |
90 - (void)setTrackingEnabled:(BOOL)enabled; | 87 - (void)setTrackingEnabled:(BOOL)enabled; |
91 | 88 |
92 // Resizes the container to the given ideal width, adjusting the |lastXPos_| so | 89 // Resizes the container to the given ideal width, optionally animating. |
93 // that |resizeDeltaX| is accurate. | |
94 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate; | 90 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate; |
95 | 91 |
96 // Returns the change in the x-pos of the frame rect during resizing. Meant to | |
97 // be queried when a NSViewFrameDidChangeNotification is fired to determine | |
98 // placement of surrounding elements. | |
99 - (CGFloat)resizeDeltaX; | |
100 | |
101 // Returns the frame of the container after the running animation has finished. | 92 // Returns the frame of the container after the running animation has finished. |
102 // If no animation is running, returns the container's current frame. | 93 // If no animation is running, returns the container's current frame. |
103 - (NSRect)animationEndFrame; | 94 - (NSRect)animationEndFrame; |
104 | 95 |
105 // Returns true if the view is animating. | 96 // Returns true if the view is animating. |
106 - (BOOL)isAnimating; | 97 - (BOOL)isAnimating; |
107 | 98 |
108 // Stops any animation in progress. | 99 // Stops any animation in progress. |
109 - (void)stopAnimation; | 100 - (void)stopAnimation; |
110 | 101 |
111 @property(nonatomic) BOOL canDragLeft; | 102 @property(nonatomic) BOOL canDragLeft; |
112 @property(nonatomic) BOOL canDragRight; | 103 @property(nonatomic) BOOL canDragRight; |
113 @property(nonatomic) BOOL grippyPinned; | 104 @property(nonatomic) BOOL grippyPinned; |
114 @property(nonatomic,getter=isResizable) BOOL resizable; | 105 @property(nonatomic,getter=isResizable) BOOL resizable; |
115 @property(nonatomic) CGFloat maxDesiredWidth; | 106 @property(nonatomic) CGFloat maxDesiredWidth; |
116 @property(readonly, nonatomic) BOOL userIsResizing; | 107 @property(readonly, nonatomic) BOOL userIsResizing; |
117 @property(nonatomic) BrowserActionsContainerViewSizeDelegate* delegate; | 108 @property(nonatomic) BrowserActionsContainerViewSizeDelegate* delegate; |
118 | 109 |
119 @end | 110 @end |
120 | 111 |
121 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ | 112 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
OLD | NEW |