OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_VIEWS_STYLE_TYPOGRAPHY_H_ | |
6 #define UI_VIEWS_STYLE_TYPOGRAPHY_H_ | |
7 | |
8 #include "third_party/skia/include/core/SkColor.h" | |
9 #include "ui/views/views_export.h" | |
10 | |
11 namespace gfx { | |
12 class FontList; | |
13 } | |
14 | |
15 namespace views { | |
16 namespace typography { | |
sky
2017/03/16 16:23:51
How about putting this in the style namespace? Two
tapted
2017/03/17 10:33:11
Done.
| |
17 | |
18 // Where a piece of text appears in the UI. This influences size and weight, but | |
19 // typically not style or color. | |
20 enum TextContext { | |
21 VIEWS_TEXT_CONTEXT_START = 0, | |
sky
2017/03/16 16:23:51
Can all these enums be named consistently? e.g. CO
Peter Kasting
2017/03/17 02:26:00
I like having the "marker" values, which should ne
tapted
2017/03/17 10:33:11
Yeah - that was the intent. I've added an explaine
| |
22 | |
23 // A title for a dialog window. Usually 15pt. Multi-line OK. | |
24 CONTEXT_DIALOG_TITLE, | |
Peter Kasting
2017/03/17 02:26:00
Nit: Should be "= VIEWS_TEXT_CONTEXT_START" (then
tapted
2017/03/17 10:33:11
Done (did the same for STYLE).
| |
25 | |
26 // Text to label a control, usually next to it. "Body 2". Usually 12pt. | |
sky
2017/03/16 16:23:51
This description implies it's only for labels near
tapted
2017/03/17 10:33:11
Done.
| |
27 CONTEXT_CONTROL_LABEL, | |
28 | |
29 // An editable text field. Usually matches CONTROL_LABEL. | |
sky
2017/03/16 16:23:51
That you say 'editable' implies we may have differ
tapted
2017/03/17 10:33:11
There's no plan to make them different at this sta
| |
30 CONTEXT_FIELD, | |
sky
2017/03/16 16:23:51
CONTEXT_TEXT_FIELD.
tapted
2017/03/17 10:33:11
Done.
| |
31 | |
32 // Text that appears on a button control. Usually 12pt. | |
33 CONTEXT_BUTTON_TEXT, | |
sky
2017/03/16 16:23:51
CONTEXT_BUTTON (for consistency with other names).
tapted
2017/03/17 10:33:11
Done.
| |
34 | |
35 // Embedders must start TextContext enum values from this value. | |
36 VIEWS_TEXT_CONTEXT_END, | |
37 | |
38 // All TextContext enum values must be below this value. | |
39 TEXT_CONTEXT_MAX = 0x1000 | |
40 }; | |
41 | |
42 // How a piece of text should be presented. This influences color and style, but | |
43 // typically not size. | |
44 enum TextStyle { | |
45 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX, | |
sky
2017/03/16 16:23:51
Why does this need to start at TEXT_CONTEXT_MAX? A
Peter Kasting
2017/03/16 19:33:13
This was explained in previous CL comments, but it
sky
2017/03/16 20:48:47
Ok, got it.
| |
46 | |
47 // Primary text: solid black, normal weight. Converts to DISABLED in some | |
48 // contexts (e.g. BUTTON_TEXT, FIELD). | |
49 STYLE_PRIMARY, | |
50 | |
51 // Disabled "greyed out" text. | |
52 STYLE_DISABLED, | |
53 | |
54 // The style used for links. Usually a solid shade of blue. | |
55 STYLE_LINK, | |
56 | |
57 // Active tab in a tabbed pane. | |
58 STYLE_ACTIVE_TAB, | |
Peter Kasting
2017/03/17 02:26:00
Nit: I tend to prefer STYLE_TAB_ACTIVE, which read
tapted
2017/03/17 10:33:11
Done.
| |
59 | |
60 // Inactive tab in a tabbed pane. | |
61 STYLE_INACTIVE_TAB, | |
62 | |
63 // Hovered tab in a tabbed pane. | |
64 STYLE_HOVERED_TAB, | |
65 | |
66 // Embedders must start TextStyle enum values from here. | |
67 VIEWS_TEXT_STYLE_END | |
68 }; | |
69 | |
70 // Helpers to obtain font properties from the TypographyProvider given by the | |
71 // current ViewsDelegate. |context| can be an enum value from TextContext, or a | |
72 // value understood by the embedder's TypographyProvider. Similarly, | |
73 // |text_style| corresponds to TextStyle. | |
74 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style); | |
75 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style); | |
76 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style); | |
77 | |
78 } // namespace typography | |
79 } // namespace views | |
80 | |
81 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_ | |
OLD | NEW |