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 #include "ui/views/controls/button/menu_button.h" | 5 #include "ui/views/controls/button/menu_button.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void MenuButton::OnMouseExited(const MouseEvent& event) { | 217 void MenuButton::OnMouseExited(const MouseEvent& event) { |
218 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { | 218 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { |
219 SetState(BS_NORMAL); | 219 SetState(BS_NORMAL); |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 ui::GestureStatus MenuButton::OnGestureEvent(const GestureEvent& event) { | 223 ui::GestureStatus MenuButton::OnGestureEvent(const GestureEvent& event) { |
224 if (state() != BS_DISABLED && event.type() == ui::ET_GESTURE_TAP) { | 224 if (state() != BS_DISABLED && event.type() == ui::ET_GESTURE_TAP) { |
225 if (Activate()) | 225 if (Activate()) |
226 return ui::GESTURE_STATUS_CONSUMED; | 226 return ui::GESTURE_STATUS_CONSUMED; |
| 227 return ui::GESTURE_STATUS_UNKNOWN; |
227 } | 228 } |
228 return TextButton::OnGestureEvent(event); | 229 return TextButton::OnGestureEvent(event); |
229 } | 230 } |
230 | 231 |
231 bool MenuButton::OnKeyPressed(const KeyEvent& event) { | 232 bool MenuButton::OnKeyPressed(const KeyEvent& event) { |
232 switch (event.key_code()) { | 233 switch (event.key_code()) { |
233 case ui::VKEY_SPACE: | 234 case ui::VKEY_SPACE: |
234 // Alt-space on windows should show the window menu. | 235 // Alt-space on windows should show the window menu. |
235 if (event.IsAltDown()) | 236 if (event.IsAltDown()) |
236 break; | 237 break; |
(...skipping 27 matching lines...) Expand all Loading... |
264 if (!GetWidget()) { | 265 if (!GetWidget()) { |
265 NOTREACHED(); | 266 NOTREACHED(); |
266 return 0; | 267 return 0; |
267 } | 268 } |
268 | 269 |
269 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); | 270 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); |
270 return monitor_bounds.right() - 1; | 271 return monitor_bounds.right() - 1; |
271 } | 272 } |
272 | 273 |
273 } // namespace views | 274 } // namespace views |
OLD | NEW |