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