| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 UIView* subview2); | 261 UIView* subview2); |
| 262 | 262 |
| 263 // Adds a constraint that |view1| and |view2| are center-aligned vertically. | 263 // Adds a constraint that |view1| and |view2| are center-aligned vertically. |
| 264 // |view1| and |view2| must be in the same view hierarchy. | 264 // |view1| and |view2| must be in the same view hierarchy. |
| 265 void AddSameCenterYConstraint(UIView* view1, UIView* view2); | 265 void AddSameCenterYConstraint(UIView* view1, UIView* view2); |
| 266 // Deprecated version: | 266 // Deprecated version: |
| 267 void AddSameCenterYConstraint(UIView* unused_parentView, | 267 void AddSameCenterYConstraint(UIView* unused_parentView, |
| 268 UIView* subview1, | 268 UIView* subview1, |
| 269 UIView* subview2); | 269 UIView* subview2); |
| 270 | 270 |
| 271 // Adds constraints to make two views' sizes equal by pinning leading, trailing, | 271 // Adds constraints to make two views' size and center equal by pinning leading, |
| 272 // top and bottom anchors. | 272 // trailing, top and bottom anchors. |
| 273 void AddSameSizeConstraint(UIView* view1, UIView* view2); | 273 void AddSameConstraints(UIView* view1, UIView* view2); |
| 274 | 274 |
| 275 // Whether the |environment| has a compact horizontal size class. | 275 // Whether the |environment| has a compact horizontal size class. |
| 276 bool IsCompact(id<UITraitEnvironment> environment); | 276 bool IsCompact(id<UITraitEnvironment> environment); |
| 277 | 277 |
| 278 // Whether the main application window's rootViewController has a compact | 278 // Whether the main application window's rootViewController has a compact |
| 279 // horizontal size class. | 279 // horizontal size class. |
| 280 bool IsCompact(); | 280 bool IsCompact(); |
| 281 | 281 |
| 282 // Whether the |environment| has a compact iPad horizontal size class. | 282 // Whether the |environment| has a compact iPad horizontal size class. |
| 283 bool IsCompactTablet(id<UITraitEnvironment> environment); | 283 bool IsCompactTablet(id<UITraitEnvironment> environment); |
| 284 | 284 |
| 285 // Whether the main application window's rootViewController has a compact | 285 // Whether the main application window's rootViewController has a compact |
| 286 // iPad horizontal size class. | 286 // iPad horizontal size class. |
| 287 bool IsCompactTablet(); | 287 bool IsCompactTablet(); |
| 288 | 288 |
| 289 // Returns the current first responder. | 289 // Returns the current first responder. |
| 290 UIResponder* GetFirstResponder(); | 290 UIResponder* GetFirstResponder(); |
| 291 | 291 |
| 292 // On iOS10 and above, trigger a haptic vibration for various types of | 292 // On iOS10 and above, trigger a haptic vibration for various types of |
| 293 // actions. This is a no-op for devices that do not support haptic feedback. | 293 // actions. This is a no-op for devices that do not support haptic feedback. |
| 294 void TriggerHapticFeedbackForAction(); | 294 void TriggerHapticFeedbackForAction(); |
| 295 void TriggerHapticFeedbackForSelectionChange(); | 295 void TriggerHapticFeedbackForSelectionChange(); |
| 296 void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type); | 296 void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type); |
| 297 | 297 |
| 298 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ | 298 #endif // IOS_CHROME_BROWSER_UI_UIKIT_UI_UTIL_H_ |
| OLD | NEW |