| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/button_dropdown.h" | 5 #include "views/controls/button/button_dropdown.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "grit/app_strings.h" | 10 #include "grit/app_strings.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 SetState(BS_PUSHED); | 117 SetState(BS_PUSHED); |
| 118 PaintNow(); | 118 PaintNow(); |
| 119 ShowDropDownMenu(GetWidget()->GetNativeView()); | 119 ShowDropDownMenu(GetWidget()->GetNativeView()); |
| 120 SetState(BS_HOT); | 120 SetState(BS_HOT); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool ButtonDropDown::ShouldEnterPushedState(const MouseEvent& e) { | 123 bool ButtonDropDown::ShouldEnterPushedState(const MouseEvent& e) { |
| 124 // Enter PUSHED state on press with Left or Right mouse button. Remain | 124 // Enter PUSHED state on press with Left or Right mouse button. Remain |
| 125 // in this state while the context menu is open. | 125 // in this state while the context menu is open. |
| 126 return ((MouseEvent::EF_LEFT_BUTTON_DOWN | | 126 return ((MouseEvent::EF_LEFT_BUTTON_DOWN | |
| 127 MouseEvent::EF_RIGHT_BUTTON_DOWN) & e.GetFlags()) != 0; | 127 MouseEvent::EF_RIGHT_BUTTON_DOWN) & e.flags()) != 0; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { | 130 void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { |
| 131 if (model_) { | 131 if (model_) { |
| 132 gfx::Rect lb = GetLocalBounds(); | 132 gfx::Rect lb = GetLocalBounds(); |
| 133 | 133 |
| 134 // Both the menu position and the menu anchor type change if the UI layout | 134 // Both the menu position and the menu anchor type change if the UI layout |
| 135 // is right-to-left. | 135 // is right-to-left. |
| 136 gfx::Point menu_position(lb.origin()); | 136 gfx::Point menu_position(lb.origin()); |
| 137 menu_position.Offset(0, lb.height() - 1); | 137 menu_position.Offset(0, lb.height() - 1); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 AccessibilityTypes::Role ButtonDropDown::GetAccessibleRole() { | 172 AccessibilityTypes::Role ButtonDropDown::GetAccessibleRole() { |
| 173 return AccessibilityTypes::ROLE_BUTTONDROPDOWN; | 173 return AccessibilityTypes::ROLE_BUTTONDROPDOWN; |
| 174 } | 174 } |
| 175 | 175 |
| 176 AccessibilityTypes::State ButtonDropDown::GetAccessibleState() { | 176 AccessibilityTypes::State ButtonDropDown::GetAccessibleState() { |
| 177 return AccessibilityTypes::STATE_HASPOPUP; | 177 return AccessibilityTypes::STATE_HASPOPUP; |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace views | 180 } // namespace views |
| OLD | NEW |