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/button/native_button.h" | 5 #include "views/controls/button/native_button.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "ui/base/keycodes/keyboard_codes.h" | 8 #include "ui/base/keycodes/keyboard_codes.h" |
9 #include "views/controls/native/native_view_host.h" | 9 #include "views/controls/native/native_view_host.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 //////////////////////////////////////////////////////////////////////////////// | 37 //////////////////////////////////////////////////////////////////////////////// |
38 // NativeButtonBase, public: | 38 // NativeButtonBase, public: |
39 | 39 |
40 NativeButtonBase::NativeButtonBase(ButtonListener* listener) | 40 NativeButtonBase::NativeButtonBase(ButtonListener* listener) |
41 : Button(listener), | 41 : Button(listener), |
42 native_wrapper_(NULL), | 42 native_wrapper_(NULL), |
43 is_default_(false), | 43 is_default_(false), |
44 need_elevation_(false), | 44 need_elevation_(false), |
45 ignore_minimum_size_(false) { | 45 ignore_minimum_size_(false) { |
46 InitBorder(); | 46 InitBorder(); |
47 SetFocusable(true); | 47 set_focusable(true); |
48 } | 48 } |
49 | 49 |
50 NativeButtonBase::NativeButtonBase(ButtonListener* listener, | 50 NativeButtonBase::NativeButtonBase(ButtonListener* listener, |
51 const std::wstring& label) | 51 const std::wstring& label) |
52 : Button(listener), | 52 : Button(listener), |
53 native_wrapper_(NULL), | 53 native_wrapper_(NULL), |
54 is_default_(false), | 54 is_default_(false), |
55 need_elevation_(false), | 55 need_elevation_(false), |
56 ignore_minimum_size_(false) { | 56 ignore_minimum_size_(false) { |
57 SetLabel(label); // SetLabel takes care of label layout in RTL UI. | 57 SetLabel(label); // SetLabel takes care of label layout in RTL UI. |
58 InitBorder(); | 58 InitBorder(); |
59 SetFocusable(true); | 59 set_focusable(true); |
60 } | 60 } |
61 | 61 |
62 NativeButtonBase::~NativeButtonBase() { | 62 NativeButtonBase::~NativeButtonBase() { |
63 } | 63 } |
64 | 64 |
65 void NativeButtonBase::SetLabel(const std::wstring& label) { | 65 void NativeButtonBase::SetLabel(const std::wstring& label) { |
66 label_ = WideToUTF16Hack(label); | 66 label_ = WideToUTF16Hack(label); |
67 | 67 |
68 // Even though we create a flipped HWND for a native button when the locale | 68 // Even though we create a flipped HWND for a native button when the locale |
69 // is right-to-left, Windows does not render text for the button using a | 69 // is right-to-left, Windows does not render text for the button using a |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label) | 281 NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label) |
282 : NativeButtonBase(listener, label) { | 282 : NativeButtonBase(listener, label) { |
283 } | 283 } |
284 | 284 |
285 NativeButton::~NativeButton() { | 285 NativeButton::~NativeButton() { |
286 } | 286 } |
287 #endif | 287 #endif |
288 | 288 |
289 } // namespace views | 289 } // namespace views |
OLD | NEW |