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/native_control.h" | 5 #include "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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 if (f != IsVisible()) { | 305 if (f != IsVisible()) { |
306 View::SetVisible(f); | 306 View::SetVisible(f); |
307 if (!f && container_) { | 307 if (!f && container_) { |
308 ::DestroyWindow(*container_); | 308 ::DestroyWindow(*container_); |
309 } else if (f && !container_) { | 309 } else if (f && !container_) { |
310 ValidateNativeControl(); | 310 ValidateNativeControl(); |
311 } | 311 } |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
315 void NativeControl::SetEnabled(bool enabled) { | 315 void NativeControl::OnEnabledChanged() { |
316 if (enabled_ != enabled) { | 316 View::OnEnabledChanged(); |
317 View::SetEnabled(enabled); | 317 if (GetNativeControlHWND()) |
318 if (GetNativeControlHWND()) { | 318 EnableWindow(GetNativeControlHWND(), View::IsEnabled()); |
319 EnableWindow(GetNativeControlHWND(), enabled_); | |
320 } | |
321 } | |
322 } | 319 } |
323 | 320 |
324 void NativeControl::OnPaint(gfx::Canvas* canvas) { | 321 void NativeControl::OnPaint(gfx::Canvas* canvas) { |
325 } | 322 } |
326 | 323 |
327 void NativeControl::VisibilityChanged(View* starting_from, bool is_visible) { | 324 void NativeControl::VisibilityChanged(View* starting_from, bool is_visible) { |
328 SetVisible(is_visible); | 325 SetVisible(is_visible); |
329 } | 326 } |
330 | 327 |
331 void NativeControl::SetFixedWidth(int width, Alignment alignment) { | 328 void NativeControl::SetFixedWidth(int width, Alignment alignment) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } else if (message == WM_DESTROY) { | 384 } else if (message == WM_DESTROY) { |
388 ui::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); | 385 ui::SetWindowProc(window, reinterpret_cast<WNDPROC>(original_handler)); |
389 native_control->container_->prop_.reset(); | 386 native_control->container_->prop_.reset(); |
390 } | 387 } |
391 | 388 |
392 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, | 389 return CallWindowProc(reinterpret_cast<WNDPROC>(original_handler), window, |
393 message, w_param, l_param); | 390 message, w_param, l_param); |
394 } | 391 } |
395 | 392 |
396 } // namespace views | 393 } // namespace views |
OLD | NEW |