| OLD | NEW |
| 1 // Copyright (c) 2011 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_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "chrome/browser/ui/cocoa/background_gradient_view.h" |
| 10 #import "chrome/browser/ui/cocoa/tracking_area.h" | 11 #import "chrome/browser/ui/cocoa/tracking_area.h" |
| 11 | 12 |
| 12 @class CrTrackingArea; | 13 @class CrTrackingArea; |
| 13 @class PanelWindowControllerCocoa; | 14 @class PanelWindowControllerCocoa; |
| 14 | 15 |
| 15 // A class that works as a custom titlebar for Panels. It is placed on top of | 16 // A class that works as a custom titlebar for Panels. It is placed on top of |
| 16 // the regular Cocoa titlebar. We paint theme image on it, and it's | 17 // the regular Cocoa titlebar. We paint theme image on it, and it's |
| 17 // the place for the close button, wrench button, page favicon, title label. | 18 // the place for the close button, wrench button, page favicon, title label. |
| 18 // It also facilitates dragging and minimization of the panels, and changes | 19 // It also facilitates dragging and minimization of the panels, and changes |
| 19 // color as 'new activity' indicator. | 20 // color as 'new activity' indicator. |
| 20 // One way to have custom titlebar would be to use NSBorderlessWindow, | 21 // One way to have custom titlebar would be to use NSBorderlessWindow, |
| 21 // but it seems to affect too many other behaviors (for example, it draws shadow | 22 // but it seems to affect too many other behaviors (for example, it draws shadow |
| 22 // differently based on being key window) so it appears easier to simply overlay | 23 // differently based on being key window) so it appears easier to simply overlay |
| 23 // the standard titlebar. | 24 // the standard titlebar. |
| 24 | 25 |
| 25 @interface PanelTitlebarViewCocoa : NSView { | 26 @interface PanelTitlebarViewCocoa : BackgroundGradientView { |
| 26 IBOutlet PanelWindowControllerCocoa* controller_; | 27 IBOutlet PanelWindowControllerCocoa* controller_; |
| 27 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed | 28 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed |
| 28 // when view is destroyed, as a subview. | 29 // when view is destroyed, as a subview. |
| 29 ScopedCrTrackingArea closeButtonTrackingArea_; | 30 ScopedCrTrackingArea closeButtonTrackingArea_; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // Callback from Close button. | 33 // Callback from Close button. |
| 33 - (void)onCloseButtonClick:(id)sender; | 34 - (void)onCloseButtonClick:(id)sender; |
| 34 | 35 |
| 35 // Attaches this view to the controller_'s window as a titlebar. | 36 // Attaches this view to the controller_'s window as a titlebar. |
| 36 - (void)attach; | 37 - (void)attach; |
| 37 | 38 |
| 39 - (void)setTitle:(NSString*)newTitle; |
| 40 |
| 38 // Should be called when size of the titlebar changes. | 41 // Should be called when size of the titlebar changes. |
| 39 - (void)updateCloseButtonLayout; | 42 - (void)updateCloseButtonLayout; |
| 40 | 43 |
| 41 // Accessor to Panel's controller. | 44 // Accessor to Panel's controller. |
| 42 - (PanelWindowControllerCocoa*)controller; | 45 - (PanelWindowControllerCocoa*)controller; |
| 43 | 46 |
| 44 @end // @interface PanelTitlebarView | 47 @end // @interface PanelTitlebarView |
| 45 | 48 |
| 46 // Methods which are either only for testing, or only public for testing. | 49 // Methods which are either only for testing, or only public for testing. |
| 47 @interface PanelTitlebarViewCocoa(TestingAPI) | 50 @interface PanelTitlebarViewCocoa(TestingAPI) |
| 48 | 51 |
| 49 // Simulates click on a close button. Used to test panel closing. | 52 // Simulates click on a close button. Used to test panel closing. |
| 50 - (void)simulateCloseButtonClick; | 53 - (void)simulateCloseButtonClick; |
| 51 | 54 |
| 52 @end // @interface PanelTitlebarViewCocoa(TestingAPI) | 55 @end // @interface PanelTitlebarViewCocoa(TestingAPI) |
| 53 | 56 |
| 54 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ | 57 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ |
| OLD | NEW |