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

Side by Side Diff: chrome/browser/ui/views/harmony/layout_delegate.h

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed 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
(Empty)
1 // Copyright 2016 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 CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
7
8 #include "ui/views/layout/grid_layout.h"
9
10 namespace views {
11 class TypographyProvider;
12 }
13
14 class LayoutDelegate {
15 public:
16 enum class Metric {
17 // Padding on the left and right side of a button's label.
18 BUTTON_HORIZONTAL_PADDING,
19 // The maximum width a button can have and still influence the sizes of
20 // other linked buttons. This allows short buttons to have linked widths
21 // without long buttons making things overly wide.
22 BUTTON_MAX_LINKABLE_WIDTH,
23 // Default minimum width of a button.
24 BUTTON_MINIMUM_WIDTH,
25 // Margin between the edge of a dialog and the left, right, or bottom of a
26 // contained button.
27 DIALOG_BUTTON_MARGIN,
28 // Minimum width of a dialog button.
29 DIALOG_BUTTON_MINIMUM_WIDTH,
30 // Spacing between a dialog button and the content above it.
31 DIALOG_BUTTON_TOP_SPACING,
32 // Horizontal or vertical margin between the edge of a dialog and the close
33 // button in the upper trailing corner.
34 DIALOG_CLOSE_BUTTON_MARGIN,
35 // Horizontal or vertical margin between the edge of a panel and the
36 // contained content.
37 PANEL_CONTENT_MARGIN,
38 // Horizontal spacing between buttons that are logically related, e.g.
39 // for a button set.
40 RELATED_BUTTON_HORIZONTAL_SPACING,
41 // Horizontal spacing between other controls that are logically related.
42 RELATED_CONTROL_HORIZONTAL_SPACING,
43 // Smaller horizontal spacing between other controls that are logically
44 // related.
45 RELATED_CONTROL_HORIZONTAL_SPACING_SMALL,
46 // Vertical spacing between controls that are logically related.
47 RELATED_CONTROL_VERTICAL_SPACING,
48 // Smaller vertical spacing between controls that are logically related.
49 RELATED_CONTROL_VERTICAL_SPACING_SMALL,
50 // Horizontal spacing between an item such as an icon or checkbox and a
51 // label related to it.
52 RELATED_LABEL_HORIZONTAL_SPACING,
53 // Horizontal indent of a subsection relative to related items above, e.g.
54 // checkboxes below explanatory text/headings.
55 SUBSECTION_HORIZONTAL_INDENT,
56 // Horizontal spacing between controls that are logically unrelated.
57 UNRELATED_CONTROL_HORIZONTAL_SPACING,
58 // Larger horizontal spacing between unrelated controls.
59 UNRELATED_CONTROL_HORIZONTAL_SPACING_LARGE,
60 // Vertical spacing between controls that are logically unrelated.
61 UNRELATED_CONTROL_VERTICAL_SPACING,
62 // Larger vertical spacing between unrelated controls.
63 UNRELATED_CONTROL_VERTICAL_SPACING_LARGE,
64 // Padding to add to vector image buttons to increase their click and touch
65 // target size.
66 VECTOR_IMAGE_BUTTON_PADDING,
67 };
68
69 enum class DialogWidth {
70 SMALL,
71 MEDIUM,
72 LARGE,
73 };
74
75 LayoutDelegate() {}
76 virtual ~LayoutDelegate() {}
77
78 // Returns the active LayoutDelegate singleton, depending on UI configuration.
79 // This may be an instance of this class or a subclass, e.g. a
80 // HarmonyLayoutDelegate.
81 static LayoutDelegate* Get();
82
83 // Returns the requested metric in DIPs.
84 virtual int GetMetric(Metric metric) const;
85
86 // Returns the alignment used for control labels in a GridLayout; for example,
87 // in this GridLayout:
88 // ---------------------------
89 // | Label 1 Checkbox 1 |
90 // | Label 2 Checkbox 2 |
91 // ---------------------------
92 // This value controls the alignment used for "Label 1" and "Label 2".
93 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const;
94
95 // Returns whether to use extra padding on dialogs. If this is false, content
96 // Views for dialogs should not insert extra padding at their own edges.
97 virtual bool UseExtraDialogPadding() const;
98
99 // Returns whether to show the icon next to the title text on a dialog.
100 virtual bool ShouldShowWindowIcon() const;
101
102 // DEPRECATED. Returns whether Harmony mode is enabled.
103 //
104 // Instead of using this, create a generic solution that works for all UI
105 // types, e.g. by adding a new LayoutDistance value that means what you need.
106 //
107 // TODO(pkasting): Fix callers and remove this.
108 virtual bool IsHarmonyMode() const;
109
110 // Returns the preferred width in DIPs for a dialog of the specified |width|.
111 // May return 0 if the dialog has no preferred width.
112 virtual int GetDialogPreferredWidth(DialogWidth width) const;
113
114 // Returns the class that maps views::style values (TextContext and TextStyle)
115 // to specific font properties (e.g. typeface, size, color, line spacing).
116 virtual const views::TypographyProvider& GetTypographyProvider() const;
117
118 private:
119 DISALLOW_COPY_AND_ASSIGN(LayoutDelegate);
120 };
121
122 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/harmony/harmony_layout_provider.cc ('k') | chrome/browser/ui/views/harmony/layout_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698