OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ |
6 #define IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ | 6 #define IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ |
7 | 7 |
8 #include <CoreGraphics/CoreGraphics.h> | 8 #include <CoreGraphics/CoreGraphics.h> |
9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
10 #import <UIKit/UIKit.h> | 10 #import <UIKit/UIKit.h> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void ApplyVisualConstraintsWithMetrics(NSArray* constraints, | 135 void ApplyVisualConstraintsWithMetrics(NSArray* constraints, |
136 NSDictionary* subviewsDictionary, | 136 NSDictionary* subviewsDictionary, |
137 NSDictionary* metrics, | 137 NSDictionary* metrics, |
138 UIView* parentView); | 138 UIView* parentView); |
139 | 139 |
140 // Adds a constraint that |subview| is center aligned horizontally in | 140 // Adds a constraint that |subview| is center aligned horizontally in |
141 // |parentView|. | 141 // |parentView|. |
142 // |subview| must be a subview of |parentView|. | 142 // |subview| must be a subview of |parentView|. |
143 void AddSameCenterXConstraint(UIView* parentView, UIView* subview); | 143 void AddSameCenterXConstraint(UIView* parentView, UIView* subview); |
144 | 144 |
| 145 // Adds a constraint that |subview1| and |subview2| are center aligned |
| 146 // horizontally on |parentView|. |
| 147 // |subview1| and |subview2| must be subview of |parentView|. |
| 148 void AddSameCenterXConstraint(UIView *parentView, UIView *subview1, |
| 149 UIView *subview2); |
| 150 |
145 // Adds a constraint that |subview| is center aligned vertically in | 151 // Adds a constraint that |subview| is center aligned vertically in |
146 // |parentView|. | 152 // |parentView|. |
147 // |subview| must be a subview of |parentView|. | 153 // |subview| must be a subview of |parentView|. |
148 void AddSameCenterYConstraint(UIView* parentView, UIView* subview); | 154 void AddSameCenterYConstraint(UIView* parentView, UIView* subview); |
149 | 155 |
150 // Adds a constraint that |subview1| and |subview2| are center aligned | 156 // Adds a constraint that |subview1| and |subview2| are center aligned |
151 // vertically on |parentView|. | 157 // vertically on |parentView|. |
152 // |subview1| and |subview2| must be subview of |parentView|. | 158 // |subview1| and |subview2| must be subview of |parentView|. |
153 void AddSameCenterYConstraint(UIView* parentView, | 159 void AddSameCenterYConstraint(UIView* parentView, |
154 UIView* subview1, | 160 UIView* subview1, |
155 UIView* subview2); | 161 UIView* subview2); |
| 162 // Whether the UI is configured for right to left layout. |
| 163 // The implementation will use the local in order to get the UI layout direction |
| 164 // for version of iOS under 9. |
| 165 // TODO(jbbegue): Use base::i18n::IsRTL() instead when it will support RTL |
| 166 // pseudo language. Remove that method once base::i18n::IsRTL() is fixed. |
| 167 // crbug/514625. |
| 168 BOOL IsRTLUILayout(); |
156 | 169 |
157 // Returns true if the main application window's rootViewController is a compact | 170 // Returns true if the main application window's rootViewController is a compact |
158 // iPad horizontal size class. | 171 // iPad horizontal size class. |
159 bool IsCompactTablet(); | 172 bool IsCompactTablet(); |
160 | 173 |
161 // Returns true if the horizontal |sizeClass| is compact and device is an iPad. | 174 // Returns true if the horizontal |sizeClass| is compact and device is an iPad. |
162 bool IsCompactTabletSizeClass(UIUserInterfaceSizeClass sizeClass); | 175 bool IsCompactTabletSizeClass(UIUserInterfaceSizeClass sizeClass); |
163 | 176 |
164 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ | 177 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ |
OLD | NEW |