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 "ui/views/controls/native_control.h" | 5 #include "ui/views/controls/native_control.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlapp.h> | 8 #include <atlapp.h> |
9 #include <atlcrack.h> | 9 #include <atlcrack.h> |
10 #include <atlframe.h> | 10 #include <atlframe.h> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 void NativeControl::ValidateNativeControl() { | 191 void NativeControl::ValidateNativeControl() { |
192 if (hwnd_view_ == NULL) { | 192 if (hwnd_view_ == NULL) { |
193 hwnd_view_ = new NativeViewHost; | 193 hwnd_view_ = new NativeViewHost; |
194 AddChildView(hwnd_view_); | 194 AddChildView(hwnd_view_); |
195 } | 195 } |
196 | 196 |
197 if (!container_ && IsVisible()) { | 197 if (!container_ && IsVisible()) { |
198 container_ = new NativeControlContainer(this); | 198 container_ = new NativeControlContainer(this); |
199 container_->Init(); | 199 container_->Init(); |
200 hwnd_view_->Attach(*container_); | 200 hwnd_view_->Attach(*container_); |
201 if (!IsEnabled()) | 201 if (!enabled()) |
202 EnableWindow(GetNativeControlHWND(), IsEnabled()); | 202 EnableWindow(GetNativeControlHWND(), enabled()); |
203 | 203 |
204 // This message ensures that the focus border is shown. | 204 // This message ensures that the focus border is shown. |
205 ::SendMessage(container_->GetControl(), | 205 ::SendMessage(container_->GetControl(), |
206 WM_CHANGEUISTATE, | 206 WM_CHANGEUISTATE, |
207 MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), | 207 MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS), |
208 0); | 208 0); |
209 } | 209 } |
210 } | 210 } |
211 | 211 |
212 void NativeControl::ViewHierarchyChanged(bool is_add, View *parent, | 212 void NativeControl::ViewHierarchyChanged(bool is_add, View *parent, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ::DestroyWindow(*container_); | 307 ::DestroyWindow(*container_); |
308 } else if (f && !container_) { | 308 } else if (f && !container_) { |
309 ValidateNativeControl(); | 309 ValidateNativeControl(); |
310 } | 310 } |
311 } | 311 } |
312 } | 312 } |
313 | 313 |
314 void NativeControl::OnEnabledChanged() { | 314 void NativeControl::OnEnabledChanged() { |
315 View::OnEnabledChanged(); | 315 View::OnEnabledChanged(); |
316 if (GetNativeControlHWND()) | 316 if (GetNativeControlHWND()) |
317 EnableWindow(GetNativeControlHWND(), IsEnabled()); | 317 EnableWindow(GetNativeControlHWND(), enabled()); |
318 } | 318 } |
319 | 319 |
320 void NativeControl::OnPaint(gfx::Canvas* canvas) { | 320 void NativeControl::OnPaint(gfx::Canvas* canvas) { |
321 } | 321 } |
322 | 322 |
323 void NativeControl::VisibilityChanged(View* starting_from, bool is_visible) { | 323 void NativeControl::VisibilityChanged(View* starting_from, bool is_visible) { |
324 SetVisible(is_visible); | 324 SetVisible(is_visible); |
325 } | 325 } |
326 | 326 |
327 void NativeControl::SetFixedWidth(int width, Alignment alignment) { | 327 void NativeControl::SetFixedWidth(int width, Alignment alignment) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } else if (message == WM_DESTROY) { | 383 } else if (message == WM_DESTROY) { |
384 ui::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); | 384 ui::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); |
385 native_control->container_->prop_.reset(); | 385 native_control->container_->prop_.reset(); |
386 } | 386 } |
387 | 387 |
388 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 388 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
389 message, w_param, l_param); | 389 message, w_param, l_param); |
390 } | 390 } |
391 | 391 |
392 } // namespace views | 392 } // namespace views |
OLD | NEW |