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

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

Issue 5694001: Rework how bookmark bar folder menus and submenus are layed out when scrollin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 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_FOLDER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_CONTROLLER_H_
7 #pragma once
8
5 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
6 10
7 #include "base/scoped_nsobject.h" 11 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h"
9 13
10 @class BookmarkBarController; 14 @class BookmarkBarController;
11 @class BookmarkBarFolderView; 15 @class BookmarkBarFolderView;
12 @class BookmarkFolderTarget; 16 @class BookmarkFolderTarget;
13 @class BookmarkBarFolderHoverState; 17 @class BookmarkBarFolderHoverState;
18 @class BookmarkBarFolderWindow;
19 @class BookmarkBarFolderWindowContentView;
14 20
15 // A controller for the pop-up windows from bookmark folder buttons 21 // A controller for the pop-up windows from bookmark folder buttons
16 // which look sort of like menus. 22 // which look sort of like menus.
17 @interface BookmarkBarFolderController : 23 @interface BookmarkBarFolderController :
18 NSWindowController<BookmarkButtonDelegate, 24 NSWindowController<BookmarkButtonDelegate,
19 BookmarkButtonControllerProtocol> { 25 BookmarkButtonControllerProtocol> {
20 @private 26 @private
21 // The button whose click opened us. 27 // The button whose click opened us.
22 scoped_nsobject<BookmarkButton> parentButton_; 28 scoped_nsobject<BookmarkButton> parentButton_;
23 29
(...skipping 29 matching lines...) Expand all
53 59
54 // The main bar controller from whence we or a parent sprang. 60 // The main bar controller from whence we or a parent sprang.
55 BookmarkBarController* barController_; // WEAK: It owns us. 61 BookmarkBarController* barController_; // WEAK: It owns us.
56 62
57 // Our buttons. We do not have buttons for nested folders. 63 // Our buttons. We do not have buttons for nested folders.
58 scoped_nsobject<NSMutableArray> buttons_; 64 scoped_nsobject<NSMutableArray> buttons_;
59 65
60 // The scroll view that contains our main button view (below). 66 // The scroll view that contains our main button view (below).
61 IBOutlet NSScrollView* scrollView_; 67 IBOutlet NSScrollView* scrollView_;
62 68
63 // Are we scrollable? If no, the full contents of the folder are 69 // The view defining the visible area in which we draw our content.
64 // always visible. 70 IBOutlet BookmarkBarFolderWindowContentView* visibleView_;
65 BOOL scrollable_;
66 71
67 BOOL scrollUpArrowShown_; 72 // The main view of this window (where the buttons go) within the scroller.
68 BOOL scrollDownArrowShown_; 73 IBOutlet BookmarkBarFolderView* folderView_;
74
75 // A window used to show the shadow behind the main window when it is
76 // scrollable.
77 IBOutlet BookmarkBarFolderWindow* shadowWindow_;
John Grabowski 2011/01/06 23:30:18 Why are you faking a shadow yourself instead of us
mrossetti 2011/01/08 01:45:38 Added commentary to explain.
78
79 // The up and down scroll arrow views.
John Grabowski 2011/01/06 23:30:18 Be clear that these views are not inside the scrol
mrossetti 2011/01/08 01:45:38 Added commentary.
80 IBOutlet NSView* scrollDownArrowView_; // Positioned at the top.
81 IBOutlet NSView* scrollUpArrowView_; // Positioned at the bottom.
69 82
70 // YES if subfolders should grow to the right (the default). 83 // YES if subfolders should grow to the right (the default).
71 // Direction switches if we'd grow off the screen. 84 // Direction switches if we'd grow off the screen.
72 BOOL subFolderGrowthToRight_; 85 BOOL subFolderGrowthToRight_;
73 86
74 // The main view of this window (where the buttons go).
75 IBOutlet BookmarkBarFolderView* mainView_;
76
77 // Weak; we keep track to work around a 87 // Weak; we keep track to work around a
78 // setShowsBorderOnlyWhileMouseInside bug. 88 // setShowsBorderOnlyWhileMouseInside bug.
79 BookmarkButton* buttonThatMouseIsIn_; 89 BookmarkButton* buttonThatMouseIsIn_;
80 90
81 // The context menu for a bookmark button which represents an URL. 91 // The context menu for a bookmark button which represents an URL.
82 IBOutlet NSMenu* buttonMenu_; 92 IBOutlet NSMenu* buttonMenu_;
83 93
84 // The context menu for a bookmark button which represents a folder. 94 // The context menu for a bookmark button which represents a folder.
85 IBOutlet NSMenu* folderMenu_; 95 IBOutlet NSMenu* folderMenu_;
86 96
(...skipping 11 matching lines...) Expand all
98 // window closes the controller gets autoreleased). 108 // window closes the controller gets autoreleased).
99 BookmarkBarFolderController* folderController_; 109 BookmarkBarFolderController* folderController_;
100 110
101 // Implement basic menu scrolling through this tracking area. 111 // Implement basic menu scrolling through this tracking area.
102 scoped_nsobject<NSTrackingArea> scrollTrackingArea_; 112 scoped_nsobject<NSTrackingArea> scrollTrackingArea_;
103 113
104 // Timer to continue scrolling as needed. We own the timer but 114 // Timer to continue scrolling as needed. We own the timer but
105 // don't release it when done (we invalidate it). 115 // don't release it when done (we invalidate it).
106 NSTimer* scrollTimer_; 116 NSTimer* scrollTimer_;
107 117
118 // Precalculated left and right edge padding of buttons in a folder menu.
John Grabowski 2011/01/06 23:30:18 Reading this quickly I wonder why these aren't con
mrossetti 2011/01/08 01:45:38 These are calculated from the nib layout and are n
119 CGFloat leftPadding_;
120 CGFloat rightPadding_;
121
108 // Amount to scroll by on each timer fire. Can be + or -. 122 // Amount to scroll by on each timer fire. Can be + or -.
109 CGFloat verticalScrollDelta_; 123 CGFloat verticalScrollDelta_;
110 124
111 // We need to know the size of the vertical scrolling arrows so we 125 // We need to know the size of the vertical scrolling arrows so we
112 // can obscure/unobscure them. 126 // can obscure/unobscure them.
113 CGFloat verticalScrollArrowHeight_; 127 CGFloat verticalScrollArrowHeight_;
114 128
115 // Set to YES to prevent any node animations. Useful for unit testing so that 129 // Set to YES to prevent any node animations. Useful for unit testing so that
116 // incomplete animations do not cause valgrind complaints. 130 // incomplete animations do not cause valgrind complaints.
117 BOOL ignoreAnimations_; 131 BOOL ignoreAnimations_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 - (IBAction)openAllBookmarksNewWindow:(id)sender; 168 - (IBAction)openAllBookmarksNewWindow:(id)sender;
155 - (IBAction)openBookmarkInIncognitoWindow:(id)sender; 169 - (IBAction)openBookmarkInIncognitoWindow:(id)sender;
156 - (IBAction)openBookmarkInNewForegroundTab:(id)sender; 170 - (IBAction)openBookmarkInNewForegroundTab:(id)sender;
157 - (IBAction)openBookmarkInNewWindow:(id)sender; 171 - (IBAction)openBookmarkInNewWindow:(id)sender;
158 172
159 @property (assign, nonatomic) BOOL subFolderGrowthToRight; 173 @property (assign, nonatomic) BOOL subFolderGrowthToRight;
160 174
161 @end 175 @end
162 176
163 @interface BookmarkBarFolderController(TestingAPI) 177 @interface BookmarkBarFolderController(TestingAPI)
164 - (NSView*)mainView;
165 - (NSPoint)windowTopLeftForWidth:(int)windowWidth; 178 - (NSPoint)windowTopLeftForWidth:(int)windowWidth;
166 - (NSArray*)buttons; 179 - (NSArray*)buttons;
167 - (BookmarkBarFolderController*)folderController; 180 - (BookmarkBarFolderController*)folderController;
168 - (id)folderTarget; 181 - (id)folderTarget;
169 - (void)configureWindowLevel; 182 - (void)configureWindowLevel;
170 - (void)performOneScroll:(CGFloat)delta; 183 - (void)performOneScroll:(CGFloat)delta;
171 - (BookmarkButton*)buttonThatMouseIsIn; 184 - (BookmarkButton*)buttonThatMouseIsIn;
172 // Set to YES in order to prevent animations. 185 // Set to YES in order to prevent animations.
173 - (void)setIgnoreAnimations:(BOOL)ignore; 186 - (void)setIgnoreAnimations:(BOOL)ignore;
174 187
175 // Return YES if we can scroll up or down. 188 // Return YES if the scroll-up or scroll-down arrows are showing.
176 - (BOOL)canScrollUp; 189 - (BOOL)canScrollUp;
177 - (BOOL)canScrollDown; 190 - (BOOL)canScrollDown;
178 // Return YES if the scrollable_ flag has been set. 191 - (CGFloat)verticalScrollArrowHeight;
179 - (BOOL)scrollable; 192 - (NSView*)visibleView;
193 - (NSView*)scrollView;
194 - (NSView*)folderView;
180 195
181 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; 196 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point;
182 @end 197 @end
198
199 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698