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 // These classes define a text field widget that can be used in the views UI | 5 // These classes define a text field widget that can be used in the views UI |
6 // toolkit. | 6 // toolkit. |
7 | 7 |
8 #ifndef VIEWS_CONTROLS_TEXT_FIELD_H_ | 8 #ifndef VIEWS_CONTROLS_TEXT_FIELD_H_ |
9 #define VIEWS_CONTROLS_TEXT_FIELD_H_ | 9 #define VIEWS_CONTROLS_TEXT_FIELD_H_ |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 // Clears the selection within the edit field and sets the caret to the end. | 115 // Clears the selection within the edit field and sets the caret to the end. |
116 void ClearSelection() const; | 116 void ClearSelection() const; |
117 | 117 |
118 StyleFlags GetStyle() const { return style_; } | 118 StyleFlags GetStyle() const { return style_; } |
119 | 119 |
120 void SetBackgroundColor(SkColor color); | 120 void SetBackgroundColor(SkColor color); |
121 void SetDefaultBackgroundColor(); | 121 void SetDefaultBackgroundColor(); |
122 | 122 |
123 // Set the font. | 123 // Set the font. |
124 void SetFont(const ChromeFont& font); | 124 void SetFont(const gfx::Font& font); |
125 | 125 |
126 // Return the font used by this TextField. | 126 // Return the font used by this TextField. |
127 ChromeFont GetFont() const; | 127 gfx::Font GetFont() const; |
128 | 128 |
129 // Sets the left and right margin (in pixels) within the text box. On Windows | 129 // Sets the left and right margin (in pixels) within the text box. On Windows |
130 // this is accomplished by packing the left and right margin into a single | 130 // this is accomplished by packing the left and right margin into a single |
131 // 32 bit number, so the left and right margins are effectively 16 bits. | 131 // 32 bit number, so the left and right margins are effectively 16 bits. |
132 bool SetHorizontalMargins(int left, int right); | 132 bool SetHorizontalMargins(int left, int right); |
133 | 133 |
134 // Should only be called on a multi-line text field. Sets how many lines of | 134 // Should only be called on a multi-line text field. Sets how many lines of |
135 // text can be displayed at once by this text field. | 135 // text can be displayed at once by this text field. |
136 void SetHeightInLines(int num_lines); | 136 void SetHeightInLines(int num_lines); |
137 | 137 |
(...skipping 28 matching lines...) Expand all Loading... |
166 HWNDView* native_view_; | 166 HWNDView* native_view_; |
167 | 167 |
168 // This inherits from the native text field. | 168 // This inherits from the native text field. |
169 Edit* edit_; | 169 Edit* edit_; |
170 | 170 |
171 // This is the current listener for events from this control. | 171 // This is the current listener for events from this control. |
172 Controller* controller_; | 172 Controller* controller_; |
173 | 173 |
174 StyleFlags style_; | 174 StyleFlags style_; |
175 | 175 |
176 ChromeFont font_; | 176 gfx::Font font_; |
177 | 177 |
178 // NOTE: this is temporary until we rewrite TextField to always work whether | 178 // NOTE: this is temporary until we rewrite TextField to always work whether |
179 // there is an HWND or not. | 179 // there is an HWND or not. |
180 // Used if the HWND hasn't been created yet. | 180 // Used if the HWND hasn't been created yet. |
181 std::wstring text_; | 181 std::wstring text_; |
182 | 182 |
183 bool read_only_; | 183 bool read_only_; |
184 | 184 |
185 // The default number of average characters for the width of this text field. | 185 // The default number of average characters for the width of this text field. |
186 // This will be reported as the "desired size". Defaults to 0. | 186 // This will be reported as the "desired size". Defaults to 0. |
(...skipping 12 matching lines...) Expand all Loading... |
199 protected: | 199 protected: |
200 // Calculates the insets for the text field. | 200 // Calculates the insets for the text field. |
201 void CalculateInsets(gfx::Insets* insets); | 201 void CalculateInsets(gfx::Insets* insets); |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(TextField); | 203 DISALLOW_COPY_AND_ASSIGN(TextField); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace views | 206 } // namespace views |
207 | 207 |
208 #endif // VIEWS_CONTROLS_TEXT_FIELD_H_ | 208 #endif // VIEWS_CONTROLS_TEXT_FIELD_H_ |
OLD | NEW |