Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h

Issue 7465090: [Mac] Replace the custom bookmark menus with native NSMenus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 #include <map> 10 #include <map>
(...skipping 28 matching lines...) Expand all
39 39
40 // Used as a maximum width for buttons on the bar. 40 // Used as a maximum width for buttons on the bar.
41 const CGFloat kDefaultBookmarkWidth = 150.0; 41 const CGFloat kDefaultBookmarkWidth = 150.0;
42 42
43 // Horizontal frame inset for buttons in the bookmark bar. 43 // Horizontal frame inset for buttons in the bookmark bar.
44 const CGFloat kBookmarkHorizontalPadding = 1.0; 44 const CGFloat kBookmarkHorizontalPadding = 1.0;
45 45
46 // Vertical frame inset for buttons in the bookmark bar. 46 // Vertical frame inset for buttons in the bookmark bar.
47 const CGFloat kBookmarkVerticalPadding = 2.0; 47 const CGFloat kBookmarkVerticalPadding = 2.0;
48 48
49 // Used as a min/max width for buttons on menus (not on the bar).
50 const CGFloat kBookmarkMenuButtonMinimumWidth = 100.0;
51 const CGFloat kBookmarkMenuButtonMaximumWidth = 485.0;
52
53 // The minimum separation between a folder menu and the edge of the screen.
54 // If the menu gets closer to the edge of the screen (either right or left)
55 // then it is pops up in the opposite direction.
56 // (See -[BookmarkBarFolderController childFolderWindowLeftForWidth:]).
57 const CGFloat kBookmarkHorizontalScreenPadding = 8.0;
58
59 // Our NSScrollView is supposed to be just barely big enough to fit its
60 // contentView. It is actually a hair too small.
61 // This turns on horizontal scrolling which, although slight, is awkward.
62 // Make sure our window (and NSScrollView) are wider than its documentView
63 // by at least this much.
64 const CGFloat kScrollViewContentWidthMargin = 2;
65
66 // Make subfolder menus overlap their parent menu a bit to give a better
67 // perception of a menuing system.
68 const CGFloat kBookmarkMenuOverlap = 2.0;
69
70 // When constraining a scrolling bookmark bar folder window to the
71 // screen, shrink the "constrain" by this much vertically. Currently
72 // this is 0.0 to avoid a problem with tracking areas leaving the
73 // window, but should probably be 8.0 or something.
74 const CGFloat kScrollWindowVerticalMargin = 6.0;
75
76 // How far to offset a folder menu from the top of the bookmark bar. This 49 // How far to offset a folder menu from the top of the bookmark bar. This
77 // is set just above the bar so that it become distinctive when drawn. 50 // is set just above the bar so that it become distinctive when drawn.
78 const CGFloat kBookmarkBarMenuOffset = 2.0; 51 const CGFloat kBookmarkBarMenuOffset = 2.0;
79 52
80 // How far to offset a folder menu's left edge horizontally in relation to
81 // the left edge of the button from which it springs. Because of drawing
82 // differences, simply aligning the |frame| of each does not render the
83 // pproper result, so we have to offset.
84 const CGFloat kBookmarkBarButtonOffset = 2.0;
85
86 // Delay before opening a subfolder (and closing the previous one)
87 // when hovering over a folder button.
88 const NSTimeInterval kHoverOpenDelay = 0.3;
89
90 // Delay on hover before a submenu opens when dragging.
91 // Experimentally a drag hover open delay needs to be bigger than a
92 // normal (non-drag) menu hover open such as used in the bookmark folder.
93 // TODO(jrg): confirm feel of this constant with ui-team.
94 // http://crbug.com/36276
95 const NSTimeInterval kDragHoverOpenDelay = 0.7;
96
97 // Notes on use of kDragHoverCloseDelay in
98 // -[BookmarkBarFolderController draggingEntered:].
99 //
100 // We have an implicit delay on stop-hover-open before a submenu
101 // closes. This cannot be zero since it's nice to move the mouse in a
102 // direct line from "current position" to "position of item in
103 // submenu". However, by doing so, it's possible to overlap a
104 // different button on the current menu. Example:
105 //
106 // Folder1
107 // Folder2 ---> Sub1
108 // Folder3 Sub2
109 // Sub3
110 //
111 // If you hover over the F in Folder2 to open the sub, and then want to
112 // select Sub3, a direct line movement of the mouse may cross over
113 // Folder3. Without this delay, that'll cause Sub to be closed before
114 // you get there, since a "hover over" of Folder3 gets activated.
115 // It's subtle but without the delay it feels broken.
116 //
117 // This is only really a problem with vertical menu --> vertical menu
118 // movement; the bookmark bar (horizontal menu, sort of) seems fine,
119 // perhaps because mouse move direction is purely vertical so there is
120 // no opportunity for overlap.
121 const NSTimeInterval kDragHoverCloseDelay = 0.4;
122
123 } // namespace bookmarks 53 } // namespace bookmarks
124 54
125 // The interface for the bookmark bar controller's delegate. Currently, the 55 // The interface for the bookmark bar controller's delegate. Currently, the
126 // delegate is the BWC and is responsible for ensuring that the toolbar is 56 // delegate is the BWC and is responsible for ensuring that the toolbar is
127 // displayed correctly (as specified by |-getDesiredToolbarHeightCompression| 57 // displayed correctly (as specified by |-getDesiredToolbarHeightCompression|
128 // and |-toolbarDividerOpacity|) at the beginning and at the end of an animation 58 // and |-toolbarDividerOpacity|) at the beginning and at the end of an animation
129 // (or after a state change). 59 // (or after a state change).
130 @protocol BookmarkBarControllerDelegate 60 @protocol BookmarkBarControllerDelegate
131 61
132 // Sent when the state has changed (after any animation), but before the final 62 // Sent when the state has changed (after any animation), but before the final
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 328
399 // The following are for testing purposes only and are not used internally. 329 // The following are for testing purposes only and are not used internally.
400 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; 330 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node;
401 - (NSMenu*)buttonContextMenu; 331 - (NSMenu*)buttonContextMenu;
402 - (void)setButtonContextMenu:(id)menu; 332 - (void)setButtonContextMenu:(id)menu;
403 // Set to YES in order to prevent animations. 333 // Set to YES in order to prevent animations.
404 - (void)setIgnoreAnimations:(BOOL)ignore; 334 - (void)setIgnoreAnimations:(BOOL)ignore;
405 @end 335 @end
406 336
407 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ 337 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698