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