| 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 // A simple custom NSView for the bookmark bar used to prevent clicking and | 5 // A simple custom NSView for the bookmark bar used to prevent clicking and |
| 6 // dragging from moving the browser window. | 6 // dragging from moving the browser window. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 8 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
| 9 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 9 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
| 10 | 10 |
| 11 #import <Cocoa/Cocoa.h> | 11 #import <Cocoa/Cocoa.h> |
| 12 | 12 |
| 13 #import "chrome/browser/ui/cocoa/background_gradient_view.h" | 13 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
| 14 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 14 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 15 | 15 |
| 16 @class BookmarkBarController; | 16 @class BookmarkBarController; |
| 17 @class BookmarkBarImportButton; | |
| 18 @class BookmarkBarItemContainer; | 17 @class BookmarkBarItemContainer; |
| 19 @class BookmarkBarTextField; | 18 @class BookmarkBarTextField; |
| 20 | 19 |
| 21 @interface BookmarkBarView : BackgroundGradientView { | 20 @interface BookmarkBarView : BackgroundGradientView { |
| 22 @private | 21 @private |
| 23 BOOL dropIndicatorShown_; | 22 BOOL dropIndicatorShown_; |
| 24 CGFloat dropIndicatorPosition_; // x position | 23 CGFloat dropIndicatorPosition_; // x position |
| 25 | 24 |
| 26 IBOutlet BookmarkBarController* controller_; | 25 IBOutlet BookmarkBarController* controller_; |
| 27 IBOutlet BookmarkBarTextField* noItemTextfield_; | 26 IBOutlet BookmarkBarTextField* noItemTextfield_; |
| 28 IBOutlet BookmarkBarImportButton* importBookmarksButton_; | 27 IBOutlet NSButton* importBookmarksButton_; |
| 29 BookmarkBarItemContainer* noItemContainer_; | 28 BookmarkBarItemContainer* noItemContainer_; |
| 30 } | 29 } |
| 31 - (BookmarkBarTextField*)noItemTextfield; | 30 - (BookmarkBarTextField*)noItemTextfield; |
| 32 - (BookmarkBarImportButton*)importBookmarksButton; | 31 - (NSButton*)importBookmarksButton; |
| 33 - (BookmarkBarController*)controller; | 32 - (BookmarkBarController*)controller; |
| 34 | 33 |
| 35 @property(nonatomic, assign) IBOutlet BookmarkBarItemContainer* noItemContainer; | 34 @property(nonatomic, assign) IBOutlet BookmarkBarItemContainer* noItemContainer; |
| 36 @end | 35 @end |
| 37 | 36 |
| 38 @interface BookmarkBarView() // TestingOrInternalAPI | 37 @interface BookmarkBarView() // TestingOrInternalAPI |
| 39 @property(nonatomic, readonly) BOOL dropIndicatorShown; | 38 @property(nonatomic, readonly) BOOL dropIndicatorShown; |
| 40 @property(nonatomic, readonly) CGFloat dropIndicatorPosition; | 39 @property(nonatomic, readonly) CGFloat dropIndicatorPosition; |
| 41 - (void)setController:(id)controller; | 40 - (void)setController:(id)controller; |
| 42 @end | 41 @end |
| 43 | 42 |
| 44 | 43 |
| 45 // NSTextField subclass responsible for routing -menu to the BookmarBarView. | 44 // NSTextField subclass responsible for routing -menu to the BookmarBarView. |
| 46 // This is necessary when building with the 10.6 SDK because -rightMouseDown: | 45 // This is necessary when building with the 10.6 SDK because -rightMouseDown: |
| 47 // does not follow the responder chain. | 46 // does not follow the responder chain. |
| 48 @interface BookmarkBarTextField : NSTextField { | 47 @interface BookmarkBarTextField : NSTextField { |
| 49 @private | 48 @private |
| 50 IBOutlet BookmarkBarView* barView_; | 49 IBOutlet BookmarkBarView* barView_; |
| 51 } | 50 } |
| 52 @end | 51 @end |
| 53 | 52 |
| 54 // NSButton subclass responsible for routing -menu to the BookmarBarView. | |
| 55 // This is necessary when building with the 10.6 SDK because -rightMouseDown: | |
| 56 // does not follow the responder chain. | |
| 57 @interface BookmarkBarImportButton : NSButton { | |
| 58 @private | |
| 59 IBOutlet BookmarkBarView* barView_; | |
| 60 } | |
| 61 @end | |
| 62 | |
| 63 // GTMWidthBasedTweaker subclass responsible for routing -menu to the | 53 // GTMWidthBasedTweaker subclass responsible for routing -menu to the |
| 64 // BookmarBarView. This is necessary when building with the 10.6 SDK because | 54 // BookmarBarView. This is necessary when building with the 10.6 SDK because |
| 65 // -rightMouseDown: does not follow the responder chain. | 55 // -rightMouseDown: does not follow the responder chain. |
| 66 @interface BookmarkBarItemContainer : GTMWidthBasedTweaker { | 56 @interface BookmarkBarItemContainer : GTMWidthBasedTweaker { |
| 67 @private | 57 @private |
| 68 IBOutlet BookmarkBarView* barView_; | 58 IBOutlet BookmarkBarView* barView_; |
| 69 } | 59 } |
| 70 @end | 60 @end |
| 71 | 61 |
| 72 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ | 62 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ |
| OLD | NEW |