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_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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 | 75 |
76 // Enables or disables auto-color-readability (enabled by default). If this | 76 // Enables or disables auto-color-readability (enabled by default). If this |
77 // is enabled, then calls to set any foreground or background color will | 77 // is enabled, then calls to set any foreground or background color will |
78 // trigger an automatic mapper that uses color_utils::GetReadableColor() to | 78 // trigger an automatic mapper that uses color_utils::GetReadableColor() to |
79 // ensure that the foreground colors are readable over the background color. | 79 // ensure that the foreground colors are readable over the background color. |
80 void SetAutoColorReadabilityEnabled(bool enabled); | 80 void SetAutoColorReadabilityEnabled(bool enabled); |
81 | 81 |
82 // Sets the color. This will automatically force the color to be readable | 82 // Sets the color. This will automatically force the color to be readable |
83 // over the current background color, if auto color readability is enabled. | 83 // over the current background color, if auto color readability is enabled. |
84 virtual void SetEnabledColor(SkColor color); | 84 virtual void SetEnabledColor(SkColor color); |
85 void SetDisabledColor(SkColor color); | 85 void SetDisabledColorForLabelButton(SkColor color); |
tapted
2017/06/02 01:29:15
(note I'm getting rid of this here: https://codere
| |
86 | 86 |
87 SkColor enabled_color() const { return actual_enabled_color_; } | 87 SkColor enabled_color() const { return actual_enabled_color_; } |
88 SkColor disabled_color() const { return actual_disabled_color_; } | |
89 | 88 |
90 // Sets the background color. This won't be explicitly drawn, but the label | 89 // Sets the background color. This won't be explicitly drawn, but the label |
91 // will force the text color to be readable over it. | 90 // will force the text color to be readable over it. |
92 void SetBackgroundColor(SkColor color); | 91 void SetBackgroundColor(SkColor color); |
93 SkColor background_color() const { return background_color_; } | 92 SkColor background_color() const { return background_color_; } |
94 | 93 |
95 // Sets the selection text color. This will automatically force the color to | 94 // Sets the selection text color. This will automatically force the color to |
96 // be readable over the selection background color, if auto color readability | 95 // be readable over the selection background color, if auto color readability |
97 // is enabled. Initialized with system default. | 96 // is enabled. Initialized with system default. |
98 void SetSelectionTextColor(SkColor color); | 97 void SetSelectionTextColor(SkColor color); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 | 318 |
320 // Returns the currently selected text. | 319 // Returns the currently selected text. |
321 base::string16 GetSelectedText() const; | 320 base::string16 GetSelectedText() const; |
322 | 321 |
323 // Updates the clipboard with the currently selected text. | 322 // Updates the clipboard with the currently selected text. |
324 void CopyToClipboard(); | 323 void CopyToClipboard(); |
325 | 324 |
326 // Builds |context_menu_contents_|. | 325 // Builds |context_menu_contents_|. |
327 void BuildContextMenuContents(); | 326 void BuildContextMenuContents(); |
328 | 327 |
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_; | |
331 | |
329 // 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. |
330 std::unique_ptr<gfx::RenderText> render_text_; | 333 std::unique_ptr<gfx::RenderText> render_text_; |
331 | 334 |
332 // The RenderText instances used to display elided and multi-line text. | 335 // The RenderText instances used to display elided and multi-line text. |
333 mutable std::vector<std::unique_ptr<gfx::RenderText>> lines_; | 336 mutable std::vector<std::unique_ptr<gfx::RenderText>> lines_; |
334 | 337 |
335 // Persists the current selection range between the calls to | 338 // Persists the current selection range between the calls to |
336 // ClearRenderTextLines() and MaybeBuildRenderTextLines(). Holds an | 339 // ClearRenderTextLines() and MaybeBuildRenderTextLines(). Holds an |
337 // InvalidRange when not in use. | 340 // InvalidRange when not in use. |
338 mutable gfx::Range stored_selection_range_; | 341 mutable gfx::Range stored_selection_range_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 // Context menu related members. | 378 // Context menu related members. |
376 ui::SimpleMenuModel context_menu_contents_; | 379 ui::SimpleMenuModel context_menu_contents_; |
377 std::unique_ptr<views::MenuRunner> context_menu_runner_; | 380 std::unique_ptr<views::MenuRunner> context_menu_runner_; |
378 | 381 |
379 DISALLOW_COPY_AND_ASSIGN(Label); | 382 DISALLOW_COPY_AND_ASSIGN(Label); |
380 }; | 383 }; |
381 | 384 |
382 } // namespace views | 385 } // namespace views |
383 | 386 |
384 #endif // UI_VIEWS_CONTROLS_LABEL_H_ | 387 #endif // UI_VIEWS_CONTROLS_LABEL_H_ |
OLD | NEW |