OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/mac/cocoa_protocols.h" | 10 #import "base/mac/cocoa_protocols.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 IBOutlet NSView* settingsButtonWrapper_; | 51 IBOutlet NSView* settingsButtonWrapper_; |
52 IBOutlet HoverImageButton* settingsButton_; | 52 IBOutlet HoverImageButton* settingsButton_; |
53 // Transparent view on top of entire titlebar. It catches mouse events to | 53 // Transparent view on top of entire titlebar. It catches mouse events to |
54 // prevent window activation by the system on mouseDown. | 54 // prevent window activation by the system on mouseDown. |
55 IBOutlet NSView* overlay_; | 55 IBOutlet NSView* overlay_; |
56 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed | 56 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed |
57 // when view is destroyed, as a subview. | 57 // when view is destroyed, as a subview. |
58 ScopedCrTrackingArea closeButtonTrackingArea_; | 58 ScopedCrTrackingArea closeButtonTrackingArea_; |
59 PanelDragState dragState_; | 59 PanelDragState dragState_; |
60 BOOL isDrawingAttention_; | 60 BOOL isDrawingAttention_; |
61 NSPoint dragStartLocation_; | 61 NSPoint dragStartLocation_; // in screen coordinates. |
62 // "Glint" animation is used in "Draw Attention" mode. | 62 // "Glint" animation is used in "Draw Attention" mode. |
63 scoped_nsobject<RepaintAnimation> glintAnimation_; | 63 scoped_nsobject<RepaintAnimation> glintAnimation_; |
64 scoped_nsobject<NSTimer> glintAnimationTimer_; | 64 scoped_nsobject<NSTimer> glintAnimationTimer_; |
65 double glintInterval_; | 65 double glintInterval_; |
66 } | 66 } |
67 | 67 |
68 // Callback from Close button. | 68 // Callback from Close button. |
69 - (void)onCloseButtonClick:(id)sender; | 69 - (void)onCloseButtonClick:(id)sender; |
70 | 70 |
71 // Callback from Settings button. | 71 // Callback from Settings button. |
(...skipping 10 matching lines...) Expand all Loading... |
82 // Should be called when size of the titlebar changes. | 82 // Should be called when size of the titlebar changes. |
83 - (void)updateCloseButtonLayout; | 83 - (void)updateCloseButtonLayout; |
84 - (void)updateIconAndTitleLayout; | 84 - (void)updateIconAndTitleLayout; |
85 | 85 |
86 // Various events that we'll need to redraw our titlebar for. | 86 // Various events that we'll need to redraw our titlebar for. |
87 - (void)didChangeFrame:(NSNotification*)notification; | 87 - (void)didChangeFrame:(NSNotification*)notification; |
88 - (void)didChangeTheme:(NSNotification*)notification; | 88 - (void)didChangeTheme:(NSNotification*)notification; |
89 - (void)didChangeMainWindow:(NSNotification*)notification; | 89 - (void)didChangeMainWindow:(NSNotification*)notification; |
90 | 90 |
91 // Helpers to control title drag operation, called from more then one place. | 91 // Helpers to control title drag operation, called from more then one place. |
92 - (void)startDrag; | 92 // |mouseLocation| is in screen coordinates. |
| 93 - (void)startDrag:(NSPoint)mouseLocation; |
93 - (void)endDrag:(BOOL)cancelled; | 94 - (void)endDrag:(BOOL)cancelled; |
94 - (void)dragWithDeltaX:(int)deltaX | 95 - (void)drag:(NSPoint)mouseLocation; |
95 deltaY:(int)deltaY; | |
96 | 96 |
97 // Update the visibility of settings button. | 97 // Update the visibility of settings button. |
98 - (void)updateSettingsButtonVisibility:(BOOL)mouseOverWindow; | 98 - (void)updateSettingsButtonVisibility:(BOOL)mouseOverWindow; |
99 - (void)checkMouseAndUpdateSettingsButtonVisibility; | 99 - (void)checkMouseAndUpdateSettingsButtonVisibility; |
100 | 100 |
101 // Draw Attention methods - change appearance of titlebar to attract user. | 101 // Draw Attention methods - change appearance of titlebar to attract user. |
102 - (void)drawAttention; | 102 - (void)drawAttention; |
103 - (void)stopDrawingAttention; | 103 - (void)stopDrawingAttention; |
104 - (BOOL)isDrawingAttention; | 104 - (BOOL)isDrawingAttention; |
105 - (void)startGlintAnimation; | 105 - (void)startGlintAnimation; |
106 - (void)restartGlintAnimation:(NSTimer*)timer; | 106 - (void)restartGlintAnimation:(NSTimer*)timer; |
107 - (void)stopGlintAnimation; | 107 - (void)stopGlintAnimation; |
108 | 108 |
109 // Returns width of titlebar when shown in "icon only" mode. | 109 // Returns width of titlebar when shown in "icon only" mode. |
110 - (int)iconOnlyWidthInScreenCoordinates; | 110 - (int)iconOnlyWidthInScreenCoordinates; |
111 | 111 |
112 @end // @interface PanelTitlebarView | 112 @end // @interface PanelTitlebarView |
113 | 113 |
114 // Methods which are either only for testing, or only public for testing. | 114 // Methods which are either only for testing, or only public for testing. |
115 @interface PanelTitlebarViewCocoa(TestingAPI) | 115 @interface PanelTitlebarViewCocoa(TestingAPI) |
116 | 116 |
117 - (PanelWindowControllerCocoa*)controller; | 117 - (PanelWindowControllerCocoa*)controller; |
118 | 118 |
119 - (NSTextField*)title; | 119 - (NSTextField*)title; |
120 | 120 |
121 // Simulates click on a close button. Used to test panel closing. | 121 // Simulates click on a close button. Used to test panel closing. |
122 - (void)simulateCloseButtonClick; | 122 - (void)simulateCloseButtonClick; |
123 | 123 |
124 // NativePanelTesting support. | 124 // NativePanelTesting support. |
125 - (void)pressLeftMouseButtonTitlebar; | 125 - (void)pressLeftMouseButtonTitlebar:(NSPoint)mouseLocation; |
126 - (void)releaseLeftMouseButtonTitlebar; | 126 - (void)releaseLeftMouseButtonTitlebar; |
127 - (void)dragTitlebarDeltaX:(double)delta_x | 127 - (void)dragTitlebar:(NSPoint)mouseLocation; |
128 deltaY:(double)delta_y; | |
129 - (void)cancelDragTitlebar; | 128 - (void)cancelDragTitlebar; |
130 - (void)finishDragTitlebar; | 129 - (void)finishDragTitlebar; |
131 | 130 |
132 @end // @interface PanelTitlebarViewCocoa(TestingAPI) | 131 @end // @interface PanelTitlebarViewCocoa(TestingAPI) |
133 | 132 |
134 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ | 133 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ |
OLD | NEW |