appjam 0.1.8.8 → 0.1.8.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/README.md +22 -62
  2. data/lib/appjam/generators/gist.yml +1 -1
  3. data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +1166 -482
  4. data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  5. data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Prefix.pch.tt +26 -0
  6. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.h +52 -0
  7. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.m +412 -0
  8. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.h +44 -0
  9. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.m +97 -0
  10. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted.png +0 -0
  11. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted@2x.png +0 -0
  12. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton.png +0 -0
  13. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton@2x.png +0 -0
  14. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted.png +0 -0
  15. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted@2x.png +0 -0
  16. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem.png +0 -0
  17. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem@2x.png +0 -0
  18. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted.png +0 -0
  19. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted@2x.png +0 -0
  20. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus.png +0 -0
  21. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus@2x.png +0 -0
  22. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star.png +0 -0
  23. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star@2x.png +0 -0
  24. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.h +167 -0
  25. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.m +639 -0
  26. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.h +97 -0
  27. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.m +1080 -0
  28. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.h +451 -0
  29. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.m +865 -0
  30. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.h +42 -0
  31. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.m +56 -0
  32. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.h +90 -0
  33. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.m +316 -0
  34. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.h +104 -0
  35. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.m +516 -0
  36. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldConstants.h +49 -0
  37. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.h +18 -0
  38. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.m +88 -0
  39. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left.png +0 -0
  40. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left@2x.png +0 -0
  41. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right.png +0 -0
  42. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right@2x.png +0 -0
  43. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.h +25 -0
  44. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.m +76 -0
  45. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.h +131 -0
  46. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.m +941 -0
  47. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide.psd +0 -0
  48. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide2.psd +0 -0
  49. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.h +46 -0
  50. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.m +82 -0
  51. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.h +39 -0
  52. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.m +72 -0
  53. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.h +42 -0
  54. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.m +100 -0
  55. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.h +34 -0
  56. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.m +140 -0
  57. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.h +17 -0
  58. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.m +57 -0
  59. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.h +30 -0
  60. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.m +233 -0
  61. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.h +19 -0
  62. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.m +122 -0
  63. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewDataSource.h +24 -0
  64. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.h +20 -0
  65. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.m +56 -0
  66. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine.png +0 -0
  67. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine@2x.png +0 -0
  68. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone.png +0 -0
  69. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone@2x.png +0 -0
  70. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar.png +0 -0
  71. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar@2x.png +0 -0
  72. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine.png +0 -0
  73. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine@2x.png +0 -0
  74. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone.png +0 -0
  75. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone@2x.png +0 -0
  76. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.h +124 -0
  77. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.m +545 -0
  78. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.h +22 -0
  79. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.m +32 -0
  80. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.h +344 -0
  81. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.m +848 -0
  82. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.h +135 -0
  83. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.m +441 -0
  84. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.h +40 -0
  85. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.m +36 -0
  86. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.h +76 -0
  87. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.m +270 -0
  88. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.h +95 -0
  89. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.m +78 -0
  90. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.h +144 -0
  91. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.m +311 -0
  92. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.h +40 -0
  93. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.m +54 -0
  94. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.h +18 -0
  95. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.m +70 -0
  96. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.h +102 -0
  97. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.m +226 -0
  98. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.h +25 -0
  99. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.m +339 -0
  100. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.h +167 -0
  101. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.m +244 -0
  102. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageOperation.h +15 -0
  103. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.h +58 -0
  104. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.m +127 -0
  105. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.h +173 -0
  106. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.m +129 -0
  107. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.h +140 -0
  108. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.m +84 -0
  109. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationProgram.h +28 -0
  110. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationSequence.h +28 -0
  111. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationStep.h +49 -0
  112. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationProgram.m +100 -0
  113. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationSequence.m +85 -0
  114. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationStep.m +122 -0
  115. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.h +1074 -0
  116. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.m +7430 -0
  117. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
  118. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
  119. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
  120. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
  121. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
  122. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
  123. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
  124. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
  125. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.h +119 -0
  126. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
  127. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
  128. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
  129. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
  130. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
  131. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.h +205 -0
  132. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.m +772 -0
  133. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
  134. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
  135. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
  136. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
  137. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
  138. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
  139. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
  140. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
  141. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
  142. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
  143. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
  144. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
  145. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
  146. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
  147. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
  148. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
  149. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
  150. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
  151. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.h +105 -0
  152. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.m +791 -0
  153. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
  154. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
  155. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
  156. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
  157. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
  158. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
  159. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
  160. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
  161. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.h +54 -0
  162. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.m +102 -0
  163. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.h +103 -0
  164. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.m +200 -0
  165. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.h +10 -0
  166. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.m +197 -0
  167. data/lib/appjam/version.rb +1 -1
  168. metadata +164 -3
