| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "views/controls/button/menu_button.h" | 5 #include "views/controls/button/menu_button.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return Activate(); | 183 return Activate(); |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void MenuButton::OnMouseReleased(const MouseEvent& e, | 190 void MenuButton::OnMouseReleased(const MouseEvent& e, |
| 191 bool canceled) { | 191 bool canceled) { |
| 192 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && | 192 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && |
| 193 state() != BS_DISABLED && !canceled && !InDrag() && | 193 state() != BS_DISABLED && !canceled && !InDrag() && !IsTriggerableEvent(e) |
| 194 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { | 194 && HitTest(e.location())) { |
| 195 Activate(); | 195 Activate(); |
| 196 } else { | 196 } else { |
| 197 TextButton::OnMouseReleased(e, canceled); | 197 TextButton::OnMouseReleased(e, canceled); |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| 201 // When the space bar or the enter key is pressed we need to show the menu. | 201 // When the space bar or the enter key is pressed we need to show the menu. |
| 202 bool MenuButton::OnKeyReleased(const KeyEvent& e) { | 202 bool MenuButton::OnKeyReleased(const KeyEvent& e) { |
| 203 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
| 204 if ((e.GetKeyCode() == base::VKEY_SPACE) || | 204 if ((e.GetKeyCode() == base::VKEY_SPACE) || |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 243 } |
| 244 | 244 |
| 245 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { | 245 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { |
| 246 DCHECK(state); | 246 DCHECK(state); |
| 247 | 247 |
| 248 *state = AccessibilityTypes::STATE_HASPOPUP; | 248 *state = AccessibilityTypes::STATE_HASPOPUP; |
| 249 return true; | 249 return true; |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace views | 252 } // namespace views |
| OLD | NEW |