| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/button/native_button_win.h" | 5 #include "views/controls/button/native_button_win.h" |
| 6 | 6 |
| 7 #include <commctrl.h> | 7 #include <commctrl.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/scoped_comptr_win.h" | 11 #include "base/scoped_comptr_win.h" |
| 12 #include "base/win_util.h" | 12 #include "base/win_util.h" |
| 13 #include "base/win/windows_version.h" |
| 13 #include "views/controls/button/checkbox.h" | 14 #include "views/controls/button/checkbox.h" |
| 14 #include "views/controls/button/native_button.h" | 15 #include "views/controls/button/native_button.h" |
| 15 #include "views/controls/button/radio_button.h" | 16 #include "views/controls/button/radio_button.h" |
| 16 #include "views/widget/widget.h" | 17 #include "views/widget/widget.h" |
| 17 | 18 |
| 18 namespace views { | 19 namespace views { |
| 19 | 20 |
| 20 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
| 21 // NativeButtonWin, public: | 22 // NativeButtonWin, public: |
| 22 | 23 |
| 23 NativeButtonWin::NativeButtonWin(NativeButton* native_button) | 24 NativeButtonWin::NativeButtonWin(NativeButton* native_button) |
| 24 : native_button_(native_button), | 25 : native_button_(native_button), |
| 25 button_size_valid_(false) { | 26 button_size_valid_(false) { |
| 26 // Associates the actual HWND with the native_button so the native_button is | 27 // Associates the actual HWND with the native_button so the native_button is |
| 27 // the one considered as having the focus (not the wrapper) when the HWND is | 28 // the one considered as having the focus (not the wrapper) when the HWND is |
| 28 // focused directly (with a click for example). | 29 // focused directly (with a click for example). |
| 29 set_focus_view(native_button); | 30 set_focus_view(native_button); |
| 30 } | 31 } |
| 31 | 32 |
| 32 NativeButtonWin::~NativeButtonWin() { | 33 NativeButtonWin::~NativeButtonWin() { |
| 33 } | 34 } |
| 34 | 35 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 36 // NativeButtonWin, NativeButtonWrapper implementation: | 37 // NativeButtonWin, NativeButtonWrapper implementation: |
| 37 | 38 |
| 38 void NativeButtonWin::UpdateLabel() { | 39 void NativeButtonWin::UpdateLabel() { |
| 39 // Show or hide the shield icon of Windows onto this button every time when we | 40 // Show or hide the shield icon of Windows onto this button every time when we |
| 40 // update the button text so Windows can lay out the shield icon and the | 41 // update the button text so Windows can lay out the shield icon and the |
| 41 // button text correctly. | 42 // button text correctly. |
| 42 if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA && | 43 if (base::win::GetVersion() >= base::win::VERSION_VISTA && |
| 43 win_util::UserAccountControlIsEnabled()) { | 44 win_util::UserAccountControlIsEnabled()) { |
| 44 Button_SetElevationRequiredState(native_view(), | 45 Button_SetElevationRequiredState(native_view(), |
| 45 native_button_->need_elevation()); | 46 native_button_->need_elevation()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 SetWindowText(native_view(), native_button_->label().c_str()); | 49 SetWindowText(native_view(), native_button_->label().c_str()); |
| 49 button_size_valid_ = false; | 50 button_size_valid_ = false; |
| 50 } | 51 } |
| 51 | 52 |
| 52 void NativeButtonWin::UpdateFont() { | 53 void NativeButtonWin::UpdateFont() { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return new NativeCheckboxWin(checkbox); | 275 return new NativeCheckboxWin(checkbox); |
| 275 } | 276 } |
| 276 | 277 |
| 277 // static | 278 // static |
| 278 NativeButtonWrapper* NativeButtonWrapper::CreateRadioButtonWrapper( | 279 NativeButtonWrapper* NativeButtonWrapper::CreateRadioButtonWrapper( |
| 279 RadioButton* radio_button) { | 280 RadioButton* radio_button) { |
| 280 return new NativeRadioButtonWin(radio_button); | 281 return new NativeRadioButtonWin(radio_button); |
| 281 } | 282 } |
| 282 | 283 |
| 283 } // namespace views | 284 } // namespace views |
| OLD | NEW |