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 #include "views/controls/button/menu_button.h" | 5 #include "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/app_strings.h" | 8 #include "grit/app_strings.h" |
9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 10 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // cause the button to appear depressed while the menu is displayed. | 214 // cause the button to appear depressed while the menu is displayed. |
215 void MenuButton::OnMouseExited(const MouseEvent& event) { | 215 void MenuButton::OnMouseExited(const MouseEvent& event) { |
216 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { | 216 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { |
217 SetState(BS_NORMAL); | 217 SetState(BS_NORMAL); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 bool MenuButton::OnKeyPressed(const KeyEvent& event) { | 221 bool MenuButton::OnKeyPressed(const KeyEvent& event) { |
222 switch (event.key_code()) { | 222 switch (event.key_code()) { |
223 case ui::VKEY_SPACE: | 223 case ui::VKEY_SPACE: |
224 if (event.IsAltDown()) { | |
225 // alt-space on windows should show the window menu. | |
Peter Kasting
2011/07/06 17:47:46
Tiny nit: Capitalize!
(Also, this would be shorte
| |
226 break; | |
227 } | |
224 case ui::VKEY_RETURN: | 228 case ui::VKEY_RETURN: |
225 case ui::VKEY_UP: | 229 case ui::VKEY_UP: |
226 case ui::VKEY_DOWN: { | 230 case ui::VKEY_DOWN: { |
227 bool result = Activate(); | 231 bool result = Activate(); |
228 if (GetFocusManager()->GetFocusedView() == NULL) | 232 if (GetFocusManager()->GetFocusedView() == NULL) |
229 RequestFocus(); | 233 RequestFocus(); |
230 return result; | 234 return result; |
231 } | 235 } |
232 default: | 236 default: |
233 break; | 237 break; |
(...skipping 20 matching lines...) Expand all Loading... | |
254 NOTREACHED(); | 258 NOTREACHED(); |
255 return 0; | 259 return 0; |
256 } | 260 } |
257 | 261 |
258 gfx::Rect monitor_bounds = | 262 gfx::Rect monitor_bounds = |
259 Screen::GetMonitorWorkAreaNearestWindow(GetWidget()->GetNativeView()); | 263 Screen::GetMonitorWorkAreaNearestWindow(GetWidget()->GetNativeView()); |
260 return monitor_bounds.right() - 1; | 264 return monitor_bounds.right() - 1; |
261 } | 265 } |
262 | 266 |
263 } // namespace views | 267 } // namespace views |
OLD | NEW |