| OLD | NEW |
| 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_LAYOUT_LAYOUT_PROVIDER_H_ | 5 #ifndef UI_VIEWS_LAYOUT_LAYOUT_PROVIDER_H_ |
| 6 #define UI_VIEWS_LAYOUT_LAYOUT_PROVIDER_H_ | 6 #define UI_VIEWS_LAYOUT_LAYOUT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/gfx/geometry/insets.h" | 9 #include "ui/gfx/geometry/insets.h" |
| 10 #include "ui/views/style/typography_provider.h" | 10 #include "ui/views/style/typography_provider.h" |
| 11 #include "ui/views/views_export.h" | 11 #include "ui/views/views_export.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 enum InsetsMetric { | 15 enum InsetsMetric { |
| 16 // Embedders can extend this enum with additional values that are understood | 16 // Embedders can extend this enum with additional values that are understood |
| 17 // by the LayoutProvider implementation. Embedders define enum values from | 17 // by the LayoutProvider implementation. Embedders define enum values from |
| 18 // VIEWS_INSETS_END. Values named beginning with "INSETS_" represent the | 18 // VIEWS_INSETS_END. Values named beginning with "INSETS_" represent the |
| 19 // actual Insets: the rest are markers. | 19 // actual Insets: the rest are markers. |
| 20 VIEWS_INSETS_START = 0, | 20 VIEWS_INSETS_START = 0, |
| 21 | 21 |
| 22 // The margins around the contents area of a bubble (popover)-style dialog. | 22 // The margins around the contents of a bubble (popover)-style dialog. |
| 23 INSETS_BUBBLE_CONTENTS = VIEWS_INSETS_START, | 23 INSETS_BUBBLE_CONTENTS = VIEWS_INSETS_START, |
| 24 // The margins around the title of a bubble (popover)-style dialog. | 24 // The margins around the title of a bubble (popover)-style dialog. The bottom |
| 25 // margin is implied by the content insets. |
| 25 INSETS_BUBBLE_TITLE, | 26 INSETS_BUBBLE_TITLE, |
| 26 // The margins around the button row of a dialog. | 27 // The margins around the button row of a dialog. The top margin is implied |
| 27 INSETS_DIALOG_BUTTON, | 28 // by the content insets. |
| 28 // The margins around the icon/title of a dialog. | 29 INSETS_DIALOG_BUTTON_ROW, |
| 30 // The margins that should be applied around the contents of a dialog. |
| 31 INSETS_DIALOG_CONTENTS, |
| 32 // The margins around the icon/title of a dialog. The bottom margin is implied |
| 33 // by the content insets. |
| 29 INSETS_DIALOG_TITLE, | 34 INSETS_DIALOG_TITLE, |
| 30 // The margins that should be applied around a panel GridLayout. | |
| 31 INSETS_PANEL, | |
| 32 // Padding to add to vector image buttons to increase their click and touch | 35 // Padding to add to vector image buttons to increase their click and touch |
| 33 // target size. | 36 // target size. |
| 34 INSETS_VECTOR_IMAGE_BUTTON, | 37 INSETS_VECTOR_IMAGE_BUTTON, |
| 35 | 38 |
| 36 // Embedders must start Insets enum values from this value. | 39 // Embedders must start Insets enum values from this value. |
| 37 VIEWS_INSETS_END, | 40 VIEWS_INSETS_END, |
| 38 | 41 |
| 39 // All Insets enum values must be below this value. | 42 // All Insets enum values must be below this value. |
| 40 VIEWS_INSETS_MAX = 0x1000 | 43 VIEWS_INSETS_MAX = 0x1000 |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 enum DistanceMetric { | 46 enum DistanceMetric { |
| 44 // DistanceMetric enum values must always be greater than any InsetsMetric | 47 // DistanceMetric enum values must always be greater than any InsetsMetric |
| 45 // value. This allows the code to verify at runtime that arguments of the | 48 // value. This allows the code to verify at runtime that arguments of the |
| 46 // two types have not been interchanged. | 49 // two types have not been interchanged. |
| 47 VIEWS_DISTANCE_START = VIEWS_INSETS_MAX, | 50 VIEWS_DISTANCE_START = VIEWS_INSETS_MAX, |
| 48 | 51 |
| 52 // Margin on the left and right of the contents of a bubble. |
| 53 DISTANCE_BUBBLE_CONTENTS_HORIZONTAL_MARGIN = VIEWS_DISTANCE_START, |
| 54 // Margin on the top and bottom of the contents of a bubble. |
| 55 DISTANCE_BUBBLE_CONTENTS_VERTICAL_MARGIN, |
| 49 // The default padding to add on each side of a button's label. | 56 // The default padding to add on each side of a button's label. |
| 50 DISTANCE_BUTTON_HORIZONTAL_PADDING = VIEWS_DISTANCE_START, | 57 DISTANCE_BUTTON_HORIZONTAL_PADDING, |
| 51 // The maximum width a button can have and still influence the sizes of | 58 // The maximum width a button can have and still influence the sizes of |
| 52 // other linked buttons. This allows short buttons to have linked widths | 59 // other linked buttons. This allows short buttons to have linked widths |
| 53 // without long buttons making things overly wide. | 60 // without long buttons making things overly wide. |
| 54 DISTANCE_BUTTON_MAX_LINKABLE_WIDTH, | 61 DISTANCE_BUTTON_MAX_LINKABLE_WIDTH, |
| 55 // The distance between a dialog's edge and the close button in the upper | 62 // The distance between a dialog's edge and the close button in the upper |
| 56 // trailing corner. | 63 // trailing corner. |
| 57 DISTANCE_CLOSE_BUTTON_MARGIN, | 64 DISTANCE_CLOSE_BUTTON_MARGIN, |
| 65 // Margin between the bottom edge of a dialog and a contained button. |
| 66 DISTANCE_DIALOG_BUTTON_BOTTOM_MARGIN, |
| 58 // The default minimum width of a dialog button. | 67 // The default minimum width of a dialog button. |
| 59 DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH, | 68 DISTANCE_DIALOG_BUTTON_MINIMUM_WIDTH, |
| 69 // Margin on the left and right of the contents of a dialog. |
| 70 DISTANCE_DIALOG_CONTENTS_HORIZONTAL_MARGIN, |
| 71 // Margin on the top and bottom of the contents of a dialog. |
| 72 DISTANCE_DIALOG_CONTENTS_VERTICAL_MARGIN, |
| 60 // The spacing between a pair of related horizontal buttons, used for | 73 // The spacing between a pair of related horizontal buttons, used for |
| 61 // dialog layout. | 74 // dialog layout. |
| 62 DISTANCE_RELATED_BUTTON_HORIZONTAL, | 75 DISTANCE_RELATED_BUTTON_HORIZONTAL, |
| 63 // Horizontal spacing between controls that are logically related. | 76 // Horizontal spacing between controls that are logically related. |
| 64 DISTANCE_RELATED_CONTROL_HORIZONTAL, | 77 DISTANCE_RELATED_CONTROL_HORIZONTAL, |
| 65 // The spacing between a pair of related vertical controls, used for | 78 // The spacing between a pair of related vertical controls, used for |
| 66 // dialog layout. | 79 // dialog layout. |
| 67 DISTANCE_RELATED_CONTROL_VERTICAL, | 80 DISTANCE_RELATED_CONTROL_VERTICAL, |
| 68 | 81 |
| 69 // Embedders must start DistanceMetric enum values from here. | 82 // Embedders must start DistanceMetric enum values from here. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 95 | 108 |
| 96 private: | 109 private: |
| 97 DefaultTypographyProvider typography_provider_; | 110 DefaultTypographyProvider typography_provider_; |
| 98 | 111 |
| 99 DISALLOW_COPY_AND_ASSIGN(LayoutProvider); | 112 DISALLOW_COPY_AND_ASSIGN(LayoutProvider); |
| 100 }; | 113 }; |
| 101 | 114 |
| 102 } // namespace views | 115 } // namespace views |
| 103 | 116 |
| 104 #endif // UI_VIEWS_LAYOUT_LAYOUT_PROVIDER_H_ | 117 #endif // UI_VIEWS_LAYOUT_LAYOUT_PROVIDER_H_ |
| OLD | NEW |