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

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

Issue 2666043002: Try to rename LayoutDistanceType enum values for clarity and consistency. (Closed)
Patch Set: Fix comment Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
7 7
8 #include "ui/views/layout/grid_layout.h" 8 #include "ui/views/layout/grid_layout.h"
9 9
10 class LayoutDelegate { 10 class LayoutDelegate {
11 public: 11 public:
12 enum class LayoutDistanceType { 12 enum class LayoutDistanceType {
13 // Left or right margin. 13 // Horizontal or vertical margin between the edge of a dialog and a
14 PANEL_HORIZ_MARGIN, 14 // contained button.
15 // Top or bottom margin. 15 DIALOG_BUTTON_MARGIN,
16 PANEL_VERT_MARGIN, 16 // Horizontal or vertical margin between the edge of a panel and the
17 // Horizontal spacing between controls that are logically related. 17 // contained content.
18 PANEL_CONTENT_MARGIN,
19 // Horizontal spacing between buttons that are logically related, e.g.
20 // for a button set.
21 RELATED_BUTTON_HORIZONTAL_SPACING,
22 // Horizontal spacing between other controls that are logically related.
18 RELATED_CONTROL_HORIZONTAL_SPACING, 23 RELATED_CONTROL_HORIZONTAL_SPACING,
19 // Vertical spacing between controls that are logically related. 24 // Vertical spacing between controls that are logically related.
20 RELATED_CONTROL_VERTICAL_SPACING, 25 RELATED_CONTROL_VERTICAL_SPACING,
21 // Horizontal spacing between buttons that are logically related. 26 // Horizontal indent of a subsection relative to related items above, e.g.
22 RELATED_BUTTON_HORIZONTAL_SPACING, 27 // checkboxes below explanatory text/headings.
28 SUBSECTION_HORIZONTAL_INDENT,
23 // Vertical spacing between controls that are logically unrelated. 29 // Vertical spacing between controls that are logically unrelated.
24 UNRELATED_CONTROL_VERTICAL_SPACING, 30 UNRELATED_CONTROL_VERTICAL_SPACING,
25 // Larger vertical spacing between unrelated controls. 31 // Larger vertical spacing between unrelated controls.
26 UNRELATED_CONTROL_LARGE_VERTICAL_SPACING, 32 UNRELATED_CONTROL_VERTICAL_SPACING_LARGE,
27 // Vertical spacing between the edge of the window and the
28 // top or bottom of a button.
29 BUTTON_HEDGE_MARGIN_NEW,
30 // Horizontal spacing between the edge of the window and the
31 // left or right of a button.
32 BUTTON_VEDGE_MARGIN_NEW,
33 // Indent of checkboxes relative to related text.
34 CHECKBOX_INDENT,
35 }; 33 };
36 34
37 enum class DialogWidthType { 35 enum class DialogWidthType {
38 SMALL, 36 SMALL,
39 MEDIUM, 37 MEDIUM,
40 LARGE, 38 LARGE,
41 }; 39 };
42 40
43 LayoutDelegate() {} 41 LayoutDelegate() {}
44 virtual ~LayoutDelegate() {} 42 virtual ~LayoutDelegate() {}
45 43
46 // Returns the active LayoutDelegate singleton, depending on UI configuration. 44 // Returns the active LayoutDelegate singleton, depending on UI configuration.
47 // By default, this is the same instance returned by Get(), but if Harmony 45 // This may be an instance of this class or a subclass, e.g. a
48 // or another UI style is enabled, this may be an instance of a LayoutDelegate 46 // HarmonyLayoutDelegate.
49 // subclass instead.
50 static LayoutDelegate* Get(); 47 static LayoutDelegate* Get();
51 48
52 // Returns a layout distance, indexed by |type|. These distances are in 49 // Returns the requested distance in DIPs.
53 // device-independent units.
54 virtual int GetLayoutDistance(LayoutDistanceType type) const; 50 virtual int GetLayoutDistance(LayoutDistanceType type) const;
55 51
56 // Returns the alignment used for control labels in a GridLayout; for example, 52 // Returns the alignment used for control labels in a GridLayout; for example,
57 // in this GridLayout: 53 // in this GridLayout:
58 // --------------------------- 54 // ---------------------------
59 // | Label 1 Checkbox 1 | 55 // | Label 1 Checkbox 1 |
60 // | Label 2 Checkbox 2 | 56 // | Label 2 Checkbox 2 |
61 // --------------------------- 57 // ---------------------------
62 // This value controls the alignment used for "Label 1" and "Label 2". 58 // This value controls the alignment used for "Label 1" and "Label 2".
63 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const; 59 virtual views::GridLayout::Alignment GetControlLabelGridAlignment() const;
64 60
65 // Returns whether to use extra padding on dialogs. If this is false, content 61 // Returns whether to use extra padding on dialogs. If this is false, content
66 // Views for dialogs should not insert extra padding at their own edges. 62 // Views for dialogs should not insert extra padding at their own edges.
67 virtual bool UseExtraDialogPadding() const; 63 virtual bool UseExtraDialogPadding() const;
68 64
69 // Returns whether Harmony mode is enabled. This method is deprecated and 65 // DEPRECATED. Returns whether Harmony mode is enabled.
70 // should only be used in dire circumstances, such as when Harmony specifies a 66 //
71 // different distance type than was previously used. 67 // Instead of using this, create a generic solution that works for all UI
68 // types, e.g. by adding a new LayoutDistance value that means what you need.
69 //
70 // TODO(pkasting): Fix callers and remove this.
72 virtual bool IsHarmonyMode() const; 71 virtual bool IsHarmonyMode() const;
73 72
74 // Returns the preferred width for a dialog of the specified width type. If 73 // Returns the preferred width in DIPs for a dialog of the specified |type|.
75 // there is no preferred width for |type|, returns 0. 74 // May return 0 if the dialog has no preferred width.
76 virtual int GetDialogPreferredWidth(DialogWidthType type) const; 75 virtual int GetDialogPreferredWidth(DialogWidthType type) const;
77 76
78 private: 77 private:
79 DISALLOW_COPY_AND_ASSIGN(LayoutDelegate); 78 DISALLOW_COPY_AND_ASSIGN(LayoutDelegate);
80 }; 79 };
81 80
82 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_ 81 #endif // CHROME_BROWSER_UI_VIEWS_HARMONY_LAYOUT_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/harmony/harmony_layout_delegate.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