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

Side by Side Diff: ui/views/style/typography.h

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: respond to comments Created 3 years, 9 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
OLDNEW
(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 style {
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 // Embedders can extend this enum with additional values that are understood
22 // by the TypographyProvider offered by their ViewsDelegate. Embedders define
23 // enum values from VIEWS_TEXT_CONTEXT_END. Values named beginning with
24 // "CONTEXT_" represent the actual TextContexts: the rest are markers.
25 VIEWS_TEXT_CONTEXT_START = 0,
26
27 // A title for a dialog window. Usually 15pt. Multi-line OK.
28 CONTEXT_DIALOG_TITLE = VIEWS_TEXT_CONTEXT_START,
29
30 // Text to label a control, usually next to it. "Body 2". Usually 12pt.
31 CONTEXT_LABEL,
32
33 // An editable text field. Usually matches CONTROL_LABEL.
34 CONTEXT_TEXT_FIELD,
Peter Kasting 2017/03/17 20:59:39 Nit: Is TEXTFIELD better than TEXT_FIELD? The vie
tapted 2017/03/20 07:33:35 Done (-> TEXTFIELD). Heh, niggles like this can be
35
36 // Text that appears on a button control. Usually 12pt.
37 CONTEXT_BUTTON,
38
39 // Embedders must start TextContext enum values from this value.
40 VIEWS_TEXT_CONTEXT_END,
41
42 // All TextContext enum values must be below this value.
43 TEXT_CONTEXT_MAX = 0x1000
44 };
45
46 // How a piece of text should be presented. This influences color and style, but
47 // typically not size.
48 enum TextStyle {
49 // TextStyle enum values must always be greater than any TextContext value.
50 // This allows them to be verified at runtime. E.g. if they have been swapped.
Peter Kasting 2017/03/17 20:59:39 Nit: Maybe "This allows the code to verify at runt
tapted 2017/03/20 07:33:36 Done.
51 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX,
52
53 // Primary text: solid black, normal weight. Converts to DISABLED in some
54 // contexts (e.g. BUTTON_TEXT, FIELD).
55 STYLE_PRIMARY = VIEWS_TEXT_STYLE_START,
56
57 // Disabled "greyed out" text.
58 STYLE_DISABLED,
59
60 // The style used for links. Usually a solid shade of blue.
61 STYLE_LINK,
62
63 // Active tab in a tabbed pane.
64 STYLE_TAB_ACTIVE,
65
66 // Hovered tab in a tabbed pane.
67 STYLE_TAB_HOVERED,
68
69 // Inactive tab in a tabbed pane.
70 STYLE_TAB_INACTIVE,
71
72 // Embedders must start TextStyle enum values from here.
73 VIEWS_TEXT_STYLE_END
74 };
75
76 // Helpers to obtain font properties from the TypographyProvider given by the
77 // current ViewsDelegate. |context| can be an enum value from TextContext, or a
78 // value understood by the embedder's TypographyProvider. Similarly,
79 // |text_style| corresponds to TextStyle.
80 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style);
81 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style);
82 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style);
83
84 } // namespace style
85 } // namespace views
86
87 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698