| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // released. Use these simple states to track this condition. | 28 // released. Use these simple states to track this condition. |
| 29 enum PanelDragState { | 29 enum PanelDragState { |
| 30 PANEL_DRAG_CAN_START, // Mouse key went down, drag may be started. | 30 PANEL_DRAG_CAN_START, // Mouse key went down, drag may be started. |
| 31 PANEL_DRAG_IN_PROGRESS, | 31 PANEL_DRAG_IN_PROGRESS, |
| 32 PANEL_DRAG_SUPPRESSED // Ignore drag events until PANEL_DRAG_CAN_START. | 32 PANEL_DRAG_SUPPRESSED // Ignore drag events until PANEL_DRAG_CAN_START. |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 @interface PanelTitlebarViewCocoa : NSView { | 35 @interface PanelTitlebarViewCocoa : NSView { |
| 36 @private | 36 @private |
| 37 IBOutlet PanelWindowControllerCocoa* controller_; | 37 IBOutlet PanelWindowControllerCocoa* controller_; |
| 38 IBOutlet NSImageView* icon_; |
| 38 IBOutlet NSTextField* title_; | 39 IBOutlet NSTextField* title_; |
| 39 IBOutlet HoverImageButton* settingsButton_; | 40 IBOutlet HoverImageButton* settingsButton_; |
| 40 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed | 41 NSButton* closeButton_; // Created explicitly, not from NIB. Weak, destroyed |
| 41 // when view is destroyed, as a subview. | 42 // when view is destroyed, as a subview. |
| 42 ScopedCrTrackingArea closeButtonTrackingArea_; | 43 ScopedCrTrackingArea closeButtonTrackingArea_; |
| 43 PanelDragState dragState_; | 44 PanelDragState dragState_; |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Callback from Close button. | 47 // Callback from Close button. |
| 47 - (void)onCloseButtonClick:(id)sender; | 48 - (void)onCloseButtonClick:(id)sender; |
| 48 | 49 |
| 49 // Callback from Settings button. | 50 // Callback from Settings button. |
| 50 - (void)onSettingsButtonClick:(id)sender; | 51 - (void)onSettingsButtonClick:(id)sender; |
| 51 | 52 |
| 52 // Attaches this view to the controller_'s window as a titlebar. | 53 // Attaches this view to the controller_'s window as a titlebar. |
| 53 - (void)attach; | 54 - (void)attach; |
| 54 | 55 |
| 55 - (void)setTitle:(NSString*)newTitle; | 56 - (void)setTitle:(NSString*)newTitle; |
| 57 - (void)setIcon:(NSImage*)newIcon; |
| 56 | 58 |
| 57 // Should be called when size of the titlebar changes. | 59 // Should be called when size of the titlebar changes. |
| 58 - (void)updateCloseButtonLayout; | 60 - (void)updateCloseButtonLayout; |
| 61 - (void)updateIconAndTitleLayout; |
| 59 | 62 |
| 60 // We need to update our look when the Chrome theme changes or window focus | 63 // We need to update our look when the Chrome theme changes or window focus |
| 61 // changes. | 64 // changes. |
| 62 - (void)didChangeTheme:(NSNotification*)notification; | 65 - (void)didChangeTheme:(NSNotification*)notification; |
| 63 - (void)didChangeMainWindow:(NSNotification*)notification; | 66 - (void)didChangeMainWindow:(NSNotification*)notification; |
| 64 | 67 |
| 65 // Helpers to control title drag operation, called from more then one place. | 68 // Helpers to control title drag operation, called from more then one place. |
| 66 // TODO(dimich): replace BOOL parameter that we have to explicitly specify at | 69 // TODO(dimich): replace BOOL parameter that we have to explicitly specify at |
| 67 // callsites with an enum defined in PanelManager. | 70 // callsites with an enum defined in PanelManager. |
| 68 - (void)startDrag; | 71 - (void)startDrag; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 - (void)pressLeftMouseButtonTitlebar; | 89 - (void)pressLeftMouseButtonTitlebar; |
| 87 - (void)releaseLeftMouseButtonTitlebar; | 90 - (void)releaseLeftMouseButtonTitlebar; |
| 88 - (void)dragTitlebarDeltaX:(double)delta_x | 91 - (void)dragTitlebarDeltaX:(double)delta_x |
| 89 deltaY:(double)delta_y; | 92 deltaY:(double)delta_y; |
| 90 - (void)cancelDragTitlebar; | 93 - (void)cancelDragTitlebar; |
| 91 - (void)finishDragTitlebar; | 94 - (void)finishDragTitlebar; |
| 92 | 95 |
| 93 @end // @interface PanelTitlebarViewCocoa(TestingAPI) | 96 @end // @interface PanelTitlebarViewCocoa(TestingAPI) |
| 94 | 97 |
| 95 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ | 98 #endif // CHROME_BROWSER_UI_PANELS_PANEL_TITLEBAR_VIEW_COCOA_H_ |
| OLD | NEW |