/
NSView+MPExtensions.h
52 lines (37 loc) · 1.83 KB
/
NSView+MPExtensions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// NSView+MPExtensions.h
// Manuscripts
//
// Created by Matias Piipari on 21/12/2012.
// Copyright (c) 2012 Manuscripts.app Limited. All rights reserved.
//
#import <Cocoa/Cocoa.h>
extern inline id MPAnimatorOrView(NSView *view, BOOL animate);
extern inline id MPAnimatorOrConstraint(NSLayoutConstraint *constraint, BOOL animate);
extern inline NSInteger MPBooleanToState(BOOL b);
extern inline BOOL MPStateToBoolean(NSInteger state);
@interface NSView (MPViewExtensions)
- (void)addEdgeConstraint:(NSLayoutAttribute)edge subview:(NSView *)subview;
- (void)addEdgeConstraint:(NSLayoutAttribute)edge constantOffset:(CGFloat)value subview:(NSView *)subview;
- (void)addSubviewConstrainedToSuperViewEdges:(NSView *)aView;
- (void)addSubviewConstrainedToSuperViewEdges:(NSView *)aView
topOffset:(CGFloat)topOffset
rightOffset:(CGFloat)rightOffset
bottomOffset:(CGFloat)bottomOffset
leftOffset:(CGFloat)leftOffset;
- (BOOL) hasSubview:(NSView *)subview;
- (NSLayoutConstraint *) heightConstraint;
- (NSLayoutConstraint *) horizontalConstraintWithView:(NSView *)anotherView;
- (NSLayoutConstraint *) verticalConstraintWithView:(NSView *)anotherView;
- (NSLayoutConstraint *) widthConstraint;
- (void) hideWithZeroWidth;
- (void) hideWithZeroWidthAndAnimate:(BOOL)animate;
+ (void) hideViews:(NSArray *)views withZeroWidthAndAnimate:(BOOL)animate;
- (void) hideWithZeroHeight;
- (void) hideWithZeroHeightAndAnimate:(BOOL)animate;
+ (void) hideViews:(NSArray *)views withZeroHeightAndAnimate:(BOOL)animate;
- (void) showWithWidth:(CGFloat)width;
- (void) showWithWidth:(CGFloat)width andAnimate:(BOOL)animate;
- (void) showWithHeight:(CGFloat)height;
- (void) showWithHeight:(CGFloat)height andAnimate:(BOOL)animate;
@end