Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / extensions / browser_actions_container_view.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_
7
8 #import <Cocoa/Cocoa.h>
9
10 // Sent when a user-initiated drag to resize the container is initiated.
11 extern NSString* const kBrowserActionGrippyDragStartedNotification;
12
13 // Sent when a user-initiated drag is resizing the container.
14 extern NSString* const kBrowserActionGrippyDraggingNotification;
15
16 // Sent when a user-initiated drag to resize the container has finished.
17 extern NSString* const kBrowserActionGrippyDragFinishedNotification;
18
19 // Sent before the dragging will resize the container.
20 extern NSString* const kBrowserActionGrippyWillDragNotification;
21
22 // Key which is used to notify the translation with delta.
23 extern NSString* const kTranslationWithDelta;
24
25 // The view that encompasses the Browser Action buttons in the toolbar and
26 // provides mechanisms for resizing.
27 @interface BrowserActionsContainerView : NSView {
28  @private
29   // The frame encompasing the grippy used for resizing the container.
30   NSRect grippyRect_;
31
32   // The end frame of the animation currently running for this container or
33   // NSZeroRect if none is in progress.
34   NSRect animationEndFrame_;
35
36   // Used to cache the original position within the container that initiated the
37   // drag.
38   NSPoint initialDragPoint_;
39
40   // Used to cache the previous x-pos of the frame rect for resizing purposes.
41   CGFloat lastXPos_;
42
43   // The maximum width of the container.
44   CGFloat maxWidth_;
45
46   // Whether the container is currently being resized by the user.
47   BOOL userIsResizing_;
48
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
52   BOOL resizable_;
53
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).
57   BOOL canDragLeft_;
58
59   // Whether the user is allowed to drag the grippy to the right. NO if all
60   // extensions are hidden.
61   BOOL canDragRight_;
62
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
66   // to large.
67   BOOL grippyPinned_;
68 }
69
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;
73
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;
78
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;
86
87 @end
88
89 #endif  // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_