| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "views/controls/combobox/native_combobox_win.h" | 5 #include "views/controls/combobox/native_combobox_win.h" |
| 6 | 6 |
| 7 #include "app/gfx/font.h" | 7 #include "app/gfx/font.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/gfx/native_theme.h" | 10 #include "base/gfx/native_theme.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 View* NativeComboboxWin::GetView() { | 131 View* NativeComboboxWin::GetView() { |
| 132 return this; | 132 return this; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void NativeComboboxWin::SetFocus() { | 135 void NativeComboboxWin::SetFocus() { |
| 136 Focus(); | 136 Focus(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 gfx::NativeView NativeComboboxWin::GetTestingHandle() const { |
| 140 return native_view(); |
| 141 } |
| 142 |
| 139 //////////////////////////////////////////////////////////////////////////////// | 143 //////////////////////////////////////////////////////////////////////////////// |
| 140 // NativeComboboxWin, NativeControlWin overrides: | 144 // NativeComboboxWin, NativeControlWin overrides: |
| 141 | 145 |
| 142 bool NativeComboboxWin::ProcessMessage(UINT message, | 146 bool NativeComboboxWin::ProcessMessage(UINT message, |
| 143 WPARAM w_param, | 147 WPARAM w_param, |
| 144 LPARAM l_param, | 148 LPARAM l_param, |
| 145 LRESULT* result) { | 149 LRESULT* result) { |
| 146 if (message == WM_COMMAND && HIWORD(w_param) == CBN_SELCHANGE) { | 150 if (message == WM_COMMAND && HIWORD(w_param) == CBN_SELCHANGE) { |
| 147 combobox_->SelectionChanged(); | 151 combobox_->SelectionChanged(); |
| 148 *result = 0; | 152 *result = 0; |
| 149 return true; | 153 return true; |
| 150 } | 154 } |
| 151 return NativeControlWin::ProcessMessage(message, w_param, l_param, result); | 155 return NativeControlWin::ProcessMessage(message, w_param, l_param, result); |
| 152 } | 156 } |
| 153 | 157 |
| 154 void NativeComboboxWin::CreateNativeControl() { | 158 void NativeComboboxWin::CreateNativeControl() { |
| 155 // It's ok to add WS_VSCROLL. The scrollbar will show up only when necessary | 159 // It's ok to add WS_VSCROLL. The scrollbar will show up only when necessary |
| 156 // as long as we don't use CBS_DISABLENOSCROLL. | 160 // as long as we don't use CBS_DISABLENOSCROLL. |
| 157 // See http://msdn.microsoft.com/en-us/library/7h63bxbe(VS.80).aspx | 161 // See http://msdn.microsoft.com/en-us/library/7h63bxbe(VS.80).aspx |
| 158 DWORD flags = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | | 162 DWORD flags = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | |
| 159 CBS_DROPDOWNLIST | WS_VSCROLL; | 163 CBS_DROPDOWNLIST | WS_VSCROLL; |
| 160 HWND control_hwnd = ::CreateWindowEx(GetAdditionalExStyle(), L"COMBOBOX", L"", | 164 HWND control_hwnd = ::CreateWindowEx(GetAdditionalExStyle(), L"COMBOBOX", L"", |
| 161 flags, 0, 0, 100, 20, //width(), height()
, | 165 flags, 0, 0, width(), height(), |
| 162 GetWidget()->GetNativeView(), NULL, NULL, | 166 GetWidget()->GetNativeView(), NULL, NULL, |
| 163 NULL); | 167 NULL); |
| 164 NativeControlCreated(control_hwnd); | 168 NativeControlCreated(control_hwnd); |
| 165 } | 169 } |
| 166 | 170 |
| 167 void NativeComboboxWin::NativeControlCreated(HWND native_control) { | 171 void NativeComboboxWin::NativeControlCreated(HWND native_control) { |
| 168 NativeControlWin::NativeControlCreated(native_control); | 172 NativeControlWin::NativeControlCreated(native_control); |
| 169 | 173 |
| 170 UpdateFont(); | 174 UpdateFont(); |
| 171 UpdateFromModel(); | 175 UpdateFromModel(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 183 //////////////////////////////////////////////////////////////////////////////// | 187 //////////////////////////////////////////////////////////////////////////////// |
| 184 // NativeComboboxWrapper, public: | 188 // NativeComboboxWrapper, public: |
| 185 | 189 |
| 186 // static | 190 // static |
| 187 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( | 191 NativeComboboxWrapper* NativeComboboxWrapper::CreateWrapper( |
| 188 Combobox* combobox) { | 192 Combobox* combobox) { |
| 189 return new NativeComboboxWin(combobox); | 193 return new NativeComboboxWin(combobox); |
| 190 } | 194 } |
| 191 | 195 |
| 192 } // namespace views | 196 } // namespace views |
| OLD | NEW |