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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_
8 #import <Cocoa/Cocoa.h>
10 // Sent when a user-initiated drag to resize the container is initiated.
11 extern NSString* const kBrowserActionGrippyDragStartedNotification;
13 // Sent when a user-initiated drag is resizing the container.
14 extern NSString* const kBrowserActionGrippyDraggingNotification;
16 // Sent when a user-initiated drag to resize the container has finished.
17 extern NSString* const kBrowserActionGrippyDragFinishedNotification;
19 // The view that encompasses the Browser Action buttons in the toolbar and
20 // provides mechanisms for resizing.
21 @interface BrowserActionsContainerView : NSView {
23 // The frame encompasing the grippy used for resizing the container.
26 // The end frame of the animation currently running for this container or
27 // NSZeroRect if none is in progress.
28 NSRect animationEndFrame_;
30 // Used to cache the original position within the container that initiated the
32 NSPoint initialDragPoint_;
34 // Used to cache the previous x-pos of the frame rect for resizing purposes.
37 // The maximum width of the container.
40 // Whether the container is currently being resized by the user.
43 // Whether the user can resize this at all. Resizing is disabled in incognito
44 // mode since any changes done in incognito mode are not saved anyway, and
45 // also to avoid a crash. http://crbug.com/42848
48 // Whether the user is allowed to drag the grippy to the left. NO if all
49 // extensions are shown or the location bar has hit its minimum width (handled
50 // within toolbar_controller.mm).
53 // Whether the user is allowed to drag the grippy to the right. NO if all
54 // extensions are hidden.
57 // When the left grippy is pinned, resizing the window has no effect on its
58 // position. This prevents it from overlapping with other elements as well
59 // as letting the container expand when the window is going from super small
64 // Resizes the container to the given ideal width, adjusting the |lastXPos_| so
65 // that |resizeDeltaX| is accurate.
66 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate;
68 // Returns the change in the x-pos of the frame rect during resizing. Meant to
69 // be queried when a NSViewFrameDidChangeNotification is fired to determine
70 // placement of surrounding elements.
71 - (CGFloat)resizeDeltaX;
73 @property(nonatomic, readonly) NSRect animationEndFrame;
74 @property(nonatomic) BOOL canDragLeft;
75 @property(nonatomic) BOOL canDragRight;
76 @property(nonatomic) BOOL grippyPinned;
77 @property(nonatomic,getter=isResizable) BOOL resizable;
78 @property(nonatomic) CGFloat maxWidth;
79 @property(readonly, nonatomic) BOOL userIsResizing;
83 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_