| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/menu_button.h" | 5 #import "chrome/browser/cocoa/menu_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 9 #import "chrome/browser/cocoa/clickhold_button_cell.h" | 9 #import "chrome/browser/cocoa/clickhold_button_cell.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 @synthesize menu = menu_; | 48 @synthesize menu = menu_; |
| 49 | 49 |
| 50 @end // @implementation MenuButton | 50 @end // @implementation MenuButton |
| 51 | 51 |
| 52 @implementation MenuButton (Private) | 52 @implementation MenuButton (Private) |
| 53 | 53 |
| 54 // Reset various settings of the button and its associated |ClickHoldButtonCell| | 54 // Reset various settings of the button and its associated |ClickHoldButtonCell| |
| 55 // to the standard state which provides reasonable defaults. | 55 // to the standard state which provides reasonable defaults. |
| 56 - (void)resetToDefaults { | 56 - (void)resetToDefaults { |
| 57 id cell = [self cell]; | 57 ClickHoldButtonCell* cell = [self cell]; |
| 58 DCHECK([cell isKindOfClass:[ClickHoldButtonCell class]]); | 58 DCHECK([cell isKindOfClass:[ClickHoldButtonCell class]]); |
| 59 [cell setEnableClickHold:YES]; | 59 [cell setEnableClickHold:YES]; |
| 60 [cell setClickHoldTimeout:0.0]; // Make menu trigger immediately. | 60 [cell setClickHoldTimeout:0.0]; // Make menu trigger immediately. |
| 61 [cell setAction:@selector(clickShowMenu:)]; | 61 [cell setAction:@selector(clickShowMenu:)]; |
| 62 [cell setTarget:self]; | 62 [cell setTarget:self]; |
| 63 [cell setClickHoldAction:@selector(dragShowMenu:)]; | 63 [cell setClickHoldAction:@selector(dragShowMenu:)]; |
| 64 [cell setClickHoldTarget:self]; | 64 [cell setClickHoldTarget:self]; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Actually show the menu (in the correct location). |isDragging| indicates | 67 // Actually show the menu (in the correct location). |isDragging| indicates |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 - (void)clickShowMenu:(id)sender { | 109 - (void)clickShowMenu:(id)sender { |
| 110 [self showMenu:NO]; | 110 [self showMenu:NO]; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Called when the button is clicked and dragged/held. | 113 // Called when the button is clicked and dragged/held. |
| 114 - (void)dragShowMenu:(id)sender { | 114 - (void)dragShowMenu:(id)sender { |
| 115 [self showMenu:YES]; | 115 [self showMenu:YES]; |
| 116 } | 116 } |
| 117 | 117 |
| 118 @end // @implementation MenuButton (Private) | 118 @end // @implementation MenuButton (Private) |
| OLD | NEW |