Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: ui/views/controls/textfield/textfield.h

Issue 2345183002: Views: Draw Textfield selected text in gray when top-level Widget loses focus.
Patch Set: Refactor to use SelectionController(Delegate). Unfinished! Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TEXTFIELD_H_ 5 #ifndef UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 6 #define UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SkColor GetTextColor() const; 120 SkColor GetTextColor() const;
121 void SetTextColor(SkColor color); 121 void SetTextColor(SkColor color);
122 void UseDefaultTextColor(); 122 void UseDefaultTextColor();
123 123
124 // Gets/sets the background color to be used when painting the Textfield. 124 // Gets/sets the background color to be used when painting the Textfield.
125 // Call UseDefaultBackgroundColor() to restore the default system color. 125 // Call UseDefaultBackgroundColor() to restore the default system color.
126 SkColor GetBackgroundColor() const; 126 SkColor GetBackgroundColor() const;
127 void SetBackgroundColor(SkColor color); 127 void SetBackgroundColor(SkColor color);
128 void UseDefaultBackgroundColor(); 128 void UseDefaultBackgroundColor();
129 129
130 // Gets/sets the selection text color to be used when painting the Textfield. 130 // Sets the selection text color to be used when painting the Textfield. Call
131 // Call UseDefaultSelectionTextColor() to restore the default system color. 131 // UseDefaultSelectionTextColor() to restore the default system color. See
132 SkColor GetSelectionTextColor() const; 132 // SelectionControllerDelegate overrides for the getter.
133 void SetSelectionTextColor(SkColor color); 133 void SetSelectionTextColor(SkColor color);
134 void UseDefaultSelectionTextColor(); 134 void UseDefaultSelectionTextColor();
135 135
136 // Gets/sets the selection background color to be used when painting the 136 // Sets the selection background color to be used when painting the Textfield.
137 // Textfield. Call UseDefaultSelectionBackgroundColor() to restore the default 137 // Call UseDefaultSelectionBackgroundColor() to restore the default system
138 // system color. 138 // color. See SelectionControllerDelegate overrides for the getter.
139 SkColor GetSelectionBackgroundColor() const;
140 void SetSelectionBackgroundColor(SkColor color); 139 void SetSelectionBackgroundColor(SkColor color);
141 void UseDefaultSelectionBackgroundColor(); 140 void UseDefaultSelectionBackgroundColor();
142 141
143 // Set drop shadows underneath the text. 142 // Set drop shadows underneath the text.
144 void SetShadows(const gfx::ShadowValues& shadows); 143 void SetShadows(const gfx::ShadowValues& shadows);
145 144
146 // Gets/Sets whether or not the cursor is enabled. 145 // Gets/Sets whether or not the cursor is enabled.
147 bool GetCursorEnabled() const; 146 bool GetCursorEnabled() const;
148 void SetCursorEnabled(bool enabled); 147 void SetCursorEnabled(bool enabled);
149 148
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 int OnDragUpdated(const ui::DropTargetEvent& event) override; 236 int OnDragUpdated(const ui::DropTargetEvent& event) override;
238 void OnDragExited() override; 237 void OnDragExited() override;
239 int OnPerformDrop(const ui::DropTargetEvent& event) override; 238 int OnPerformDrop(const ui::DropTargetEvent& event) override;
240 void OnDragDone() override; 239 void OnDragDone() override;
241 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 240 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
242 bool HandleAccessibleAction(const ui::AXActionData& action_data) override; 241 bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
243 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 242 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
244 bool GetNeedsNotificationWhenVisibleBoundsChange() const override; 243 bool GetNeedsNotificationWhenVisibleBoundsChange() const override;
245 void OnVisibleBoundsChanged() override; 244 void OnVisibleBoundsChanged() override;
246 void OnEnabledChanged() override; 245 void OnEnabledChanged() override;
246 void ViewHierarchyChanged(
247 const ViewHierarchyChangedDetails& details) override;
248 void NativeViewHierarchyChanged() override;
247 void OnPaint(gfx::Canvas* canvas) override; 249 void OnPaint(gfx::Canvas* canvas) override;
248 void OnFocus() override; 250 void OnFocus() override;
249 void OnBlur() override; 251 void OnBlur() override;
250 gfx::Point GetKeyboardContextMenuLocation() override; 252 gfx::Point GetKeyboardContextMenuLocation() override;
251 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 253 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
252 254
253 // TextfieldModel::Delegate overrides: 255 // TextfieldModel::Delegate overrides:
254 void OnCompositionTextConfirmedOrCleared() override; 256 void OnCompositionTextConfirmedOrCleared() override;
255 257
256 // ContextMenuController overrides: 258 // ContextMenuController overrides:
(...skipping 10 matching lines...) Expand all
267 const gfx::Point& press_pt, 269 const gfx::Point& press_pt,
268 const gfx::Point& p) override; 270 const gfx::Point& p) override;
269 271
270 // WordLookupClient overrides: 272 // WordLookupClient overrides:
271 bool GetDecoratedWordAtPoint(const gfx::Point& point, 273 bool GetDecoratedWordAtPoint(const gfx::Point& point,
272 gfx::DecoratedText* decorated_word, 274 gfx::DecoratedText* decorated_word,
273 gfx::Point* baseline_point) override; 275 gfx::Point* baseline_point) override;
274 276
275 // SelectionControllerDelegate overrides: 277 // SelectionControllerDelegate overrides:
276 bool HasTextBeingDragged() const override; 278 bool HasTextBeingDragged() const override;
279 SkColor GetSelectionTextColor() const override;
280 SkColor GetSelectionBackgroundColor() const override;
281 SkColor GetSelectionBackgroundUnfocusedColor() const override;
277 282
278 // ui::TouchEditable overrides: 283 // ui::TouchEditable overrides:
279 void SelectRect(const gfx::Point& start, const gfx::Point& end) override; 284 void SelectRect(const gfx::Point& start, const gfx::Point& end) override;
280 void MoveCaretTo(const gfx::Point& point) override; 285 void MoveCaretTo(const gfx::Point& point) override;
281 void GetSelectionEndPoints(gfx::SelectionBound* anchor, 286 void GetSelectionEndPoints(gfx::SelectionBound* anchor,
282 gfx::SelectionBound* focus) override; 287 gfx::SelectionBound* focus) override;
283 gfx::Rect GetBounds() override; 288 gfx::Rect GetBounds() override;
284 gfx::NativeView GetNativeView() const override; 289 gfx::NativeView GetNativeView() const override;
285 void ConvertPointToScreen(gfx::Point* point) override; 290 void ConvertPointToScreen(gfx::Point* point) override;
286 void ConvertPointFromScreen(gfx::Point* point) override; 291 void ConvertPointFromScreen(gfx::Point* point) override;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 void SetTextBeingDragged(bool value) override; 362 void SetTextBeingDragged(bool value) override;
358 int GetViewHeight() const override; 363 int GetViewHeight() const override;
359 int GetViewWidth() const override; 364 int GetViewWidth() const override;
360 int GetDragSelectionDelay() const override; 365 int GetDragSelectionDelay() const override;
361 void OnBeforePointerAction() override; 366 void OnBeforePointerAction() override;
362 void OnAfterPointerAction(bool text_changed, bool selection_changed) override; 367 void OnAfterPointerAction(bool text_changed, bool selection_changed) override;
363 // Callers within Textfield should call UpdateAfterChange depending on the 368 // Callers within Textfield should call UpdateAfterChange depending on the
364 // return value. 369 // return value.
365 bool PasteSelectionClipboard() override; 370 bool PasteSelectionClipboard() override;
366 void UpdateSelectionClipboard() override; 371 void UpdateSelectionClipboard() override;
372 void OnWillChangeFocus(View* focused_before, View* focused_now) override;
367 373
368 // Updates the painted background color. 374 // Updates the painted background color.
369 void UpdateBackgroundColor(); 375 void UpdateBackgroundColor();
370 376
371 // Updates the border per the state of |invalid_|. 377 // Updates the border per the state of |invalid_|.
372 void UpdateBorder(); 378 void UpdateBorder();
373 379
374 // Does necessary updates when the text and/or cursor position changes. 380 // Does necessary updates when the text and/or cursor position changes.
375 void UpdateAfterChange(bool text_changed, bool cursor_changed); 381 void UpdateAfterChange(bool text_changed, bool cursor_changed);
376 382
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 536
531 // Used to bind callback functions to this object. 537 // Used to bind callback functions to this object.
532 base::WeakPtrFactory<Textfield> weak_ptr_factory_; 538 base::WeakPtrFactory<Textfield> weak_ptr_factory_;
533 539
534 DISALLOW_COPY_AND_ASSIGN(Textfield); 540 DISALLOW_COPY_AND_ASSIGN(Textfield);
535 }; 541 };
536 542
537 } // namespace views 543 } // namespace views
538 544
539 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_ 545 #endif // UI_VIEWS_CONTROLS_TEXTFIELD_TEXTFIELD_H_
OLDNEW
« no previous file with comments | « ui/views/controls/label.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698