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 "chrome/views/button_dropdown.h" | 5 #include "chrome/views/button_dropdown.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/back_forward_menu_model.h" | 8 #include "chrome/browser/back_forward_menu_model.h" |
9 #include "chrome/common/l10n_util.h" | 9 #include "chrome/common/l10n_util.h" |
10 #include "chrome/views/view_menu_delegate.h" | 10 #include "chrome/views/view_menu_delegate.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
130 Menu::AnchorPoint anchor = Menu::TOPLEFT; | 130 Menu::AnchorPoint anchor = Menu::TOPLEFT; |
131 if (UILayoutIsRightToLeft()) | 131 if (UILayoutIsRightToLeft()) |
132 anchor = Menu::TOPRIGHT; | 132 anchor = Menu::TOPRIGHT; |
133 | 133 |
134 View::ConvertPointToScreen(this, &menu_position); | 134 View::ConvertPointToScreen(this, &menu_position); |
| 135 |
| 136 int left_bound = GetSystemMetrics(SM_XVIRTUALSCREEN); |
| 137 if (menu_position.x() < left_bound) |
| 138 menu_position.set_x(left_bound); |
| 139 |
135 Menu menu(menu_delegate_, anchor, window); | 140 Menu menu(menu_delegate_, anchor, window); |
136 | 141 |
137 // ID's for AppendMenu is 1-based because RunMenu will ignore the user | 142 // ID's for AppendMenu is 1-based because RunMenu will ignore the user |
138 // selection if id=0 is selected (0 = NO-OP) so we add 1 here and subtract 1 | 143 // selection if id=0 is selected (0 = NO-OP) so we add 1 here and subtract 1 |
139 // in the handlers above to get the actual index | 144 // in the handlers above to get the actual index |
140 int item_count = menu_delegate_->GetItemCount(); | 145 int item_count = menu_delegate_->GetItemCount(); |
141 for (int i = 0; i < item_count; i++) { | 146 for (int i = 0; i < item_count; i++) { |
142 if (menu_delegate_->IsItemSeparator(i + 1)) { | 147 if (menu_delegate_->IsItemSeparator(i + 1)) { |
143 menu.AppendSeparator(); | 148 menu.AppendSeparator(); |
144 } else { | 149 } else { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 } | 185 } |
181 | 186 |
182 bool ButtonDropDown::GetAccessibleState(VARIANT* state) { | 187 bool ButtonDropDown::GetAccessibleState(VARIANT* state) { |
183 DCHECK(state); | 188 DCHECK(state); |
184 | 189 |
185 state->lVal |= STATE_SYSTEM_HASPOPUP; | 190 state->lVal |= STATE_SYSTEM_HASPOPUP; |
186 return true; | 191 return true; |
187 } | 192 } |
188 | 193 |
189 } // namespace views | 194 } // namespace views |
190 | |
OLD | NEW |