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_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
| 6 #define CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
| 7 |
5 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
6 | 9 |
7 @class BrowserActionButton; | 10 @class BrowserActionButton; |
8 | 11 |
| 12 // Sent when a user-initiated drag to resize the container is initiated. |
| 13 extern const NSString* kBrowserActionGrippyDragStartedNotification; |
| 14 |
| 15 // Sent when a user-initiated drag is resizing the container. |
| 16 extern const NSString* kBrowserActionGrippyDraggingNotification; |
| 17 |
| 18 // Sent when a user-initiated drag to resize the container has finished. |
| 19 extern const NSString* kBrowserActionGrippyDragFinishedNotification; |
| 20 |
| 21 // The view that encompasses the Browser Action buttons in the toolbar and |
| 22 // provides mechanisms for resizing. |
9 @interface BrowserActionsContainerView : NSView { | 23 @interface BrowserActionsContainerView : NSView { |
| 24 @private |
| 25 // The frame encompasing the grippy used for resizing the container. |
| 26 NSRect grippyRect_; |
| 27 |
| 28 // Used to cache the original position within the container that initiated the |
| 29 // drag. |
| 30 NSPoint initialDragPoint_; |
| 31 |
| 32 // Used to cache the previous x-pos of the frame rect for resizing purposes. |
| 33 CGFloat lastXPos_; |
| 34 |
10 // Whether there is a border to the right of the last Browser Action. | 35 // Whether there is a border to the right of the last Browser Action. |
11 BOOL rightBorderShown_; | 36 BOOL rightBorderShown_; |
| 37 |
| 38 // Whether the container is currently being resized by the user. |
| 39 BOOL userIsResizing_; |
| 40 |
| 41 // Whether the user is allowed to drag the grippy to the left. NO if all |
| 42 // extensions are shown or the location bar has hit its minimum width (handled |
| 43 // within toolbar_controller.mm). |
| 44 BOOL canDragLeft_; |
| 45 |
| 46 // Whether the user is allowed to drag the grippy to the right. NO if all |
| 47 // extensions are hidden. |
| 48 BOOL canDragRight_; |
| 49 |
| 50 // When the left grippy is pinned, resizing the window has no effect on its |
| 51 // position. This prevents it from overlapping with other elements as well |
| 52 // as letting the container expand when the window is going from super small |
| 53 // to large. |
| 54 BOOL grippyPinned_; |
12 } | 55 } |
13 | 56 |
| 57 // Resizes the container to the given ideal width, adjusting the |lastXPos_| so |
| 58 // that |resizeDeltaX| is accurate. |
| 59 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate; |
| 60 |
14 // Returns the (visible) button at the given index in the view's hierarchy. | 61 // Returns the (visible) button at the given index in the view's hierarchy. |
15 - (BrowserActionButton*)buttonAtIndex:(NSUInteger)index; | 62 - (BrowserActionButton*)buttonAtIndex:(NSUInteger)index; |
16 | 63 |
| 64 // Returns the change in the x-pos of the frame rect during resizing. Meant to |
| 65 // be queried when a NSViewFrameDidChangeNotification is fired to determine |
| 66 // placement of surrounding elements. |
| 67 - (CGFloat)resizeDeltaX; |
| 68 |
| 69 @property(nonatomic) BOOL canDragLeft; |
| 70 @property(nonatomic) BOOL canDragRight; |
| 71 @property(nonatomic) BOOL grippyPinned; |
| 72 @property(readonly, nonatomic) BOOL userIsResizing; |
17 @property(nonatomic) BOOL rightBorderShown; | 73 @property(nonatomic) BOOL rightBorderShown; |
18 | 74 |
19 @end | 75 @end |
| 76 |
| 77 #endif // CHROME_BROWSER_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_ |
OLD | NEW |