OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_STYLE_TYPOGRAPHY_H_ | 5 #ifndef UI_VIEWS_STYLE_TYPOGRAPHY_H_ |
6 #define UI_VIEWS_STYLE_TYPOGRAPHY_H_ | 6 #define UI_VIEWS_STYLE_TYPOGRAPHY_H_ |
7 | 7 |
8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 class FontList; | 12 class FontList; |
13 } | 13 } |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 namespace style { | 16 namespace style { |
17 | 17 |
18 // Where a piece of text appears in the UI. This influences size and weight, but | 18 // Where a piece of text appears in the UI. This influences size and weight, but |
19 // typically not style or color. | 19 // typically not style or color. |
20 enum TextContext { | 20 enum TextContext { |
21 // Embedders can extend this enum with additional values that are understood | 21 // Embedders can extend this enum with additional values that are understood |
22 // by the TypographyProvider offered by their ViewsDelegate. Embedders define | 22 // by the TypographyProvider offered by their ViewsDelegate. Embedders define |
23 // enum values from VIEWS_TEXT_CONTEXT_END. Values named beginning with | 23 // enum values from VIEWS_TEXT_CONTEXT_END. Values named beginning with |
24 // "CONTEXT_" represent the actual TextContexts: the rest are markers. | 24 // "CONTEXT_" represent the actual TextContexts: the rest are markers. |
25 VIEWS_TEXT_CONTEXT_START = 0, | 25 VIEWS_TEXT_CONTEXT_START = 0, |
26 | 26 |
| 27 // Text that appears on a button control. Usually 12pt. This includes controls |
| 28 // with button-like behavior, such as Checkbox. |
| 29 CONTEXT_BUTTON = VIEWS_TEXT_CONTEXT_START, |
| 30 |
| 31 // Text that appears on an MD-styled dialog button control. Usually 12pt. |
| 32 CONTEXT_BUTTON_MD, |
| 33 |
27 // A title for a dialog window. Usually 15pt. Multi-line OK. | 34 // A title for a dialog window. Usually 15pt. Multi-line OK. |
28 CONTEXT_DIALOG_TITLE = VIEWS_TEXT_CONTEXT_START, | 35 CONTEXT_DIALOG_TITLE, |
29 | 36 |
30 // Text to label a control, usually next to it. "Body 2". Usually 12pt. | 37 // Text to label a control, usually next to it. "Body 2". Usually 12pt. |
31 CONTEXT_LABEL, | 38 CONTEXT_LABEL, |
32 | 39 |
33 // An editable text field. Usually matches CONTROL_LABEL. | 40 // An editable text field. Usually matches CONTROL_LABEL. |
34 CONTEXT_TEXTFIELD, | 41 CONTEXT_TEXTFIELD, |
35 | 42 |
36 // Text that appears on a button control. Usually 12pt. | 43 // Text for the menu items that appear in the touch-selection context menu. |
37 CONTEXT_BUTTON, | 44 CONTEXT_TOUCH_MENU, |
38 | 45 |
39 // Embedders must start TextContext enum values from this value. | 46 // Embedders must start TextContext enum values from this value. |
40 VIEWS_TEXT_CONTEXT_END, | 47 VIEWS_TEXT_CONTEXT_END, |
41 | 48 |
42 // All TextContext enum values must be below this value. | 49 // All TextContext enum values must be below this value. |
43 TEXT_CONTEXT_MAX = 0x1000 | 50 TEXT_CONTEXT_MAX = 0x1000 |
44 }; | 51 }; |
45 | 52 |
46 // How a piece of text should be presented. This influences color and style, but | 53 // How a piece of text should be presented. This influences color and style, but |
47 // typically not size. | 54 // typically not size. |
48 enum TextStyle { | 55 enum TextStyle { |
49 // TextStyle enum values must always be greater than any TextContext value. | 56 // TextStyle enum values must always be greater than any TextContext value. |
50 // This allows the code to verify at runtime that arguments of the two types | 57 // This allows the code to verify at runtime that arguments of the two types |
51 // have not been swapped. | 58 // have not been swapped. |
52 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX, | 59 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX, |
53 | 60 |
54 // Primary text: solid black, normal weight. Converts to DISABLED in some | 61 // Primary text: solid black, normal weight. Converts to DISABLED in some |
55 // contexts (e.g. BUTTON_TEXT, FIELD). | 62 // contexts (e.g. BUTTON_TEXT, FIELD). |
56 STYLE_PRIMARY = VIEWS_TEXT_STYLE_START, | 63 STYLE_PRIMARY = VIEWS_TEXT_STYLE_START, |
57 | 64 |
| 65 // Style for the default button on a dialog. |
| 66 STYLE_DIALOG_BUTTON_DEFAULT, |
| 67 |
58 // Disabled "greyed out" text. | 68 // Disabled "greyed out" text. |
59 STYLE_DISABLED, | 69 STYLE_DISABLED, |
60 | 70 |
61 // The style used for links. Usually a solid shade of blue. | 71 // The style used for links. Usually a solid shade of blue. |
62 STYLE_LINK, | 72 STYLE_LINK, |
63 | 73 |
64 // Active tab in a tabbed pane. | 74 // Active tab in a tabbed pane. |
65 STYLE_TAB_ACTIVE, | 75 STYLE_TAB_ACTIVE, |
66 | 76 |
67 // Hovered tab in a tabbed pane. | 77 // Hovered tab in a tabbed pane. |
(...skipping 11 matching lines...) Expand all Loading... |
79 // value understood by the embedder's TypographyProvider. Similarly, | 89 // value understood by the embedder's TypographyProvider. Similarly, |
80 // |text_style| corresponds to TextStyle. | 90 // |text_style| corresponds to TextStyle. |
81 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style); | 91 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style); |
82 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style); | 92 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style); |
83 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style); | 93 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style); |
84 | 94 |
85 } // namespace style | 95 } // namespace style |
86 } // namespace views | 96 } // namespace views |
87 | 97 |
88 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_ | 98 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_ |
OLD | NEW |