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

Side by Side Diff: ui/views/controls/native_control_win.cc

Issue 23769011: Move a bunch of windows stuff from ui/base/win to ui/gfx/win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar bustage. Created 7 years, 3 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
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/native_control_win.h" 5 #include "ui/views/controls/native_control_win.h"
6 6
7 #include <windowsx.h> 7 #include <windowsx.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/accessibility/accessibility_types.h" 10 #include "ui/base/accessibility/accessibility_types.h"
11 #include "ui/base/l10n/l10n_util_win.h" 11 #include "ui/base/l10n/l10n_util_win.h"
12 #include "ui/base/view_prop.h" 12 #include "ui/base/view_prop.h"
13 #include "ui/base/win/hwnd_util.h" 13 #include "ui/gfx/win/hwnd_util.h"
14 #include "ui/views/controls/combobox/combobox.h" 14 #include "ui/views/controls/combobox/combobox.h"
15 #include "ui/views/focus/focus_manager.h" 15 #include "ui/views/focus/focus_manager.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 using ui::ViewProp; 18 using ui::ViewProp;
19 19
20 const char kNativeControlWinKey[] = "__NATIVE_CONTROL_WIN__"; 20 const char kNativeControlWinKey[] = "__NATIVE_CONTROL_WIN__";
21 21
22 namespace views { 22 namespace views {
23 23
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 } 133 }
134 134
135 void NativeControlWin::NativeControlCreated(HWND native_control) { 135 void NativeControlWin::NativeControlCreated(HWND native_control) {
136 // Associate this object with the control's HWND so that NativeWidgetWin can 136 // Associate this object with the control's HWND so that NativeWidgetWin can
137 // find this object when it receives messages from it. 137 // find this object when it receives messages from it.
138 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this)); 138 props_.push_back(new ViewProp(native_control, kNativeControlWinKey, this));
139 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this)); 139 props_.push_back(ChildWindowMessageProcessor::Register(native_control, this));
140 140
141 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages. 141 // Subclass so we get WM_KEYDOWN and WM_SETFOCUS messages.
142 original_wndproc_ = ui::SetWindowProc( 142 original_wndproc_ = gfx::SetWindowProc(
143 native_control, &NativeControlWin::NativeControlWndProc); 143 native_control, &NativeControlWin::NativeControlWndProc);
144 144
145 Attach(native_control); 145 Attach(native_control);
146 // native_view() is now valid. 146 // native_view() is now valid.
147 147
148 // Update the newly created HWND with any resident enabled state. 148 // Update the newly created HWND with any resident enabled state.
149 EnableWindow(native_view(), enabled()); 149 EnableWindow(native_view(), enabled());
150 150
151 // This message ensures that the focus border is shown. 151 // This message ensures that the focus border is shown.
152 SendMessage(native_view(), WM_CHANGEUISTATE, 152 SendMessage(native_view(), WM_CHANGEUISTATE,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } else if (message == WM_SETFOCUS) { 209 } else if (message == WM_SETFOCUS) {
210 // Let the focus manager know that the focus changed. 210 // Let the focus manager know that the focus changed.
211 FocusManager* focus_manager = native_control->GetFocusManager(); 211 FocusManager* focus_manager = native_control->GetFocusManager();
212 if (focus_manager) { 212 if (focus_manager) {
213 focus_manager->SetFocusedView(native_control->focus_view()); 213 focus_manager->SetFocusedView(native_control->focus_view());
214 } else { 214 } else {
215 NOTREACHED(); 215 NOTREACHED();
216 } 216 }
217 } else if (message == WM_DESTROY) { 217 } else if (message == WM_DESTROY) {
218 native_control->props_.clear(); 218 native_control->props_.clear();
219 ui::SetWindowProc(window, native_control->original_wndproc_); 219 gfx::SetWindowProc(window, native_control->original_wndproc_);
220 } 220 }
221 221
222 return CallWindowProc(native_control->original_wndproc_, window, message, 222 return CallWindowProc(native_control->original_wndproc_, window, message,
223 w_param, l_param); 223 w_param, l_param);
224 } 224 }
225 225
226 } // namespace views 226 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/native_control.cc ('k') | ui/views/controls/textfield/native_textfield_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698