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

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

Issue 2801583002: Use views::style for buttons, bootstrap ash_typography to do so. (Closed)
Patch Set: rebase for epic ash file move Created 3 years, 8 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
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 dialog button control. Usually 12pt.
28 CONTEXT_DIALOG_BUTTON = VIEWS_TEXT_CONTEXT_START,
29
27 // A title for a dialog window. Usually 15pt. Multi-line OK. 30 // A title for a dialog window. Usually 15pt. Multi-line OK.
28 CONTEXT_DIALOG_TITLE = VIEWS_TEXT_CONTEXT_START, 31 CONTEXT_DIALOG_TITLE,
29 32
30 // Text to label a control, usually next to it. "Body 2". Usually 12pt. 33 // Text to label a control, usually next to it. "Body 2". Usually 12pt. This
34 // includes controls with button-like behaviour, such as Checkbox.
31 CONTEXT_LABEL, 35 CONTEXT_LABEL,
32 36
33 // An editable text field. Usually matches CONTROL_LABEL. 37 // An editable text field. Usually matches CONTROL_LABEL.
34 CONTEXT_TEXTFIELD, 38 CONTEXT_TEXTFIELD,
35 39
36 // Text that appears on a button control. Usually 12pt. 40 // Text for the menu items that appear in the touch-selection context menu.
37 CONTEXT_BUTTON, 41 CONTEXT_TOUCH_MENU,
38 42
39 // Embedders must start TextContext enum values from this value. 43 // Embedders must start TextContext enum values from this value.
40 VIEWS_TEXT_CONTEXT_END, 44 VIEWS_TEXT_CONTEXT_END,
41 45
42 // All TextContext enum values must be below this value. 46 // All TextContext enum values must be below this value.
43 TEXT_CONTEXT_MAX = 0x1000 47 TEXT_CONTEXT_MAX = 0x1000
44 }; 48 };
45 49
46 // How a piece of text should be presented. This influences color and style, but 50 // How a piece of text should be presented. This influences color and style, but
47 // typically not size. 51 // typically not size.
48 enum TextStyle { 52 enum TextStyle {
49 // TextStyle enum values must always be greater than any TextContext value. 53 // 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 54 // This allows the code to verify at runtime that arguments of the two types
51 // have not been swapped. 55 // have not been swapped.
52 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX, 56 VIEWS_TEXT_STYLE_START = TEXT_CONTEXT_MAX,
53 57
54 // Primary text: solid black, normal weight. Converts to DISABLED in some 58 // Primary text: solid black, normal weight. Converts to DISABLED in some
55 // contexts (e.g. BUTTON_TEXT, FIELD). 59 // contexts (e.g. BUTTON_TEXT, FIELD).
56 STYLE_PRIMARY = VIEWS_TEXT_STYLE_START, 60 STYLE_PRIMARY = VIEWS_TEXT_STYLE_START,
57 61
62 // Style for the default button on a dialog.
63 STYLE_DIALOG_BUTTON_DEFAULT,
64
58 // Disabled "greyed out" text. 65 // Disabled "greyed out" text.
59 STYLE_DISABLED, 66 STYLE_DISABLED,
60 67
61 // The style used for links. Usually a solid shade of blue. 68 // The style used for links. Usually a solid shade of blue.
62 STYLE_LINK, 69 STYLE_LINK,
63 70
64 // Active tab in a tabbed pane. 71 // Active tab in a tabbed pane.
65 STYLE_TAB_ACTIVE, 72 STYLE_TAB_ACTIVE,
66 73
67 // Hovered tab in a tabbed pane. 74 // Hovered tab in a tabbed pane.
(...skipping 11 matching lines...) Expand all
79 // value understood by the embedder's TypographyProvider. Similarly, 86 // value understood by the embedder's TypographyProvider. Similarly,
80 // |text_style| corresponds to TextStyle. 87 // |text_style| corresponds to TextStyle.
81 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style); 88 VIEWS_EXPORT const gfx::FontList& GetFont(int text_context, int text_style);
82 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style); 89 VIEWS_EXPORT SkColor GetColor(int text_context, int text_style);
83 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style); 90 VIEWS_EXPORT int GetLineHeight(int text_context, int text_style);
84 91
85 } // namespace style 92 } // namespace style
86 } // namespace views 93 } // namespace views
87 94
88 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_ 95 #endif // UI_VIEWS_STYLE_TYPOGRAPHY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698