@@ -0,0 +1,44 @@
1
+ //
2
+ // AwesomeMenuItem.h
3
+ // AwesomeMenu
4
+ //
5
+ // Created by Levey on 11/30/11.
6
+ // Copyright (c) 2011 Levey & Other Contributors. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @protocol AwesomeMenuItemDelegate;
12
+
13
+ @interface AwesomeMenuItem : UIImageView
14
+ {
15
+ UIImageView *_contentImageView;
16
+ CGPoint _startPoint;
17
+ CGPoint _endPoint;
18
+ CGPoint _nearPoint; // near
19
+ CGPoint _farPoint; // far
20
+
21
+ id<AwesomeMenuItemDelegate> __weak _delegate;
22
+ }
23
+
24
+ @property (nonatomic, strong, readonly) UIImageView *contentImageView;
25
+
26
+ @property (nonatomic) CGPoint startPoint;
27
+ @property (nonatomic) CGPoint endPoint;
28
+ @property (nonatomic) CGPoint nearPoint;
29
+ @property (nonatomic) CGPoint farPoint;
30
+
31
+ @property (nonatomic, weak) id<AwesomeMenuItemDelegate> delegate;
32
+
33
+ - (id)initWithImage:(UIImage *)img
34
+ highlightedImage:(UIImage *)himg
35
+ ContentImage:(UIImage *)cimg
36
+ highlightedContentImage:(UIImage *)hcimg;
37
+
38
+
39
+ @end
40
+
41
+ @protocol AwesomeMenuItemDelegate <NSObject>
42
+ - (void)AwesomeMenuItemTouchesBegan:(AwesomeMenuItem *)item;
43
+ - (void)AwesomeMenuItemTouchesEnd:(AwesomeMenuItem *)item;
44
+ @end
@@ -0,0 +1,97 @@
1
+ //
2
+ // AwesomeMenuItem.m
3
+ // AwesomeMenu
4
+ //
5
+ // Created by Levey on 11/30/11.
6
+ // Copyright (c) 2011 Levey & Other Contributors. All rights reserved.
7
+ //
8
+
9
+ #import "AwesomeMenuItem.h"
10
+ static inline CGRect ScaleRect(CGRect rect, float n) {return CGRectMake((rect.size.width - rect.size.width * n)/ 2, (rect.size.height - rect.size.height * n) / 2, rect.size.width * n, rect.size.height * n);}
11
+ @implementation AwesomeMenuItem
12
+
13
+ @synthesize contentImageView = _contentImageView;
14
+
15
+ @synthesize startPoint = _startPoint;
16
+ @synthesize endPoint = _endPoint;
17
+ @synthesize nearPoint = _nearPoint;
18
+ @synthesize farPoint = _farPoint;
19
+ @synthesize delegate = _delegate;
20
+
21
+ #pragma mark - initialization & cleaning up
22
+ - (id)initWithImage:(UIImage *)img
23
+ highlightedImage:(UIImage *)himg
24
+ ContentImage:(UIImage *)cimg
25
+ highlightedContentImage:(UIImage *)hcimg;
26
+ {
27
+ if (self = [super init])
28
+ {
29
+ self.image = img;
30
+ self.highlightedImage = himg;
31
+ self.userInteractionEnabled = YES;
32
+ _contentImageView = [[UIImageView alloc] initWithImage:cimg];
33
+ _contentImageView.highlightedImage = hcimg;
34
+ [self addSubview:_contentImageView];
35
+ }
36
+ return self;
37
+ }
38
+
39
+ #pragma mark - UIView's methods
40
+ - (void)layoutSubviews
41
+ {
42
+ [super layoutSubviews];
43
+
44
+ self.bounds = CGRectMake(0, 0, self.image.size.width, self.image.size.height);
45
+
46
+ float width = _contentImageView.image.size.width;
47
+ float height = _contentImageView.image.size.height;
48
+ _contentImageView.frame = CGRectMake(self.bounds.size.width/2 - width/2, self.bounds.size.height/2 - height/2, width, height);
49
+ }
50
+
51
+ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
52
+ {
53
+ self.highlighted = YES;
54
+ if ([_delegate respondsToSelector:@selector(AwesomeMenuItemTouchesBegan:)])
55
+ {
56
+ [_delegate AwesomeMenuItemTouchesBegan:self];
57
+ }
58
+
59
+ }
60
+ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
61
+ {
62
+ // if move out of 2x rect, cancel highlighted.
63
+ CGPoint location = [[touches anyObject] locationInView:self];
64
+ if (!CGRectContainsPoint(ScaleRect(self.bounds, 2.0f), location))
65
+ {
66
+ self.highlighted = NO;
67
+ }
68
+
69
+ }
70
+ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
71
+ {
72
+ self.highlighted = NO;
73
+ // if stop in the area of 2x rect, response to the touches event.
74
+ CGPoint location = [[touches anyObject] locationInView:self];
75
+ if (CGRectContainsPoint(ScaleRect(self.bounds, 2.0f), location))
76
+ {
77
+ if ([_delegate respondsToSelector:@selector(AwesomeMenuItemTouchesEnd:)])
78
+ {
79
+ [_delegate AwesomeMenuItemTouchesEnd:self];
80
+ }
81
+ }
82
+ }
83
+
84
+ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
85
+ {
86
+ self.highlighted = NO;
87
+ }
88
+
89
+ #pragma mark - instant methods
90
+ - (void)setHighlighted:(BOOL)highlighted
91
+ {
92
+ [super setHighlighted:highlighted];
93
+ [_contentImageView setHighlighted:highlighted];
94
+ }
95
+
96
+
97
+ @end
@@ -0,0 +1,167 @@
1
+ //
2
+ // CMPopTipView.h
3
+ //
4
+ // Created by Chris Miles on 18/07/10.
5
+ // Copyright (c) Chris Miles 2010-2012.
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ // of this software and associated documentation files (the "Software"), to deal
9
+ // in the Software without restriction, including without limitation the rights
10
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the Software is
12
+ // furnished to do so, subject to the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be included in
15
+ // all copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ // THE SOFTWARE.
24
+ //
25
+
26
+ /*
27
+ Version: 1.2.0
28
+ */
29
+
30
+
31
+ /** \brief Display a speech bubble-like popup on screen, pointing at the
32
+ designated view or button.
33
+
34
+ A UIView subclass drawn using core graphics. Pops up (optionally animated)
35
+ a speech bubble-like view on screen, a rounded rectangle with a gradiant
36
+ fill containing a specified text message, drawn with a pointer dynamically
37
+ positioned to point at the center of the designated button or view.
38
+
39
+ Example 1 - point at a UIBarButtonItem in a nav bar:
40
+
41
+ - (void)showPopTipView {
42
+ NSString *message = @"Start by adding a waterway to your favourites.";
43
+ CMPopTipView *popTipView = [[CMPopTipView alloc] initWithMessage:message];
44
+ popTipView.delegate = self;
45
+ [popTipView presentPointingAtBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];
46
+
47
+ self.myPopTipView = popTipView;
48
+ [popTipView release];
49
+ }
50
+
51
+ - (void)dismissPopTipView {
52
+ [self.myPopTipView dismissAnimated:NO];
53
+ self.myPopTipView = nil;
54
+ }
55
+
56
+
57
+ #pragma mark CMPopTipViewDelegate methods
58
+ - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
59
+ // User can tap CMPopTipView to dismiss it
60
+ self.myPopTipView = nil;
61
+ }
62
+
63
+ Example 2 - pointing at a UIButton:
64
+
65
+ - (IBAction)buttonAction:(id)sender {
66
+ // Toggle popTipView when a standard UIButton is pressed
67
+ if (nil == self.roundRectButtonPopTipView) {
68
+ self.roundRectButtonPopTipView = [[[CMPopTipView alloc] initWithMessage:@"My message"] autorelease];
69
+ self.roundRectButtonPopTipView.delegate = self;
70
+
71
+ UIButton *button = (UIButton *)sender;
72
+ [self.roundRectButtonPopTipView presentPointingAtView:button inView:self.view animated:YES];
73
+ }
74
+ else {
75
+ // Dismiss
76
+ [self.roundRectButtonPopTipView dismissAnimated:YES];
77
+ self.roundRectButtonPopTipView = nil;
78
+ }
79
+ }
80
+
81
+ #pragma mark CMPopTipViewDelegate methods
82
+ - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView {
83
+ // User can tap CMPopTipView to dismiss it
84
+ self.roundRectButtonPopTipView = nil;
85
+ }
86
+
87
+ */
88
+
89
+ #import <UIKit/UIKit.h>
90
+
91
+ typedef enum {
92
+ PointDirectionAny = 0,
93
+ PointDirectionUp,
94
+ PointDirectionDown,
95
+ } PointDirection;
96
+
97
+ typedef enum {
98
+ CMPopTipAnimationSlide = 0,
99
+ CMPopTipAnimationPop
100
+ } CMPopTipAnimation;
101
+
102
+
103
+ @protocol CMPopTipViewDelegate;
104
+
105
+
106
+ @interface CMPopTipView : UIView {
107
+ UIColor *backgroundColor;
108
+ id<CMPopTipViewDelegate> delegate;
109
+ NSString *title;
110
+ NSString *message;
111
+ id targetObject;
112
+ UIColor *titleColor;
113
+ UIFont *titleFont;
114
+ UIColor *textColor;
115
+ UIFont *textFont;
116
+ UIColor *borderColor;
117
+ CGFloat borderWidth;
118
+ CMPopTipAnimation animation;
119
+
120
+ @private
121
+ CGSize bubbleSize;
122
+ CGFloat cornerRadius;
123
+ BOOL highlight;
124
+ CGFloat sidePadding;
125
+ CGFloat topMargin;
126
+ PointDirection pointDirection;
127
+ CGFloat pointerSize;
128
+ CGPoint targetPoint;
129
+ }
130
+
131
+ @property (nonatomic, retain) UIColor *backgroundColor;
132
+ @property (nonatomic, assign) id<CMPopTipViewDelegate> delegate;
133
+ @property (nonatomic, assign) BOOL disableTapToDismiss;
134
+ @property (nonatomic, assign) BOOL dismissTapAnywhere;
135
+ @property (nonatomic, retain) NSString *title;
136
+ @property (nonatomic, retain) NSString *message;
137
+ @property (nonatomic, retain) UIView *customView;
138
+ @property (nonatomic, retain, readonly) id targetObject;
139
+ @property (nonatomic, retain) UIColor *titleColor;
140
+ @property (nonatomic, retain) UIFont *titleFont;
141
+ @property (nonatomic, retain) UIColor *textColor;
142
+ @property (nonatomic, retain) UIFont *textFont;
143
+ @property (nonatomic, assign) UITextAlignment titleAlignment;
144
+ @property (nonatomic, assign) UITextAlignment textAlignment;
145
+ @property (nonatomic, retain) UIColor *borderColor;
146
+ @property (nonatomic, assign) CGFloat borderWidth;
147
+ @property (nonatomic, assign) CMPopTipAnimation animation;
148
+ @property (nonatomic, assign) CGFloat maxWidth;
149
+ @property (nonatomic, assign) PointDirection preferredPointDirection;
150
+
151
+ /* Contents can be either a message or a UIView */
152
+ - (id)initWithTitle:(NSString *)titleToShow message:(NSString *)messageToShow;
153
+ - (id)initWithMessage:(NSString *)messageToShow;
154
+ - (id)initWithCustomView:(UIView *)aView;
155
+
156
+ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerView animated:(BOOL)animated;
157
+ - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated;
158
+ - (void)dismissAnimated:(BOOL)animated;
159
+ - (void)autoDismissAnimated:(BOOL)animated atTimeInterval:(NSTimeInterval)timeInvertal;
160
+ - (PointDirection) getPointDirection;
161
+
162
+ @end
163
+
164
+
165
+ @protocol CMPopTipViewDelegate <NSObject>
166
+ - (void)popTipViewWasDismissedByUser:(CMPopTipView *)popTipView;
167
+ @end
@@ -0,0 +1,639 @@
1
+ //
2
+ // CMPopTipView.m
3
+ //
4
+ // Created by Chris Miles on 18/07/10.
5
+ // Copyright (c) Chris Miles 2010-2012.
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ // of this software and associated documentation files (the "Software"), to deal
9
+ // in the Software without restriction, including without limitation the rights
10
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the Software is
12
+ // furnished to do so, subject to the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be included in
15
+ // all copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ // THE SOFTWARE.
24
+ //
25
+
26
+ #import "CMPopTipView.h"
27
+
28
+ @interface CMPopTipView ()
29
+ @property (nonatomic, retain, readwrite) id targetObject;
30
+ @property (nonatomic, retain) NSTimer *autoDismissTimer;
31
+ @property (nonatomic, retain) UIButton *dismissTarget;
32
+ @end
33
+
34
+
35
+ @implementation CMPopTipView
36
+
37
+ @synthesize autoDismissTimer = _autoDismissTimer;
38
+ @synthesize backgroundColor;
39
+ @synthesize delegate;
40
+ @synthesize title;
41
+ @synthesize message;
42
+ @synthesize customView;
43
+ @synthesize targetObject;
44
+ @synthesize titleColor;
45
+ @synthesize titleFont;
46
+ @synthesize textColor;
47
+ @synthesize textFont;
48
+ @synthesize titleAlignment;
49
+ @synthesize textAlignment;
50
+ @synthesize borderColor;
51
+ @synthesize borderWidth;
52
+ @synthesize animation;
53
+ @synthesize maxWidth;
54
+ @synthesize disableTapToDismiss;
55
+ @synthesize dismissTapAnywhere;
56
+ @synthesize dismissTarget=_dismissTarget;
57
+ @synthesize preferredPointDirection=_preferredPointDirection;
58
+
59
+ - (CGRect)bubbleFrame {
60
+ CGRect bubbleFrame;
61
+ if (pointDirection == PointDirectionUp) {
62
+ bubbleFrame = CGRectMake(2.0, targetPoint.y+pointerSize, bubbleSize.width, bubbleSize.height);
63
+ }
64
+ else {
65
+ bubbleFrame = CGRectMake(2.0, targetPoint.y-pointerSize-bubbleSize.height, bubbleSize.width, bubbleSize.height);
66
+ }
67
+ return bubbleFrame;
68
+ }
69
+
70
+ - (CGRect)contentFrame {
71
+ CGRect bubbleFrame = [self bubbleFrame];
72
+ CGRect contentFrame = CGRectMake(bubbleFrame.origin.x + cornerRadius,
73
+ bubbleFrame.origin.y + cornerRadius,
74
+ bubbleFrame.size.width - cornerRadius*2,
75
+ bubbleFrame.size.height - cornerRadius*2);
76
+ return contentFrame;
77
+ }
78
+
79
+ - (void)layoutSubviews {
80
+ if (self.customView) {
81
+
82
+ CGRect contentFrame = [self contentFrame];
83
+ [self.customView setFrame:contentFrame];
84
+ }
85
+ }
86
+
87
+ - (void)drawRect:(CGRect)rect {
88
+
89
+ CGRect bubbleRect = [self bubbleFrame];
90
+
91
+ CGContextRef c = UIGraphicsGetCurrentContext();
92
+
93
+ CGContextSetRGBStrokeColor(c, 0.0, 0.0, 0.0, 1.0); // black
94
+ CGContextSetLineWidth(c, borderWidth);
95
+
96
+ CGMutablePathRef bubblePath = CGPathCreateMutable();
97
+
98
+ if (pointDirection == PointDirectionUp) {
99
+ CGPathMoveToPoint(bubblePath, NULL, targetPoint.x, targetPoint.y);
100
+ CGPathAddLineToPoint(bubblePath, NULL, targetPoint.x+pointerSize, targetPoint.y+pointerSize);
101
+
102
+ CGPathAddArcToPoint(bubblePath, NULL,
103
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y,
104
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y+cornerRadius,
105
+ cornerRadius);
106
+ CGPathAddArcToPoint(bubblePath, NULL,
107
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y+bubbleRect.size.height,
108
+ bubbleRect.origin.x+bubbleRect.size.width-cornerRadius, bubbleRect.origin.y+bubbleRect.size.height,
109
+ cornerRadius);
110
+ CGPathAddArcToPoint(bubblePath, NULL,
111
+ bubbleRect.origin.x, bubbleRect.origin.y+bubbleRect.size.height,
112
+ bubbleRect.origin.x, bubbleRect.origin.y+bubbleRect.size.height-cornerRadius,
113
+ cornerRadius);
114
+ CGPathAddArcToPoint(bubblePath, NULL,
115
+ bubbleRect.origin.x, bubbleRect.origin.y,
116
+ bubbleRect.origin.x+cornerRadius, bubbleRect.origin.y,
117
+ cornerRadius);
118
+ CGPathAddLineToPoint(bubblePath, NULL, targetPoint.x-pointerSize, targetPoint.y+pointerSize);
119
+ }
120
+ else {
121
+ CGPathMoveToPoint(bubblePath, NULL, targetPoint.x, targetPoint.y);
122
+ CGPathAddLineToPoint(bubblePath, NULL, targetPoint.x-pointerSize, targetPoint.y-pointerSize);
123
+
124
+ CGPathAddArcToPoint(bubblePath, NULL,
125
+ bubbleRect.origin.x, bubbleRect.origin.y+bubbleRect.size.height,
126
+ bubbleRect.origin.x, bubbleRect.origin.y+bubbleRect.size.height-cornerRadius,
127
+ cornerRadius);
128
+ CGPathAddArcToPoint(bubblePath, NULL,
129
+ bubbleRect.origin.x, bubbleRect.origin.y,
130
+ bubbleRect.origin.x+cornerRadius, bubbleRect.origin.y,
131
+ cornerRadius);
132
+ CGPathAddArcToPoint(bubblePath, NULL,
133
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y,
134
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y+cornerRadius,
135
+ cornerRadius);
136
+ CGPathAddArcToPoint(bubblePath, NULL,
137
+ bubbleRect.origin.x+bubbleRect.size.width, bubbleRect.origin.y+bubbleRect.size.height,
138
+ bubbleRect.origin.x+bubbleRect.size.width-cornerRadius, bubbleRect.origin.y+bubbleRect.size.height,
139
+ cornerRadius);
140
+ CGPathAddLineToPoint(bubblePath, NULL, targetPoint.x+pointerSize, targetPoint.y-pointerSize);
141
+ }
142
+
143
+ CGPathCloseSubpath(bubblePath);
144
+
145
+
146
+ // Draw shadow
147
+ CGContextAddPath(c, bubblePath);
148
+ CGContextSaveGState(c);
149
+ CGContextSetShadow(c, CGSizeMake(0, 3), 5);
150
+ CGContextSetRGBFillColor(c, 0.0, 0.0, 0.0, 0.9);
151
+ CGContextFillPath(c);
152
+ CGContextRestoreGState(c);
153
+
154
+
155
+ // Draw clipped background gradient
156
+ CGContextAddPath(c, bubblePath);
157
+ CGContextClip(c);
158
+
159
+ CGFloat bubbleMiddle = (bubbleRect.origin.y+(bubbleRect.size.height/2)) / self.bounds.size.height;
160
+
161
+ CGGradientRef myGradient;
162
+ CGColorSpaceRef myColorSpace;
163
+ size_t locationCount = 5;
164
+ CGFloat locationList[] = {0.0, bubbleMiddle-0.03, bubbleMiddle, bubbleMiddle+0.03, 1.0};
165
+
166
+ CGFloat colourHL = 0.0;
167
+ if (highlight) {
168
+ colourHL = 0.25;
169
+ }
170
+
171
+ CGFloat red;
172
+ CGFloat green;
173
+ CGFloat blue;
174
+ CGFloat alpha;
175
+ int numComponents = CGColorGetNumberOfComponents([backgroundColor CGColor]);
176
+ const CGFloat *components = CGColorGetComponents([backgroundColor CGColor]);
177
+ if (numComponents == 2) {
178
+ red = components[0];
179
+ green = components[0];
180
+ blue = components[0];
181
+ alpha = components[1];
182
+ }
183
+ else {
184
+ red = components[0];
185
+ green = components[1];
186
+ blue = components[2];
187
+ alpha = components[3];
188
+ }
189
+ CGFloat colorList[] = {
190
+ //red, green, blue, alpha
191
+ red*1.16+colourHL, green*1.16+colourHL, blue*1.16+colourHL, alpha,
192
+ red*1.16+colourHL, green*1.16+colourHL, blue*1.16+colourHL, alpha,
193
+ red*1.08+colourHL, green*1.08+colourHL, blue*1.08+colourHL, alpha,
194
+ red +colourHL, green +colourHL, blue +colourHL, alpha,
195
+ red +colourHL, green +colourHL, blue +colourHL, alpha
196
+ };
197
+ myColorSpace = CGColorSpaceCreateDeviceRGB();
198
+ myGradient = CGGradientCreateWithColorComponents(myColorSpace, colorList, locationList, locationCount);
199
+ CGPoint startPoint, endPoint;
200
+ startPoint.x = 0;
201
+ startPoint.y = 0;
202
+ endPoint.x = 0;
203
+ endPoint.y = CGRectGetMaxY(self.bounds);
204
+
205
+ CGContextDrawLinearGradient(c, myGradient, startPoint, endPoint,0);
206
+ CGGradientRelease(myGradient);
207
+ CGColorSpaceRelease(myColorSpace);
208
+
209
+ //Draw Border
210
+ int numBorderComponents = CGColorGetNumberOfComponents([borderColor CGColor]);
211
+ const CGFloat *borderComponents = CGColorGetComponents(borderColor.CGColor);
212
+ CGFloat r, g, b, a;
213
+ if (numBorderComponents == 2) {
214
+ r = borderComponents[0];
215
+ g = borderComponents[0];
216
+ b = borderComponents[0];
217
+ a = borderComponents[1];
218
+ }
219
+ else {
220
+ r = borderComponents[0];
221
+ g = borderComponents[1];
222
+ b = borderComponents[2];
223
+ a = borderComponents[3];
224
+ }
225
+
226
+ CGContextSetRGBStrokeColor(c, r, g, b, a);
227
+ CGContextAddPath(c, bubblePath);
228
+ CGContextDrawPath(c, kCGPathStroke);
229
+
230
+ CGPathRelease(bubblePath);
231
+
232
+ // Draw title and text
233
+
234
+ if (self.title) {
235
+ [self.titleColor set];
236
+ CGRect titleFrame = [self contentFrame];
237
+ [self.title drawInRect:titleFrame
238
+ withFont:self.titleFont
239
+ lineBreakMode:UILineBreakModeClip
240
+ alignment:self.titleAlignment];
241
+ }
242
+
243
+ if (self.message) {
244
+ [textColor set];
245
+ CGRect textFrame = [self contentFrame];
246
+
247
+ // Move down to make room for title
248
+ if (self.title) {
249
+ textFrame.origin.y += [self.title sizeWithFont:self.titleFont
250
+ constrainedToSize:CGSizeMake(textFrame.size.width, 99999.0)
251
+ lineBreakMode:UILineBreakModeClip].height;
252
+ }
253
+
254
+ [self.message drawInRect:textFrame
255
+ withFont:textFont
256
+ lineBreakMode:UILineBreakModeWordWrap
257
+ alignment:self.textAlignment];
258
+ }
259
+ }
260
+
261
+ - (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerView animated:(BOOL)animated {
262
+ if (!self.targetObject) {
263
+ self.targetObject = targetView;
264
+ }
265
+
266
+ // If we want to dismiss the bubble when the user taps anywhere, we need to insert
267
+ // an invisible button over the background.
268
+ if ( self.dismissTapAnywhere ) {
269
+ self.dismissTarget = [UIButton buttonWithType:UIButtonTypeCustom];
270
+ [self.dismissTarget addTarget:self action:@selector(dismissTapAnywhereFired:) forControlEvents:UIControlEventTouchUpInside];
271
+ [self.dismissTarget setTitle:@"" forState:UIControlStateNormal];
272
+ self.dismissTarget.frame = containerView.bounds;
273
+ [containerView addSubview:self.dismissTarget];
274
+ }
275
+
276
+ [containerView addSubview:self];
277
+
278
+ // Size of rounded rect
279
+ CGFloat rectWidth;
280
+
281
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
282
+ // iPad
283
+ if (maxWidth) {
284
+ if (maxWidth < containerView.frame.size.width) {
285
+ rectWidth = maxWidth;
286
+ }
287
+ else {
288
+ rectWidth = containerView.frame.size.width - 20;
289
+ }
290
+ }
291
+ else {
292
+ rectWidth = (int)(containerView.frame.size.width/3);
293
+ }
294
+ }
295
+ else {
296
+ // iPhone
297
+ if (maxWidth) {
298
+ if (maxWidth < containerView.frame.size.width) {
299
+ rectWidth = maxWidth;
300
+ }
301
+ else {
302
+ rectWidth = containerView.frame.size.width - 10;
303
+ }
304
+ }
305
+ else {
306
+ rectWidth = (int)(containerView.frame.size.width*2/3);
307
+ }
308
+ }
309
+
310
+ CGSize textSize = CGSizeZero;
311
+
312
+ if (self.message!=nil) {
313
+ textSize= [self.message sizeWithFont:textFont
314
+ constrainedToSize:CGSizeMake(rectWidth, 99999.0)
315
+ lineBreakMode:UILineBreakModeWordWrap];
316
+ }
317
+ if (self.customView != nil) {
318
+ textSize = self.customView.frame.size;
319
+ }
320
+ if (self.title != nil) {
321
+ textSize.height += [self.title sizeWithFont:self.titleFont
322
+ constrainedToSize:CGSizeMake(rectWidth, 99999.0)
323
+ lineBreakMode:UILineBreakModeClip].height;
324
+ }
325
+
326
+ bubbleSize = CGSizeMake(textSize.width + cornerRadius*2, textSize.height + cornerRadius*2);
327
+
328
+ UIView *superview = containerView.superview;
329
+ if ([superview isKindOfClass:[UIWindow class]])
330
+ superview = containerView;
331
+
332
+ CGPoint targetRelativeOrigin = [targetView.superview convertPoint:targetView.frame.origin toView:superview];
333
+ CGPoint containerRelativeOrigin = [superview convertPoint:containerView.frame.origin toView:superview];
334
+
335
+ CGFloat pointerY; // Y coordinate of pointer target (within containerView)
336
+
337
+
338
+ if (targetRelativeOrigin.y+targetView.bounds.size.height < containerRelativeOrigin.y) {
339
+ pointerY = 0.0;
340
+ pointDirection = PointDirectionUp;
341
+ }
342
+ else if (targetRelativeOrigin.y > containerRelativeOrigin.y+containerView.bounds.size.height) {
343
+ pointerY = containerView.bounds.size.height;
344
+ pointDirection = PointDirectionDown;
345
+ }
346
+ else {
347
+ pointDirection = _preferredPointDirection;
348
+ CGPoint targetOriginInContainer = [targetView convertPoint:CGPointMake(0.0, 0.0) toView:containerView];
349
+ CGFloat sizeBelow = containerView.bounds.size.height - targetOriginInContainer.y;
350
+ if (pointDirection == PointDirectionAny) {
351
+ if (sizeBelow > targetOriginInContainer.y) {
352
+ pointerY = targetOriginInContainer.y + targetView.bounds.size.height;
353
+ pointDirection = PointDirectionUp;
354
+ }
355
+ else {
356
+ pointerY = targetOriginInContainer.y;
357
+ pointDirection = PointDirectionDown;
358
+ }
359
+ }
360
+ else {
361
+ if (pointDirection == PointDirectionDown) {
362
+ pointerY = targetOriginInContainer.y;
363
+ }
364
+ else {
365
+ pointerY = targetOriginInContainer.y + targetView.bounds.size.height;
366
+ }
367
+ }
368
+ }
369
+
370
+ CGFloat W = containerView.bounds.size.width;
371
+
372
+ CGPoint p = [targetView.superview convertPoint:targetView.center toView:containerView];
373
+ CGFloat x_p = p.x;
374
+ CGFloat x_b = x_p - roundf(bubbleSize.width/2);
375
+ if (x_b < sidePadding) {
376
+ x_b = sidePadding;
377
+ }
378
+ if (x_b + bubbleSize.width + sidePadding > W) {
379
+ x_b = W - bubbleSize.width - sidePadding;
380
+ }
381
+ if (x_p - pointerSize < x_b + cornerRadius) {
382
+ x_p = x_b + cornerRadius + pointerSize;
383
+ }
384
+ if (x_p + pointerSize > x_b + bubbleSize.width - cornerRadius) {
385
+ x_p = x_b + bubbleSize.width - cornerRadius - pointerSize;
386
+ }
387
+
388
+ CGFloat fullHeight = bubbleSize.height + pointerSize + 10.0;
389
+ CGFloat y_b;
390
+ if (pointDirection == PointDirectionUp) {
391
+ y_b = topMargin + pointerY;
392
+ targetPoint = CGPointMake(x_p-x_b, 0);
393
+ }
394
+ else {
395
+ y_b = pointerY - fullHeight;
396
+ targetPoint = CGPointMake(x_p-x_b, fullHeight-2.0);
397
+ }
398
+
399
+ CGRect finalFrame = CGRectMake(x_b-sidePadding,
400
+ y_b,
401
+ bubbleSize.width+sidePadding*2,
402
+ fullHeight);
403
+
404
+
405
+ if (animated) {
406
+ if (animation == CMPopTipAnimationSlide) {
407
+ self.alpha = 0.0;
408
+ CGRect startFrame = finalFrame;
409
+ startFrame.origin.y += 10;
410
+ self.frame = startFrame;
411
+ }
412
+ else if (animation == CMPopTipAnimationPop) {
413
+ self.frame = finalFrame;
414
+ self.alpha = 0.5;
415
+
416
+ // start a little smaller
417
+ self.transform = CGAffineTransformMakeScale(0.75f, 0.75f);
418
+
419
+ // animate to a bigger size
420
+ [UIView beginAnimations:nil context:nil];
421
+ [UIView setAnimationDelegate:self];
422
+ [UIView setAnimationDidStopSelector:@selector(popAnimationDidStop:finished:context:)];
423
+ [UIView setAnimationDuration:0.15f];
424
+ self.transform = CGAffineTransformMakeScale(1.1f, 1.1f);
425
+ self.alpha = 1.0;
426
+ [UIView commitAnimations];
427
+ }
428
+
429
+ [self setNeedsDisplay];
430
+
431
+ if (animation == CMPopTipAnimationSlide) {
432
+ [UIView beginAnimations:nil context:nil];
433
+ self.alpha = 1.0;
434
+ self.frame = finalFrame;
435
+ [UIView commitAnimations];
436
+ }
437
+ }
438
+ else {
439
+ // Not animated
440
+ [self setNeedsDisplay];
441
+ self.frame = finalFrame;
442
+ }
443
+ }
444
+
445
+ - (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated {
446
+ UIView *targetView = (UIView *)[barButtonItem performSelector:@selector(view)];
447
+ UIView *targetSuperview = [targetView superview];
448
+ UIView *containerView = nil;
449
+ if ([targetSuperview isKindOfClass:[UINavigationBar class]]) {
450
+ UINavigationController *navController = [(UINavigationBar *)targetSuperview delegate];
451
+ containerView = [[navController topViewController] view];
452
+ }
453
+ else if ([targetSuperview isKindOfClass:[UIToolbar class]]) {
454
+ containerView = [targetSuperview superview];
455
+ }
456
+
457
+ if (nil == containerView) {
458
+ NSLog(@"Cannot determine container view from UIBarButtonItem: %@", barButtonItem);
459
+ self.targetObject = nil;
460
+ return;
461
+ }
462
+
463
+ self.targetObject = barButtonItem;
464
+
465
+ [self presentPointingAtView:targetView inView:containerView animated:animated];
466
+ }
467
+
468
+ - (void)finaliseDismiss {
469
+ [self.autoDismissTimer invalidate]; self.autoDismissTimer = nil;
470
+
471
+ if (self.dismissTarget) {
472
+ [self.dismissTarget removeFromSuperview];
473
+ self.dismissTarget = nil;
474
+ }
475
+
476
+ [self removeFromSuperview];
477
+
478
+ highlight = NO;
479
+ self.targetObject = nil;
480
+ }
481
+
482
+ - (void)dismissAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
483
+ [self finaliseDismiss];
484
+ }
485
+
486
+ - (void)dismissAnimated:(BOOL)animated {
487
+
488
+ if (animated) {
489
+ CGRect frame = self.frame;
490
+ frame.origin.y += 10.0;
491
+
492
+ [UIView beginAnimations:nil context:nil];
493
+ self.alpha = 0.0;
494
+ self.frame = frame;
495
+ [UIView setAnimationDelegate:self];
496
+ [UIView setAnimationDidStopSelector:@selector(dismissAnimationDidStop:finished:context:)];
497
+ [UIView commitAnimations];
498
+ }
499
+ else {
500
+ [self finaliseDismiss];
501
+ }
502
+ }
503
+
504
+ - (void)autoDismissAnimatedDidFire:(NSTimer *)theTimer {
505
+ NSNumber *animated = [[theTimer userInfo] objectForKey:@"animated"];
506
+ [self dismissAnimated:[animated boolValue]];
507
+ [self notifyDelegatePopTipViewWasDismissedByUser];
508
+ }
509
+
510
+ - (void)autoDismissAnimated:(BOOL)animated atTimeInterval:(NSTimeInterval)timeInvertal {
511
+ NSDictionary * userInfo = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:animated] forKey:@"animated"];
512
+
513
+ self.autoDismissTimer = [NSTimer scheduledTimerWithTimeInterval:timeInvertal
514
+ target:self
515
+ selector:@selector(autoDismissAnimatedDidFire:)
516
+ userInfo:userInfo
517
+ repeats:NO];
518
+ }
519
+
520
+ - (void)notifyDelegatePopTipViewWasDismissedByUser {
521
+ if (delegate && [delegate respondsToSelector:@selector(popTipViewWasDismissedByUser:)]) {
522
+ [delegate popTipViewWasDismissedByUser:self];
523
+ }
524
+ }
525
+
526
+ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
527
+ if (self.disableTapToDismiss) {
528
+ [super touchesBegan:touches withEvent:event];
529
+ return;
530
+ }
531
+
532
+ [self dismissByUser];
533
+ }
534
+
535
+ - (void)dismissTapAnywhereFired:(UIButton *)button
536
+ {
537
+ [self dismissByUser];
538
+ }
539
+
540
+ - (void)dismissByUser
541
+ {
542
+ highlight = YES;
543
+ [self setNeedsDisplay];
544
+
545
+ [self dismissAnimated:YES];
546
+
547
+ [self notifyDelegatePopTipViewWasDismissedByUser];
548
+ }
549
+
550
+ - (void)popAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
551
+ // at the end set to normal size
552
+ [UIView beginAnimations:nil context:nil];
553
+ [UIView setAnimationDuration:0.1f];
554
+ self.transform = CGAffineTransformIdentity;
555
+ [UIView commitAnimations];
556
+ }
557
+
558
+ - (id)initWithFrame:(CGRect)frame {
559
+ if ((self = [super initWithFrame:frame])) {
560
+ // Initialization code
561
+ self.opaque = NO;
562
+
563
+ cornerRadius = 10.0;
564
+ topMargin = 2.0;
565
+ pointerSize = 12.0;
566
+ sidePadding = 2.0;
567
+ borderWidth = 1.0;
568
+
569
+ self.textFont = [UIFont boldSystemFontOfSize:14.0];
570
+ self.textColor = [UIColor whiteColor];
571
+ self.textAlignment = UITextAlignmentCenter;
572
+ self.backgroundColor = [UIColor colorWithRed:62.0/255.0 green:60.0/255.0 blue:154.0/255.0 alpha:1.0];
573
+ self.borderColor = [UIColor blackColor];
574
+ self.animation = CMPopTipAnimationSlide;
575
+ self.dismissTapAnywhere = NO;
576
+ self.preferredPointDirection = PointDirectionAny;
577
+ }
578
+ return self;
579
+ }
580
+
581
+ - (PointDirection) getPointDirection {
582
+ return pointDirection;
583
+ }
584
+
585
+ - (id)initWithTitle:(NSString *)titleToShow message:(NSString *)messageToShow {
586
+ CGRect frame = CGRectZero;
587
+
588
+ if ((self = [self initWithFrame:frame])) {
589
+ self.title = titleToShow;
590
+ self.message = messageToShow;
591
+
592
+ self.titleFont = [UIFont boldSystemFontOfSize:16.0];
593
+ self.titleColor = [UIColor whiteColor];
594
+ self.titleAlignment = UITextAlignmentCenter;
595
+ self.textFont = [UIFont systemFontOfSize:14.0];
596
+ self.textColor = [UIColor whiteColor];
597
+
598
+ }
599
+ return self;
600
+ }
601
+
602
+ - (id)initWithMessage:(NSString *)messageToShow {
603
+ CGRect frame = CGRectZero;
604
+
605
+ if ((self = [self initWithFrame:frame])) {
606
+ self.message = messageToShow;
607
+ }
608
+ return self;
609
+ }
610
+
611
+ - (id)initWithCustomView:(UIView *)aView {
612
+ CGRect frame = CGRectZero;
613
+
614
+ if ((self = [self initWithFrame:frame])) {
615
+ self.customView = aView;
616
+ [self addSubview:self.customView];
617
+ }
618
+ return self;
619
+ }
620
+
621
+ - (void)dealloc {
622
+ [_autoDismissTimer release];
623
+ [_dismissTarget release];
624
+ [backgroundColor release];
625
+ [borderColor release];
626
+ [customView release];
627
+ [title release];
628
+ [message release];
629
+ [targetObject release];
630
+ [titleColor release];
631
+ [titleFont release];
632
+ [textColor release];
633
+ [textFont release];
634
+
635
+ [super dealloc];
636
+ }
637
+
638
+
639
+ @end