Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: ui/views/controls/combobox/native_combobox_win.cc

Issue 10387121: Revert 136996 - ui: Move NativeTheme files into ui/base/native_theme/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/button/text_button.cc ('k') | ui/views/controls/focusable_border.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/combobox/native_combobox_win.h" 5 #include "ui/views/controls/combobox/native_combobox_win.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/base/models/combobox_model.h" 9 #include "ui/base/models/combobox_model.h"
10 #include "ui/base/native_theme/native_theme_win.h"
11 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/base/win/hwnd_util.h" 11 #include "ui/base/win/hwnd_util.h"
13 #include "ui/gfx/font.h" 12 #include "ui/gfx/font.h"
13 #include "ui/gfx/native_theme_win.h"
14 #include "ui/views/controls/combobox/combobox.h" 14 #include "ui/views/controls/combobox/combobox.h"
15 #include "ui/views/controls/combobox/native_combobox_views.h" 15 #include "ui/views/controls/combobox/native_combobox_views.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 namespace { 18 namespace {
19 19
20 // Limit how small a combobox can be. 20 // Limit how small a combobox can be.
21 const int kMinComboboxWidth = 148; 21 const int kMinComboboxWidth = 148;
22 22
23 // Add a couple extra pixels to the widths of comboboxes and combobox 23 // Add a couple extra pixels to the widths of comboboxes and combobox
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 gfx::Size NativeComboboxWin::GetPreferredSize() { 104 gfx::Size NativeComboboxWin::GetPreferredSize() {
105 COMBOBOXINFO cbi = { 0 }; 105 COMBOBOXINFO cbi = { 0 };
106 cbi.cbSize = sizeof(cbi); 106 cbi.cbSize = sizeof(cbi);
107 // Note: Don't use CB_GETCOMBOBOXINFO since that crashes on WOW64 systems 107 // Note: Don't use CB_GETCOMBOBOXINFO since that crashes on WOW64 systems
108 // when you have a global message hook installed. 108 // when you have a global message hook installed.
109 GetComboBoxInfo(native_view(), &cbi); 109 GetComboBoxInfo(native_view(), &cbi);
110 gfx::Rect rect_item(cbi.rcItem); 110 gfx::Rect rect_item(cbi.rcItem);
111 gfx::Rect rect_button(cbi.rcButton); 111 gfx::Rect rect_button(cbi.rcButton);
112 gfx::Size border = ui::NativeThemeWin::instance()->GetThemeBorderSize( 112 gfx::Size border = gfx::NativeThemeWin::instance()->GetThemeBorderSize(
113 ui::NativeThemeWin::MENULIST); 113 gfx::NativeThemeWin::MENULIST);
114 114
115 // The padding value of '3' is the xy offset from the corner of the control 115 // The padding value of '3' is the xy offset from the corner of the control
116 // to the corner of rcItem. It does not seem to be queryable from the theme. 116 // to the corner of rcItem. It does not seem to be queryable from the theme.
117 // It is consistent on all versions of Windows from 2K to Vista, and is 117 // It is consistent on all versions of Windows from 2K to Vista, and is
118 // invariant with respect to the combobox border size. We could conceivably 118 // invariant with respect to the combobox border size. We could conceivably
119 // get this number from rect_item.x, but it seems fragile to depend on 119 // get this number from rect_item.x, but it seems fragile to depend on
120 // position here, inside of the layout code. 120 // position here, inside of the layout code.
121 const int kItemOffset = 3; 121 const int kItemOffset = 3;
122 int item_to_button_distance = std::max(kItemOffset - border.width(), 0); 122 int item_to_button_distance = std::max(kItemOffset - border.width(), 0);
123 123
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( 208 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper(
209 Combobox* combobox) { 209 Combobox* combobox) {
210 #if defined(USE_AURA) 210 #if defined(USE_AURA)
211 return new NativeComboboxViews(combobox); 211 return new NativeComboboxViews(combobox);
212 #else 212 #else
213 return new NativeComboboxWin(combobox); 213 return new NativeComboboxWin(combobox);
214 #endif 214 #endif
215 } 215 }
216 216
217 } // namespace views 217 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/text_button.cc ('k') | ui/views/controls/focusable_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698