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

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

Issue 2957263002: Update dialog button text color for Harmony per the latest button spec (Closed)
Patch Set: color_utils::IsInvertedColorScheme(), fewer Win constants Created 3 years, 5 months 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/button/md_text_button.cc ('k') | ui/views/style/typography_provider.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_LABEL_H_ 5 #ifndef UI_VIEWS_CONTROLS_LABEL_H_
6 #define UI_VIEWS_CONTROLS_LABEL_H_ 6 #define UI_VIEWS_CONTROLS_LABEL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Gets or sets the fonts used by this label. 66 // Gets or sets the fonts used by this label.
67 const gfx::FontList& font_list() const { return render_text_->font_list(); } 67 const gfx::FontList& font_list() const { return render_text_->font_list(); }
68 68
69 // TODO(tapted): Replace this with a private method, e.g., OnFontChanged(). 69 // TODO(tapted): Replace this with a private method, e.g., OnFontChanged().
70 virtual void SetFontList(const gfx::FontList& font_list); 70 virtual void SetFontList(const gfx::FontList& font_list);
71 71
72 // Get or set the label text. 72 // Get or set the label text.
73 const base::string16& text() const { return render_text_->text(); } 73 const base::string16& text() const { return render_text_->text(); }
74 virtual void SetText(const base::string16& text); 74 virtual void SetText(const base::string16& text);
75 75
76 // Where the label appears in the UI. Passed in from the constructor. This is
77 // a value from views::style::TextContext or an enum that extends it.
78 int text_context() const { return text_context_; }
79
76 // Enables or disables auto-color-readability (enabled by default). If this 80 // Enables or disables auto-color-readability (enabled by default). If this
77 // is enabled, then calls to set any foreground or background color will 81 // is enabled, then calls to set any foreground or background color will
78 // trigger an automatic mapper that uses color_utils::GetReadableColor() to 82 // trigger an automatic mapper that uses color_utils::GetReadableColor() to
79 // ensure that the foreground colors are readable over the background color. 83 // ensure that the foreground colors are readable over the background color.
80 void SetAutoColorReadabilityEnabled(bool enabled); 84 void SetAutoColorReadabilityEnabled(bool enabled);
81 85
82 // Sets the color. This will automatically force the color to be readable 86 // Sets the color. This will automatically force the color to be readable
83 // over the current background color, if auto color readability is enabled. 87 // over the current background color, if auto color readability is enabled.
84 virtual void SetEnabledColor(SkColor color); 88 virtual void SetEnabledColor(SkColor color);
85 89
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 gfx::HorizontalAlignment alignment, 225 gfx::HorizontalAlignment alignment,
222 gfx::DirectionalityMode directionality, 226 gfx::DirectionalityMode directionality,
223 gfx::ElideBehavior elide_behavior) const; 227 gfx::ElideBehavior elide_behavior) const;
224 228
225 // Draw a focus ring. The default implementation does nothing. 229 // Draw a focus ring. The default implementation does nothing.
226 virtual void PaintFocusRing(gfx::Canvas* canvas) const; 230 virtual void PaintFocusRing(gfx::Canvas* canvas) const;
227 gfx::Rect GetFocusRingBounds() const; 231 gfx::Rect GetFocusRingBounds() const;
228 232
229 void PaintText(gfx::Canvas* canvas); 233 void PaintText(gfx::Canvas* canvas);
230 234
231 int text_context() const { return text_context_; }
232
233 // View: 235 // View:
234 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 236 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
235 void VisibilityChanged(View* starting_from, bool is_visible) override; 237 void VisibilityChanged(View* starting_from, bool is_visible) override;
236 void OnPaint(gfx::Canvas* canvas) override; 238 void OnPaint(gfx::Canvas* canvas) override;
237 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 239 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
238 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 240 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
239 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override; 241 gfx::NativeCursor GetCursor(const ui::MouseEvent& event) override;
240 void OnFocus() override; 242 void OnFocus() override;
241 void OnBlur() override; 243 void OnBlur() override;
242 bool OnMousePressed(const ui::MouseEvent& event) override; 244 bool OnMousePressed(const ui::MouseEvent& event) override;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 320
319 // Returns the currently selected text. 321 // Returns the currently selected text.
320 base::string16 GetSelectedText() const; 322 base::string16 GetSelectedText() const;
321 323
322 // Updates the clipboard with the currently selected text. 324 // Updates the clipboard with the currently selected text.
323 void CopyToClipboard(); 325 void CopyToClipboard();
324 326
325 // Builds |context_menu_contents_|. 327 // Builds |context_menu_contents_|.
326 void BuildContextMenuContents(); 328 void BuildContextMenuContents();
327 329
328 // Where the label appears in the UI. Passed in from the constructor. This is
329 // a value from views::style::TextContext or an enum that extends it.
330 const int text_context_; 330 const int text_context_;
331 331
332 // An un-elided and single-line RenderText object used for preferred sizing. 332 // An un-elided and single-line RenderText object used for preferred sizing.
333 std::unique_ptr<gfx::RenderText> render_text_; 333 std::unique_ptr<gfx::RenderText> render_text_;
334 334
335 // The RenderText instances used to display elided and multi-line text. 335 // The RenderText instances used to display elided and multi-line text.
336 mutable std::vector<std::unique_ptr<gfx::RenderText>> lines_; 336 mutable std::vector<std::unique_ptr<gfx::RenderText>> lines_;
337 337
338 // Persists the current selection range between the calls to 338 // Persists the current selection range between the calls to
339 // ClearRenderTextLines() and MaybeBuildRenderTextLines(). Holds an 339 // ClearRenderTextLines() and MaybeBuildRenderTextLines(). Holds an
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // Context menu related members. 375 // Context menu related members.
376 ui::SimpleMenuModel context_menu_contents_; 376 ui::SimpleMenuModel context_menu_contents_;
377 std::unique_ptr<views::MenuRunner> context_menu_runner_; 377 std::unique_ptr<views::MenuRunner> context_menu_runner_;
378 378
379 DISALLOW_COPY_AND_ASSIGN(Label); 379 DISALLOW_COPY_AND_ASSIGN(Label);
380 }; 380 };
381 381
382 } // namespace views 382 } // namespace views
383 383
384 #endif // UI_VIEWS_CONTROLS_LABEL_H_ 384 #endif // UI_VIEWS_CONTROLS_LABEL_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/md_text_button.cc ('k') | ui/views/style/typography_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698