| 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/button_dropdown.h" | 5 #include "views/controls/button/button_dropdown.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "grit/app_strings.h" | 10 #include "grit/app_strings.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Make the button look depressed while the menu is open. | 109 // Make the button look depressed while the menu is open. |
| 110 // NOTE: SetState() schedules a paint, but it won't occur until after the | 110 // NOTE: SetState() schedules a paint, but it won't occur until after the |
| 111 // context menu message loop has terminated, so we PaintNow() to | 111 // context menu message loop has terminated, so we PaintNow() to |
| 112 // update the appearance synchronously. | 112 // update the appearance synchronously. |
| 113 SetState(BS_PUSHED); | 113 SetState(BS_PUSHED); |
| 114 PaintNow(); | 114 PaintNow(); |
| 115 ShowDropDownMenu(GetWidget()->GetNativeView()); | 115 ShowDropDownMenu(GetWidget()->GetNativeView()); |
| 116 SetState(BS_HOT); | 116 SetState(BS_HOT); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void ButtonDropDown::ShowDropDownMenu(HWND window) { | 119 void ButtonDropDown::ShowDropDownMenu(gfx::NativeView window) { |
| 120 if (menu_delegate_) { | 120 if (menu_delegate_) { |
| 121 gfx::Rect lb = GetLocalBounds(true); | 121 gfx::Rect lb = GetLocalBounds(true); |
| 122 | 122 |
| 123 // Both the menu position and the menu anchor type change if the UI layout | 123 // Both the menu position and the menu anchor type change if the UI layout |
| 124 // is right-to-left. | 124 // is right-to-left. |
| 125 gfx::Point menu_position(lb.origin()); | 125 gfx::Point menu_position(lb.origin()); |
| 126 menu_position.Offset(0, lb.height() - 1); | 126 menu_position.Offset(0, lb.height() - 1); |
| 127 if (UILayoutIsRightToLeft()) | 127 if (UILayoutIsRightToLeft()) |
| 128 menu_position.Offset(lb.width() - 1, 0); | 128 menu_position.Offset(lb.width() - 1, 0); |
| 129 | 129 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool ButtonDropDown::GetAccessibleState(AccessibilityTypes::State* state) { | 186 bool ButtonDropDown::GetAccessibleState(AccessibilityTypes::State* state) { |
| 187 DCHECK(state); | 187 DCHECK(state); |
| 188 | 188 |
| 189 *state = AccessibilityTypes::STATE_HASPOPUP; | 189 *state = AccessibilityTypes::STATE_HASPOPUP; |
| 190 return true; | 190 return true; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace views | 193 } // namespace views |
| OLD | NEW |