Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add submodule for new blockskit repo

  • Loading branch information...
commit 199a311a988d9dc5809c463bacb0429fa4f3b35a 1 parent 772798c
Caleb Davenport authored May 22, 2012
3  .gitmodules
... ...
@@ -0,0 +1,3 @@
  1
+[submodule "blockskit"]
  2
+	path = blockskit
  3
+	url = git://github.com/calebmdavenport/blockskit.git
48  GCActionSheet.h
... ...
@@ -1,48 +0,0 @@
1  
-/*
2  
- 
3  
- Copyright (C) 2011 GUI Cocoa, LLC.
4  
- 
5  
- Permission is hereby granted, free of charge, to any person obtaining a copy
6  
- of this software and associated documentation files (the "Software"), to deal
7  
- in the Software without restriction, including without limitation the rights
8  
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  
- copies of the Software, and to permit persons to whom the Software is
10  
- furnished to do so, subject to the following conditions:
11  
- 
12  
- The above copyright notice and this permission notice shall be included in
13  
- all copies or substantial portions of the Software.
14  
- 
15  
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  
- THE SOFTWARE.
22  
- 
23  
- */
24  
-
25  
-#import <UIKit/UIKit.h>
26  
-
27  
-#ifndef __IPHONE_4_0
28  
-#error "This project uses features only available in iPhone SDK 4.0 and later."
29  
-#endif
30  
-
31  
-@interface GCActionSheet : UIActionSheet <UIActionSheetDelegate> {
32  
-@private
33  
-    NSMutableDictionary *actions;
34  
-}
35  
-
36  
-// create an action sheet
37  
-- (id)initWithTitle:(NSString *)title;
38  
-
39  
-// add buttons
40  
-- (void)addButtonWithTitle:(NSString *)title block:(void (^) (void))block;
41  
-
42  
-// perform common delegate tasks
43  
-- (void)setWillDismissBlock:(void (^) (void))block;
44  
-- (void)setDidDismissBlock:(void (^) (void))block;
45  
-- (void)setWillPresentBlock:(void (^) (void))block;
46  
-- (void)setDidPresentBlock:(void (^) (void))block;
47  
-
48  
-@end
118  GCActionSheet.m
... ...
@@ -1,118 +0,0 @@
1  
-/*
2  
- 
3  
- Copyright (C) 2011 GUI Cocoa, LLC.
4  
- 
5  
- Permission is hereby granted, free of charge, to any person obtaining a copy
6  
- of this software and associated documentation files (the "Software"), to deal
7  
- in the Software without restriction, including without limitation the rights
8  
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  
- copies of the Software, and to permit persons to whom the Software is
10  
- furnished to do so, subject to the following conditions:
11  
- 
12  
- The above copyright notice and this permission notice shall be included in
13  
- all copies or substantial portions of the Software.
14  
- 
15  
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  
- THE SOFTWARE.
22  
- 
23  
- */
24  
-
25  
-#import "GCActionSheet.h"
26  
-
27  
-static NSString *GCActionSheetWillPresentKey = @"GCActionSheetWillPresentAction";
28  
-static NSString *GCActionSheetDidPresentKey = @"GCActionSheetDidPresentAction";
29  
-static NSString *GCActionSheetWillDismissKey = @"GCActionSheetWillDismissAction";
30  
-static NSString *GCActionSheetDidDismissKey = @"GCActionSheetDidDismissAction";
31  
-
32  
-@implementation GCActionSheet
33  
-- (id)initWithTitle:(NSString *)title {
34  
-    self = [super initWithTitle:title delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
35  
-    if (self) {
36  
-        actions = [[NSMutableDictionary alloc] init];
37  
-    }
38  
-    return self;
39  
-}
40  
-- (void)dealloc {
41  
-    [actions release];
42  
-    actions = nil;
43  
-    [super dealloc];
44  
-}
45  
-- (void)addButtonWithTitle:(NSString *)title block:(void (^) (void))block {
46  
-    if ([actions objectForKey:title]) { return; }
47  
-    [self addButtonWithTitle:title];
48  
-    if (block) {
49  
-        void (^action) () = Block_copy(block);
50  
-        [actions setObject:action forKey:title];
51  
-        Block_release(action);
52  
-    }
53  
-}
54  
-- (void)setWillPresentBlock:(void (^) (void))block {
55  
-    if (block) {
56  
-        void (^action) () = Block_copy(block);
57  
-        [actions setObject:action forKey:GCActionSheetWillPresentKey];
58  
-        Block_release(action);
59  
-    }
60  
-    else {
61  
-        [actions removeObjectForKey:GCActionSheetWillPresentKey];
62  
-    }
63  
-}
64  
-- (void)setDidPresentBlock:(void (^) (void))block {
65  
-    if (block) {
66  
-        void (^action) () = Block_copy(block);
67  
-        [actions setObject:action forKey:GCActionSheetDidPresentKey];
68  
-        Block_release(action);
69  
-    }
70  
-    else {
71  
-        [actions removeObjectForKey:GCActionSheetDidPresentKey];
72  
-    }
73  
-}
74  
-- (void)setWillDismissBlock:(void (^) (void))block {
75  
-    if (block) {
76  
-        void (^action) () = Block_copy(block);
77  
-        [actions setObject:action forKey:GCActionSheetWillDismissKey];
78  
-        Block_release(action);
79  
-    }
80  
-    else {
81  
-        [actions removeObjectForKey:GCActionSheetWillDismissKey];
82  
-    }
83  
-}
84  
-- (void)setDidDismissBlock:(void (^) (void))block {
85  
-    if (block) {
86  
-        void (^action) () = Block_copy(block);
87  
-        [actions setObject:action forKey:GCActionSheetDidDismissKey];
88  
-        Block_release(action);
89  
-    }
90  
-    else {
91  
-        [actions removeObjectForKey:GCActionSheetDidDismissKey];
92  
-    }
93  
-}
94  
-- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
95  
-    if (buttonIndex >= 0 && buttonIndex < actionSheet.numberOfButtons) {
96  
-        NSString *title = [actionSheet buttonTitleAtIndex:buttonIndex];
97  
-        void (^action) () = [actions objectForKey:title];
98  
-        if (action) { action(); }
99  
-    }
100  
-}
101  
-- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
102  
-    void (^action) () = [actions objectForKey:GCActionSheetWillPresentKey];
103  
-    if (action) { action(); }
104  
-}
105  
-- (void)didPresentActionSheet:(UIActionSheet *)actionSheet {
106  
-    void (^action) () = [actions objectForKey:GCActionSheetDidPresentKey];
107  
-    if (action) { action(); }
108  
-}
109  
-- (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
110  
-    void (^action) () = [actions objectForKey:GCActionSheetWillDismissKey];
111  
-    if (action) { action(); }
112  
-}
113  
-- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
114  
-    void (^action) () = [actions objectForKey:GCActionSheetDidDismissKey];
115  
-    if (action) { action(); }
116  
-}
117  
-
118  
-@end
45  GCAlertView.h
... ...
@@ -1,45 +0,0 @@
1  
-/*
2  
- 
3  
- Copyright (C) 2011 GUI Cocoa, LLC.
4  
- 
5  
- Permission is hereby granted, free of charge, to any person obtaining a copy
6  
- of this software and associated documentation files (the "Software"), to deal
7  
- in the Software without restriction, including without limitation the rights
8  
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  
- copies of the Software, and to permit persons to whom the Software is
10  
- furnished to do so, subject to the following conditions:
11  
- 
12  
- The above copyright notice and this permission notice shall be included in
13  
- all copies or substantial portions of the Software.
14  
- 
15  
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  
- THE SOFTWARE.
22  
- 
23  
- */
24  
-
25  
-#import <UIKit/UIKit.h>
26  
-
27  
-#ifndef __IPHONE_4_0
28  
-#error "This project uses features only available in iPhone SDK 4.0 and later."
29  
-#endif
30  
-
31  
-@interface GCAlertView : UIAlertView <UIAlertViewDelegate>
32  
-
33  
-// create an alert view
34  
-- (id)initWithTitle:(NSString *)title message:(NSString *)message;
35  
-
36  
-// add buttons
37  
-- (void)addButtonWithTitle:(NSString *)title block:(void (^) (void))block;
38  
-
39  
-// perform common delegate tasks
40  
-- (void)setWillDismissBlock:(void (^) (void))block;
41  
-- (void)setDidDismissBlock:(void (^) (void))block;
42  
-- (void)setWillPresentBlock:(void (^) (void))block;
43  
-- (void)setDidPresentBlock:(void (^) (void))block;
44  
-
45  
-@end
124  GCAlertView.m
... ...
@@ -1,124 +0,0 @@
1  
-/*
2  
- 
3  
- Copyright (C) 2011 GUI Cocoa, LLC.
4  
- 
5  
- Permission is hereby granted, free of charge, to any person obtaining a copy
6  
- of this software and associated documentation files (the "Software"), to deal
7  
- in the Software without restriction, including without limitation the rights
8  
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  
- copies of the Software, and to permit persons to whom the Software is
10  
- furnished to do so, subject to the following conditions:
11  
- 
12  
- The above copyright notice and this permission notice shall be included in
13  
- all copies or substantial portions of the Software.
14  
- 
15  
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21  
- THE SOFTWARE.
22  
- 
23  
- */
24  
-
25  
-#import "GCAlertView.h"
26  
-
27  
-static NSString *GCAlertViewWillPresentKey = @"GCAlertViewWillPresentAction";
28  
-static NSString *GCAlertViewDidPresentKey = @"GCAlertViewDidPresentAction";
29  
-static NSString *GCAlertViewWillDismissKey = @"GCAlertViewWillDismissAction";
30  
-static NSString *GCAlertViewDidDismissKey = @"GCAlertViewDidDismissAction";
31  
-
32  
-@interface GCAlertView ()
33  
-@property (nonatomic, retain) NSMutableDictionary *actions;
34  
-@end
35  
-
36  
-@implementation GCAlertView
37  
-
38  
-@synthesize actions = __actions;
39  
-
40  
-- (id)initWithTitle:(NSString *)title message:(NSString *)message {
41  
-    self = [super initWithTitle:title message:message delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
42  
-    if (self) {
43  
-        self.actions = [[[NSMutableDictionary alloc] init] autorelease];
44  
-    }
45  
-    return self;
46  
-}
47  
-- (void)dealloc {
48  
-    self.actions = nil;
49  
-    [super dealloc];
50  
-}
51  
-- (void)addButtonWithTitle:(NSString *)title block:(void (^) (void))block {
52  
-    if ([self.actions objectForKey:title]) { return; }
53  
-    [self addButtonWithTitle:title];
54  
-    if (block) {
55  
-        void (^action) () = Block_copy(block);
56  
-        [self.actions setObject:action forKey:title];
57  
-        Block_release(action);
58  
-    }
59  
-}
60  
-- (void)setWillPresentBlock:(void (^) (void))block {
61  
-    if (block) {
62  
-        void (^action) () = Block_copy(block);
63  
-        [self.actions setObject:action forKey:GCAlertViewWillPresentKey];
64  
-        Block_release(action);
65  
-    }
66  
-    else {
67  
-        [self.actions removeObjectForKey:GCAlertViewWillPresentKey];
68  
-    }
69  
-}
70  
-- (void)setDidPresentBlock:(void (^) (void))block {
71  
-    if (block) {
72  
-        void (^action) () = Block_copy(block);
73  
-        [self.actions setObject:action forKey:GCAlertViewDidPresentKey];
74  
-        Block_release(action);
75  
-    }
76  
-    else {
77  
-        [self.actions removeObjectForKey:GCAlertViewDidPresentKey];
78  
-    }
79  
-}
80  
-- (void)setWillDismissBlock:(void (^) (void))block {
81  
-    if (block) {
82  
-        void (^action) () = Block_copy(block);
83  
-        [self.actions setObject:action forKey:GCAlertViewWillDismissKey];
84  
-        Block_release(action);
85  
-    }
86  
-    else {
87  
-        [self.actions removeObjectForKey:GCAlertViewWillDismissKey];
88  
-    }
89  
-}
90  
-- (void)setDidDismissBlock:(void (^) (void))block {
91  
-    if (block) {
92  
-        void (^action) () = Block_copy(block);
93  
-        [self.actions setObject:action forKey:GCAlertViewDidDismissKey];
94  
-        Block_release(action);
95  
-    }
96  
-    else {
97  
-        [self.actions removeObjectForKey:GCAlertViewDidDismissKey];
98  
-    }
99  
-}
100  
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
101  
-    if (buttonIndex >= 0 && buttonIndex < alertView.numberOfButtons) {
102  
-        NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
103  
-        void (^action) () = [self.actions objectForKey:title];
104  
-        if (action) { action(); }
105  
-    }
106  
-}
107  
-- (void)willPresentAlertView:(UIAlertView *)alertView {
108  
-    void (^action) () = [self.actions objectForKey:GCAlertViewWillPresentKey];
109  
-    if (action) { action(); }
110  
-}
111  
-- (void)didPresentAlertView:(UIAlertView *)alertView {
112  
-    void (^action) () = [self.actions objectForKey:GCAlertViewDidPresentKey];
113  
-    if (action) { action(); }
114  
-}
115  
-- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
116  
-    void (^action) () = [self.actions objectForKey:GCAlertViewWillDismissKey];
117  
-    if (action) { action(); }
118  
-}
119  
-- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
120  
-    void (^action) () = [self.actions objectForKey:GCAlertViewDidDismissKey];
121  
-    if (action) { action(); }
122  
-}
123  
-
124  
-@end
1  blockskit
... ...
@@ -0,0 +1 @@
  1
+Subproject commit 61ac4fef83b1fd34c1d4e8707ec4e1c6f0824961

0 notes on commit 199a311

Please sign in to comment.
Something went wrong with that request. Please try again.