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/menu/menu_win.h" | 5 #include "views/controls/menu/menu_win.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 rect.right -= kItemRightMargin; | 153 rect.right -= kItemRightMargin; |
154 UINT format = DT_TOP | DT_SINGLELINE; | 154 UINT format = DT_TOP | DT_SINGLELINE; |
155 // Check whether the mnemonics should be underlined. | 155 // Check whether the mnemonics should be underlined. |
156 BOOL underline_mnemonics; | 156 BOOL underline_mnemonics; |
157 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0); | 157 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0); |
158 if (!underline_mnemonics) | 158 if (!underline_mnemonics) |
159 format |= DT_HIDEPREFIX; | 159 format |= DT_HIDEPREFIX; |
160 gfx::Font font; | 160 gfx::Font font; |
161 HGDIOBJ old_font = | 161 HGDIOBJ old_font = |
162 static_cast<HFONT>(SelectObject(hDC, font.GetNativeFont())); | 162 static_cast<HFONT>(SelectObject(hDC, font.GetNativeFont())); |
163 int fontsize = font.GetFontSize(); | |
164 | 163 |
165 // If an accelerator is specified (with a tab delimiting the rest of the | 164 // If an accelerator is specified (with a tab delimiting the rest of the |
166 // label from the accelerator), we have to justify the fist part on the | 165 // label from the accelerator), we have to justify the fist part on the |
167 // left and the accelerator on the right. | 166 // left and the accelerator on the right. |
168 // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the | 167 // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the |
169 // window system UI font and will not hit here. | 168 // window system UI font and will not hit here. |
170 std::wstring label = data->label; | 169 std::wstring label = data->label; |
171 std::wstring accel; | 170 std::wstring accel; |
172 std::wstring::size_type tab_pos = label.find(L'\t'); | 171 std::wstring::size_type tab_pos = label.find(L'\t'); |
173 if (tab_pos != std::wstring::npos) { | 172 if (tab_pos != std::wstring::npos) { |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 break; | 566 break; |
568 | 567 |
569 default: | 568 default: |
570 NOTREACHED(); | 569 NOTREACHED(); |
571 return 0; | 570 return 0; |
572 } | 571 } |
573 return align_flags; | 572 return align_flags; |
574 } | 573 } |
575 | 574 |
576 } // namespace views | 575 } // namespace views |
OLD | NEW |