-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRTSpinKitView.h
More file actions
158 lines (126 loc) · 4.58 KB
/
Copy pathRTSpinKitView.h
File metadata and controls
158 lines (126 loc) · 4.58 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//
// RTSpinKitView.h
// SpinKit
//
// Copyright (c) 2014 Ramon Torres
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
typedef NS_ENUM(NSInteger, RTSpinKitViewStyle) {
RTSpinKitViewStyleCustom,
RTSpinKitViewStylePlane,
RTSpinKitViewStyleCircleFlip,
RTSpinKitViewStyleBounce,
RTSpinKitViewStyleWave,
RTSpinKitViewStyleWanderingCubes,
RTSpinKitViewStylePulse,
RTSpinKitViewStyleChasingDots,
RTSpinKitViewStyleThreeBounce,
RTSpinKitViewStyleCircle,
RTSpinKitViewStyle9CubeGrid,
RTSpinKitViewStyleWordPress,
RTSpinKitViewStyleFadingCircle,
RTSpinKitViewStyleFadingCircleAlt,
RTSpinKitViewStyleArc,
RTSpinKitViewStyleArcAlt
};
@protocol RTSpinKitAnimating;
/**
The `RTSpinKitView` defines an activity indicator view. It's interface is very similar
to `UIActivityIndicatorView`.
*/
@interface RTSpinKitView : NSView
/**
The color of the activity indicator.
*/
@property (nonatomic, strong) NSColor *color;
/**
Whether or not the receiver should be hidden when not animating.
*/
@property (nonatomic, assign) BOOL hidesWhenStopped;
/**
The style for the activity indicator.
@see RTSpinKitViewStyle
*/
@property (nonatomic, assign) RTSpinKitViewStyle style;
/**
The size of the spinner. The view will be automatically resized to fit the activity indicator.
*/
@property (nonatomic, assign) CGFloat spinnerSize;
@property (nonatomic, assign, getter = isStopped) BOOL stopped;
/**
Returns an object initialized from data in a given unarchiver.
@return The initialized SpinKit view using the data in aDecoder;
*/
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
/**
Initializes and returns an activity indicator object.
@param style The style of the activity indicator.
@return The newly-initialized SpinKit view.
*/
-(instancetype)initWithStyle:(RTSpinKitViewStyle)style;
/**
Initializes and returns an activity indicator object.
@param style The style of the activity indicator.
@param color The color of the activity indicator.
@return The newly-initialized SpinKit view.
*/
-(instancetype)initWithStyle:(RTSpinKitViewStyle)style
color:(NSColor*)color;
/**
Initializes and returns an activity indicator object.
@param animator The RTSpinKitAnimating conforming animator object that will perform the animation.
@param color The color of the activity indicator.
@param spinnerSize The size of the spinner.
@return The newly-initialized SpinKit view.
*/
-(instancetype)initWithAnimator:(id<RTSpinKitAnimating>)animator
color:(NSColor*)color
spinnerSize:(CGFloat)spinnerSize;
/**
Initializes and returns an activity indicator object.
Designated initializer.
@param style The style of the activity indicator.
@param color The color of the activity indicator.
@param spinnerSize The size of the spinner.
@return The newly-initialized SpinKit view.
*/
-(instancetype)initWithStyle:(RTSpinKitViewStyle)style
color:(NSColor*)color
spinnerSize:(CGFloat)spinnerSize NS_DESIGNATED_INITIALIZER;
/**
Starts the animation of the activity indicator.
*/
-(void)startAnimating;
/**
Stops the animation of the activity indicator.
*/
-(void)stopAnimating;
/**
Returns whether the receiver is animating.
@return `YES` if the receiver is animating, otherwise `NO`.
*/
-(BOOL)isAnimating;
/**
Sets the color of the spinner.
@param color The desired color for the spinner.
@param animated Whether or not to animate.
*/
-(void)setColor:(NSColor *)color animated:(BOOL)animated;
@end