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 // Sent before the dragging will resize the container.
20 extern NSString* const kBrowserActionGrippyWillDragNotification;
22 // Key which is used to notify the translation with delta.
23 extern NSString* const kTranslationWithDelta;
25 // The view that encompasses the Browser Action buttons in the toolbar and
26 // provides mechanisms for resizing.
27 @interface BrowserActionsContainerView : NSView {
29 // The frame encompasing the grippy used for resizing the container.
32 // The end frame of the animation currently running for this container or
33 // NSZeroRect if none is in progress.
34 NSRect animationEndFrame_;
36 // Used to cache the original position within the container that initiated the
38 NSPoint initialDragPoint_;
40 // Used to cache the previous x-pos of the frame rect for resizing purposes.
43 // The maximum width of the container.
46 // Whether the container is currently being resized by the user.
49 // Whether the user can resize this at all. Resizing is disabled in incognito
50 // mode since any changes done in incognito mode are not saved anyway, and
51 // also to avoid a crash. http://crbug.com/42848
54 // Whether the user is allowed to drag the grippy to the left. NO if all
55 // extensions are shown or the location bar has hit its minimum width (handled
56 // within toolbar_controller.mm).
59 // Whether the user is allowed to drag the grippy to the right. NO if all
60 // extensions are hidden.
63 // When the left grippy is pinned, resizing the window has no effect on its
64 // position. This prevents it from overlapping with other elements as well
65 // as letting the container expand when the window is going from super small
70 // Resizes the container to the given ideal width, adjusting the |lastXPos_| so
71 // that |resizeDeltaX| is accurate.
72 - (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate;
74 // Returns the change in the x-pos of the frame rect during resizing. Meant to
75 // be queried when a NSViewFrameDidChangeNotification is fired to determine
76 // placement of surrounding elements.
77 - (CGFloat)resizeDeltaX;
79 @property(nonatomic, readonly) NSRect animationEndFrame;
80 @property(nonatomic) BOOL canDragLeft;
81 @property(nonatomic) BOOL canDragRight;
82 @property(nonatomic) BOOL grippyPinned;
83 @property(nonatomic,getter=isResizable) BOOL resizable;
84 @property(nonatomic) CGFloat maxWidth;
85 @property(readonly, nonatomic) BOOL userIsResizing;
89 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_