| 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/native_menu_win.h" | 5 #include "views/controls/menu/native_menu_win.h" |
| 6 | 6 |
| 7 #include <Windowsx.h> | 7 #include <Windowsx.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 rect.right -= kItemRightMargin; | 211 rect.right -= kItemRightMargin; |
| 212 UINT format = DT_TOP | DT_SINGLELINE; | 212 UINT format = DT_TOP | DT_SINGLELINE; |
| 213 // Check whether the mnemonics should be underlined. | 213 // Check whether the mnemonics should be underlined. |
| 214 BOOL underline_mnemonics; | 214 BOOL underline_mnemonics; |
| 215 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0); | 215 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &underline_mnemonics, 0); |
| 216 if (!underline_mnemonics) | 216 if (!underline_mnemonics) |
| 217 format |= DT_HIDEPREFIX; | 217 format |= DT_HIDEPREFIX; |
| 218 gfx::Font font; | 218 gfx::Font font; |
| 219 HGDIOBJ old_font = | 219 HGDIOBJ old_font = |
| 220 static_cast<HFONT>(SelectObject(dc, font.GetNativeFont())); | 220 static_cast<HFONT>(SelectObject(dc, font.GetNativeFont())); |
| 221 int fontsize = font.GetFontSize(); | |
| 222 | 221 |
| 223 // If an accelerator is specified (with a tab delimiting the rest of the | 222 // If an accelerator is specified (with a tab delimiting the rest of the |
| 224 // label from the accelerator), we have to justify the fist part on the | 223 // label from the accelerator), we have to justify the fist part on the |
| 225 // left and the accelerator on the right. | 224 // left and the accelerator on the right. |
| 226 // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the | 225 // TODO(jungshik): This will break in RTL UI. Currently, he/ar use the |
| 227 // window system UI font and will not hit here. | 226 // window system UI font and will not hit here. |
| 228 std::wstring label = data->label; | 227 std::wstring label = data->label; |
| 229 std::wstring accel; | 228 std::wstring accel; |
| 230 std::wstring::size_type tab_pos = label.find(L'\t'); | 229 std::wstring::size_type tab_pos = label.find(L'\t'); |
| 231 if (tab_pos != std::wstring::npos) { | 230 if (tab_pos != std::wstring::npos) { |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 757 |
| 759 //////////////////////////////////////////////////////////////////////////////// | 758 //////////////////////////////////////////////////////////////////////////////// |
| 760 // MenuWrapper, public: | 759 // MenuWrapper, public: |
| 761 | 760 |
| 762 // static | 761 // static |
| 763 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { | 762 MenuWrapper* MenuWrapper::CreateWrapper(Menu2* menu) { |
| 764 return new NativeMenuWin(menu->model(), NULL); | 763 return new NativeMenuWin(menu->model(), NULL); |
| 765 } | 764 } |
| 766 | 765 |
| 767 } // namespace views | 766 } // namespace views |
| OLD | NEW |