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_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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // Horizontal frame inset for buttons in the bookmark bar. | 47 // Horizontal frame inset for buttons in the bookmark bar. |
48 const CGFloat kBookmarkHorizontalPadding = 1.0; | 48 const CGFloat kBookmarkHorizontalPadding = 1.0; |
49 | 49 |
50 // Vertical frame inset for buttons in the bookmark bar. | 50 // Vertical frame inset for buttons in the bookmark bar. |
51 const CGFloat kBookmarkVerticalPadding = 2.0; | 51 const CGFloat kBookmarkVerticalPadding = 2.0; |
52 | 52 |
53 // Used as a min/max width for buttons on menus (not on the bar). | 53 // Used as a min/max width for buttons on menus (not on the bar). |
54 const CGFloat kBookmarkMenuButtonMinimumWidth = 100.0; | 54 const CGFloat kBookmarkMenuButtonMinimumWidth = 100.0; |
55 const CGFloat kBookmarkMenuButtonMaximumWidth = 485.0; | 55 const CGFloat kBookmarkMenuButtonMaximumWidth = 485.0; |
56 | 56 |
57 // Horizontal separation between a menu button and both edges of its menu. | |
58 const CGFloat kBookmarkSubMenuHorizontalPadding = 5.0; | |
59 | |
60 // TODO(mrossetti): Add constant (kBookmarkVerticalSeparation) for the gap | 57 // TODO(mrossetti): Add constant (kBookmarkVerticalSeparation) for the gap |
61 // between buttons in a folder menu. Right now we're using | 58 // between buttons in a folder menu. Right now we're using |
62 // kBookmarkVerticalPadding, which is dual purpose and wrong. | 59 // kBookmarkVerticalPadding, which is dual purpose and wrong. |
63 // http://crbug.com/59057 | 60 // http://crbug.com/59057 |
64 | 61 |
65 // Convenience constant giving the vertical distance from the top extent of one | 62 // Convenience constant giving the vertical distance from the top extent of one |
66 // folder button to the next button. | 63 // folder button to the next button. |
67 const CGFloat kBookmarkButtonVerticalSpan = | 64 const CGFloat kBookmarkButtonVerticalSpan = |
68 kBookmarkButtonHeight + kBookmarkVerticalPadding; | 65 kBookmarkButtonHeight + kBookmarkVerticalPadding; |
69 | 66 |
70 // The minimum separation between a folder menu and the edge of the screen. | 67 // The minimum separation between a folder menu and the edge of the screen. |
71 // If the menu gets closer to the edge of the screen (either right or left) | 68 // If the menu gets closer to the edge of the screen (either right or left) |
72 // then it is pops up in the opposite direction. | 69 // then it is pops up in the opposite direction. |
73 // (See -[BookmarkBarFolderController childFolderWindowLeftForWidth:]). | 70 // (See -[BookmarkBarFolderController childFolderWindowLeftForWidth:]). |
74 const CGFloat kBookmarkHorizontalScreenPadding = 8.0; | 71 const CGFloat kBookmarkHorizontalScreenPadding = 8.0; |
75 | 72 |
76 // Our NSScrollView is supposed to be just barely big enough to fit its | 73 // Our NSScrollView is supposed to be just barely big enough to fit its |
77 // contentView. It is actually a hair too small. | 74 // contentView. It is actually a hair too small. |
78 // This turns on horizontal scrolling which, although slight, is awkward. | 75 // This turns on horizontal scrolling which, although slight, is awkward. |
79 // Make sure our window (and NSScrollView) are wider than its documentView | 76 // Make sure our window (and NSScrollView) are wider than its documentView |
80 // by at least this much. | 77 // by at least this much. |
81 const CGFloat kScrollViewContentWidthMargin = 2; | 78 const CGFloat kScrollViewContentWidthMargin = 2; |
82 | 79 |
83 // Make subfolder menus overlap their parent menu a bit to give a better | 80 // Make subfolder menus overlap their parent menu a bit to give a better |
84 // perception of a menuing system. | 81 // perception of a menuing system. |
85 const CGFloat kBookmarkMenuOverlap = 5.0; | 82 const CGFloat kBookmarkMenuOverlap = 2.0; |
| 83 |
| 84 // When constraining a scrolling bookmark bar folder window to the |
| 85 // screen, shrink the "constrain" by this much vertically. Currently |
| 86 // this is 0.0 to avoid a problem with tracking areas leaving the |
| 87 // window, but should probably be 8.0 or something. |
| 88 const CGFloat kScrollWindowVerticalMargin = 6.0; |
| 89 |
| 90 // How far to offset a folder menu from the top of the bookmark bar. This |
| 91 // is set just above the bar so that it become distinctive when drawn. |
| 92 const CGFloat kBookmarkBarMenuOffset = 2.0; |
86 | 93 |
87 // Delay before opening a subfolder (and closing the previous one) | 94 // Delay before opening a subfolder (and closing the previous one) |
88 // when hovering over a folder button. | 95 // when hovering over a folder button. |
89 const NSTimeInterval kHoverOpenDelay = 0.3; | 96 const NSTimeInterval kHoverOpenDelay = 0.3; |
90 | 97 |
91 // Delay on hover before a submenu opens when dragging. | 98 // Delay on hover before a submenu opens when dragging. |
92 // Experimentally a drag hover open delay needs to be bigger than a | 99 // Experimentally a drag hover open delay needs to be bigger than a |
93 // normal (non-drag) menu hover open such as used in the bookmark folder. | 100 // normal (non-drag) menu hover open such as used in the bookmark folder. |
94 // TODO(jrg): confirm feel of this constant with ui-team. | 101 // TODO(jrg): confirm feel of this constant with ui-team. |
95 // http://crbug.com/36276 | 102 // http://crbug.com/36276 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 397 |
391 // The following are for testing purposes only and are not used internally. | 398 // The following are for testing purposes only and are not used internally. |
392 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; | 399 - (NSMenu *)menuForFolderNode:(const BookmarkNode*)node; |
393 - (NSMenu*)buttonContextMenu; | 400 - (NSMenu*)buttonContextMenu; |
394 - (void)setButtonContextMenu:(id)menu; | 401 - (void)setButtonContextMenu:(id)menu; |
395 // Set to YES in order to prevent animations. | 402 // Set to YES in order to prevent animations. |
396 - (void)setIgnoreAnimations:(BOOL)ignore; | 403 - (void)setIgnoreAnimations:(BOOL)ignore; |
397 @end | 404 @end |
398 | 405 |
399 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ | 406 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONTROLLER_H_ |
OLD | NEW |