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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return Activate(); | 182 return Activate(); |
183 } | 183 } |
184 } | 184 } |
185 } | 185 } |
186 return true; | 186 return true; |
187 } | 187 } |
188 | 188 |
189 void MenuButton::OnMouseReleased(const MouseEvent& e, | 189 void MenuButton::OnMouseReleased(const MouseEvent& e, |
190 bool canceled) { | 190 bool canceled) { |
191 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && | 191 if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && |
192 state() != BS_DISABLED && !canceled && !InDrag() && | 192 state() != BS_DISABLED && !canceled && !InDrag() && !IsTriggerableEvent(e) |
193 e.IsOnlyLeftMouseButton() && HitTest(e.location())) { | 193 && HitTest(e.location())) { |
194 Activate(); | 194 Activate(); |
195 } else { | 195 } else { |
196 TextButton::OnMouseReleased(e, canceled); | 196 TextButton::OnMouseReleased(e, canceled); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 // When the space bar or the enter key is pressed we need to show the menu. | 200 // When the space bar or the enter key is pressed we need to show the menu. |
201 bool MenuButton::OnKeyReleased(const KeyEvent& e) { | 201 bool MenuButton::OnKeyReleased(const KeyEvent& e) { |
202 #if defined(OS_WIN) | 202 #if defined(OS_WIN) |
203 if ((e.GetKeyCode() == base::VKEY_SPACE) || | 203 if ((e.GetKeyCode() == base::VKEY_SPACE) || |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { | 244 bool MenuButton::GetAccessibleState(AccessibilityTypes::State* state) { |
245 DCHECK(state); | 245 DCHECK(state); |
246 | 246 |
247 *state = AccessibilityTypes::STATE_HASPOPUP; | 247 *state = AccessibilityTypes::STATE_HASPOPUP; |
248 return true; | 248 return true; |
249 } | 249 } |
250 | 250 |
251 } // namespace views | 251 } // namespace views |
OLD | NEW |