OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/text_field.h" | 5 #include "views/controls/text_field.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 <atlctrls.h> | 10 #include <atlctrls.h> |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 background_color_ = color; | 1110 background_color_ = color; |
1111 use_default_background_color_ = false; | 1111 use_default_background_color_ = false; |
1112 UpdateEditBackgroundColor(); | 1112 UpdateEditBackgroundColor(); |
1113 } | 1113 } |
1114 | 1114 |
1115 void TextField::SetDefaultBackgroundColor() { | 1115 void TextField::SetDefaultBackgroundColor() { |
1116 use_default_background_color_ = true; | 1116 use_default_background_color_ = true; |
1117 UpdateEditBackgroundColor(); | 1117 UpdateEditBackgroundColor(); |
1118 } | 1118 } |
1119 | 1119 |
1120 void TextField::SetFont(const ChromeFont& font) { | 1120 void TextField::SetFont(const gfx::Font& font) { |
1121 font_ = font; | 1121 font_ = font; |
1122 if (edit_) | 1122 if (edit_) |
1123 edit_->SetFont(font.hfont()); | 1123 edit_->SetFont(font.hfont()); |
1124 } | 1124 } |
1125 | 1125 |
1126 ChromeFont TextField::GetFont() const { | 1126 gfx::Font TextField::GetFont() const { |
1127 return font_; | 1127 return font_; |
1128 } | 1128 } |
1129 | 1129 |
1130 bool TextField::SetHorizontalMargins(int left, int right) { | 1130 bool TextField::SetHorizontalMargins(int left, int right) { |
1131 // SendMessage expects the two values to be packed into one using MAKELONG | 1131 // SendMessage expects the two values to be packed into one using MAKELONG |
1132 // so we truncate to 16 bits if necessary. | 1132 // so we truncate to 16 bits if necessary. |
1133 return ERROR_SUCCESS == SendMessage(GetNativeComponent(), | 1133 return ERROR_SUCCESS == SendMessage(GetNativeComponent(), |
1134 (UINT) EM_SETMARGINS, | 1134 (UINT) EM_SETMARGINS, |
1135 (WPARAM) EC_LEFTMARGIN | EC_RIGHTMARGIN, | 1135 (WPARAM) EC_LEFTMARGIN | EC_RIGHTMARGIN, |
1136 (LPARAM) MAKELONG(left & 0xFFFF, | 1136 (LPARAM) MAKELONG(left & 0xFFFF, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 | 1185 |
1186 COLORREF bg_color; | 1186 COLORREF bg_color; |
1187 if (!use_default_background_color_) | 1187 if (!use_default_background_color_) |
1188 bg_color = skia::SkColorToCOLORREF(background_color_); | 1188 bg_color = skia::SkColorToCOLORREF(background_color_); |
1189 else | 1189 else |
1190 bg_color = GetSysColor(read_only_ ? COLOR_3DFACE : COLOR_WINDOW); | 1190 bg_color = GetSysColor(read_only_ ? COLOR_3DFACE : COLOR_WINDOW); |
1191 edit_->SetBackgroundColor(bg_color); | 1191 edit_->SetBackgroundColor(bg_color); |
1192 } | 1192 } |
1193 | 1193 |
1194 } // namespace views | 1194 } // namespace views |
OLD | NEW |