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

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. (A 'shadow' window is needed because the main window, when
77 // scrollable in either or both directions, will reach completely to the
78 // top and/or bottom edge of the screen in order to support mouse tracking
79 // during scrolling operations. In that case, though, the 'visible'
80 // window must be inset a bit from the edge of the screen for aesthetics;
81 // it will also be inset much more from the bottom of the screen when the
82 // Dock is showing. When scrollable, the main window would show a shadow
83 // incorrectly positioned, hence the 'shadow' window.)
84 IBOutlet BookmarkBarFolderWindow* shadowWindow_;
85
86 // The up and down scroll arrow views. These arrows are hidden and shown
87 // as necessary (when scrolling is possible) and are contained in the nib
88 // as siblings to the scroll view.
89 IBOutlet NSView* scrollDownArrowView_; // Positioned at the top.
90 IBOutlet NSView* scrollUpArrowView_; // Positioned at the bottom.
69 91
70 // YES if subfolders should grow to the right (the default). 92 // YES if subfolders should grow to the right (the default).
71 // Direction switches if we'd grow off the screen. 93 // Direction switches if we'd grow off the screen.
72 BOOL subFolderGrowthToRight_; 94 BOOL subFolderGrowthToRight_;
73 95
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 96 // Weak; we keep track to work around a
78 // setShowsBorderOnlyWhileMouseInside bug. 97 // setShowsBorderOnlyWhileMouseInside bug.
79 BookmarkButton* buttonThatMouseIsIn_; 98 BookmarkButton* buttonThatMouseIsIn_;
80 99
81 // The context menu for a bookmark button which represents an URL. 100 // The context menu for a bookmark button which represents an URL.
82 IBOutlet NSMenu* buttonMenu_; 101 IBOutlet NSMenu* buttonMenu_;
83 102
84 // The context menu for a bookmark button which represents a folder. 103 // The context menu for a bookmark button which represents a folder.
85 IBOutlet NSMenu* folderMenu_; 104 IBOutlet NSMenu* folderMenu_;
86 105
(...skipping 11 matching lines...) Expand all
98 // window closes the controller gets autoreleased). 117 // window closes the controller gets autoreleased).
99 BookmarkBarFolderController* folderController_; 118 BookmarkBarFolderController* folderController_;
100 119
101 // Implement basic menu scrolling through this tracking area. 120 // Implement basic menu scrolling through this tracking area.
102 scoped_nsobject<NSTrackingArea> scrollTrackingArea_; 121 scoped_nsobject<NSTrackingArea> scrollTrackingArea_;
103 122
104 // Timer to continue scrolling as needed. We own the timer but 123 // Timer to continue scrolling as needed. We own the timer but
105 // don't release it when done (we invalidate it). 124 // don't release it when done (we invalidate it).
106 NSTimer* scrollTimer_; 125 NSTimer* scrollTimer_;
107 126
127 // Precalculated sum of left and right edge padding of buttons in a
128 // folder menu window. This is calculated from the widths of the main
129 // folder menu window and the scroll view within.
130 CGFloat padding_;
131
108 // Amount to scroll by on each timer fire. Can be + or -. 132 // Amount to scroll by on each timer fire. Can be + or -.
109 CGFloat verticalScrollDelta_; 133 CGFloat verticalScrollDelta_;
110 134
111 // We need to know the size of the vertical scrolling arrows so we 135 // We need to know the size of the vertical scrolling arrows so we
112 // can obscure/unobscure them. 136 // can obscure/unobscure them.
113 CGFloat verticalScrollArrowHeight_; 137 CGFloat verticalScrollArrowHeight_;
114 138
115 // Set to YES to prevent any node animations. Useful for unit testing so that 139 // Set to YES to prevent any node animations. Useful for unit testing so that
116 // incomplete animations do not cause valgrind complaints. 140 // incomplete animations do not cause valgrind complaints.
117 BOOL ignoreAnimations_; 141 BOOL ignoreAnimations_;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 - (IBAction)openAllBookmarksNewWindow:(id)sender; 178 - (IBAction)openAllBookmarksNewWindow:(id)sender;
155 - (IBAction)openBookmarkInIncognitoWindow:(id)sender; 179 - (IBAction)openBookmarkInIncognitoWindow:(id)sender;
156 - (IBAction)openBookmarkInNewForegroundTab:(id)sender; 180 - (IBAction)openBookmarkInNewForegroundTab:(id)sender;
157 - (IBAction)openBookmarkInNewWindow:(id)sender; 181 - (IBAction)openBookmarkInNewWindow:(id)sender;
158 182
159 @property (assign, nonatomic) BOOL subFolderGrowthToRight; 183 @property (assign, nonatomic) BOOL subFolderGrowthToRight;
160 184
161 @end 185 @end
162 186
163 @interface BookmarkBarFolderController(TestingAPI) 187 @interface BookmarkBarFolderController(TestingAPI)
164 - (NSView*)mainView;
165 - (NSPoint)windowTopLeftForWidth:(int)windowWidth; 188 - (NSPoint)windowTopLeftForWidth:(int)windowWidth;
166 - (NSArray*)buttons; 189 - (NSArray*)buttons;
167 - (BookmarkBarFolderController*)folderController; 190 - (BookmarkBarFolderController*)folderController;
168 - (id)folderTarget; 191 - (id)folderTarget;
169 - (void)configureWindowLevel; 192 - (void)configureWindowLevel;
170 - (void)performOneScroll:(CGFloat)delta; 193 - (void)performOneScroll:(CGFloat)delta;
171 - (BookmarkButton*)buttonThatMouseIsIn; 194 - (BookmarkButton*)buttonThatMouseIsIn;
172 // Set to YES in order to prevent animations. 195 // Set to YES in order to prevent animations.
173 - (void)setIgnoreAnimations:(BOOL)ignore; 196 - (void)setIgnoreAnimations:(BOOL)ignore;
174 197
175 // Return YES if we can scroll up or down. 198 // Return YES if the scroll-up or scroll-down arrows are showing.
176 - (BOOL)canScrollUp; 199 - (BOOL)canScrollUp;
177 - (BOOL)canScrollDown; 200 - (BOOL)canScrollDown;
178 // Return YES if the scrollable_ flag has been set. 201 - (CGFloat)verticalScrollArrowHeight;
179 - (BOOL)scrollable; 202 - (NSView*)visibleView;
203 - (NSView*)scrollView;
204 - (NSView*)folderView;
180 205
181 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point; 206 - (BookmarkButton*)buttonForDroppingOnAtPoint:(NSPoint)point;
182 @end 207 @end
208
209 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698