OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "ui/base/events/event_constants.h" | 10 #include "ui/base/events/event_constants.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 virtual void UpdateText() OVERRIDE; | 94 virtual void UpdateText() OVERRIDE; |
95 virtual void AppendText(const string16& text) OVERRIDE; | 95 virtual void AppendText(const string16& text) OVERRIDE; |
96 virtual void ReplaceSelection(const string16& text) OVERRIDE; | 96 virtual void ReplaceSelection(const string16& text) OVERRIDE; |
97 virtual base::i18n::TextDirection GetTextDirection() const OVERRIDE; | 97 virtual base::i18n::TextDirection GetTextDirection() const OVERRIDE; |
98 virtual string16 GetSelectedText() const OVERRIDE; | 98 virtual string16 GetSelectedText() const OVERRIDE; |
99 virtual void SelectAll(bool reversed) OVERRIDE; | 99 virtual void SelectAll(bool reversed) OVERRIDE; |
100 virtual void ClearSelection() OVERRIDE; | 100 virtual void ClearSelection() OVERRIDE; |
101 virtual void UpdateBorder() OVERRIDE; | 101 virtual void UpdateBorder() OVERRIDE; |
102 virtual void UpdateTextColor() OVERRIDE; | 102 virtual void UpdateTextColor() OVERRIDE; |
103 virtual void UpdateBackgroundColor() OVERRIDE; | 103 virtual void UpdateBackgroundColor() OVERRIDE; |
104 virtual void UpdateCursorColor() OVERRIDE; | |
105 virtual void UpdateReadOnly() OVERRIDE; | 104 virtual void UpdateReadOnly() OVERRIDE; |
106 virtual void UpdateFont() OVERRIDE; | 105 virtual void UpdateFont() OVERRIDE; |
107 virtual void UpdateIsObscured() OVERRIDE; | 106 virtual void UpdateIsObscured() OVERRIDE; |
108 virtual void UpdateEnabled() OVERRIDE; | 107 virtual void UpdateEnabled() OVERRIDE; |
109 virtual gfx::Insets CalculateInsets() OVERRIDE; | 108 virtual gfx::Insets CalculateInsets() OVERRIDE; |
110 virtual void UpdateHorizontalMargins() OVERRIDE; | 109 virtual void UpdateHorizontalMargins() OVERRIDE; |
111 virtual void UpdateVerticalMargins() OVERRIDE; | 110 virtual void UpdateVerticalMargins() OVERRIDE; |
112 virtual bool SetFocus() OVERRIDE; | 111 virtual bool SetFocus() OVERRIDE; |
113 virtual View* GetView() OVERRIDE; | 112 virtual View* GetView() OVERRIDE; |
114 virtual gfx::NativeView GetTestingHandle() const OVERRIDE; | 113 virtual gfx::NativeView GetTestingHandle() const OVERRIDE; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // Overridden from TextfieldViewsModel::Delegate: | 178 // Overridden from TextfieldViewsModel::Delegate: |
180 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; | 179 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; |
181 | 180 |
182 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. | 181 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. |
183 gfx::RenderText* GetRenderText() const; | 182 gfx::RenderText* GetRenderText() const; |
184 | 183 |
185 // Converts |text| according to textfield style, e.g. lower case if | 184 // Converts |text| according to textfield style, e.g. lower case if |
186 // |textfield_| has STYLE_LOWERCASE style. | 185 // |textfield_| has STYLE_LOWERCASE style. |
187 string16 GetTextForDisplay(const string16& text); | 186 string16 GetTextForDisplay(const string16& text); |
188 | 187 |
| 188 // Updates any colors that have not been explicitly set from the theme. |
| 189 void UpdateColorsFromTheme(const ui::NativeTheme* theme); |
| 190 |
189 // A callback function to periodically update the cursor state. | 191 // A callback function to periodically update the cursor state. |
190 void UpdateCursor(); | 192 void UpdateCursor(); |
191 | 193 |
192 // Repaint the cursor. | 194 // Repaint the cursor. |
193 void RepaintCursor(); | 195 void RepaintCursor(); |
194 | 196 |
195 // Update the cursor_bounds and text_offset. | 197 // Update the cursor_bounds and text_offset. |
196 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); | 198 void UpdateCursorBoundsAndTextOffset(size_t cursor_pos, bool insert_mode); |
197 | 199 |
198 void PaintTextAndCursor(gfx::Canvas* canvas); | 200 void PaintTextAndCursor(gfx::Canvas* canvas); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 scoped_ptr<views::MenuRunner> context_menu_runner_; | 289 scoped_ptr<views::MenuRunner> context_menu_runner_; |
288 | 290 |
289 scoped_ptr<TouchSelectionController> touch_selection_controller_; | 291 scoped_ptr<TouchSelectionController> touch_selection_controller_; |
290 | 292 |
291 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 293 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
292 }; | 294 }; |
293 | 295 |
294 } // namespace views | 296 } // namespace views |
295 | 297 |
296 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 298 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
OLD | NEW |