TemplateInfo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +2 -0
  3. data/TemplateInfo.gemspec +1 -1
  4. data/bin/tif_create.rb +157 -0
  5. data/lib/TemplateInfo/version.rb +1 -1
  6. data/test.xctemplate/.DS_Store +0 -0
  7. data/test.xctemplate/TemplateInfo.plist +2830 -0
  8. data/test.xctemplate/TemplateInfo.xml +2842 -0
  9. data/test.xctemplate/libs/BeeFramework/Bee.h +35 -0
  10. data/test.xctemplate/libs/BeeFramework/Bee_Precompile.h +143 -0
  11. data/test.xctemplate/libs/BeeFramework/Core/Bee_Core.h +36 -0
  12. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.h +54 -0
  13. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.mm +33 -0
  14. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.h +64 -0
  15. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.mm +164 -0
  16. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.h +111 -0
  17. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.mm +122 -0
  18. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.h +98 -0
  19. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.mm +437 -0
  20. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.h +45 -0
  21. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.mm +81 -0
  22. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.h +47 -0
  23. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.mm +34 -0
  24. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.h +62 -0
  25. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.m +147 -0
  26. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.h +64 -0
  27. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.mm +91 -0
  28. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.h +76 -0
  29. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.m +300 -0
  30. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.h +44 -0
  31. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.m +92 -0
  32. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.h +44 -0
  33. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.m +85 -0
  34. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.h +90 -0
  35. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m +509 -0
  36. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.h +50 -0
  37. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.m +64 -0
  38. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.h +43 -0
  39. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.m +116 -0
  40. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.h +66 -0
  41. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.m +150 -0
  42. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.h +210 -0
  43. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.m +34 -0
  44. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.h +41 -0
  45. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.m +156 -0
  46. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.h +49 -0
  47. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.m +109 -0
  48. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.h +86 -0
  49. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.m +464 -0
  50. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.h +36 -0
  51. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.m +33 -0
  52. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.h +144 -0
  53. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.m +560 -0
  54. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.h +99 -0
  55. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.m +742 -0
  56. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h +62 -0
  57. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m +175 -0
  58. data/test.xctemplate/libs/BeeFramework/Core/Storage/0.2.4.zip +0 -0
  59. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.h +133 -0
  60. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.m +641 -0
  61. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.h +106 -0
  62. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.m +1956 -0
  63. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.h +91 -0
  64. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.m +318 -0
  65. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.h +223 -0
  66. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.m +3007 -0
  67. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.h +55 -0
  68. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.m +173 -0
  69. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.h +39 -0
  70. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.m +33 -0
  71. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.h +47 -0
  72. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.m +81 -0
  73. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.h +44 -0
  74. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.m +57 -0
  75. data/test.xctemplate/libs/BeeFramework/MVC/Bee_MVC.h +49 -0
  76. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.h +66 -0
  77. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.mm +228 -0
  78. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.h +209 -0
  79. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.mm +873 -0
  80. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.h +75 -0
  81. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.mm +389 -0
  82. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.h +52 -0
  83. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.m +150 -0
  84. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.h +49 -0
  85. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.mm +201 -0
  86. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.h +52 -0
  87. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.mm +118 -0
  88. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.h +49 -0
  89. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.mm +78 -0
  90. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.h +57 -0
  91. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.mm +138 -0
  92. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.h +64 -0
  93. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.m +190 -0
  94. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.h +71 -0
  95. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.m +307 -0
  96. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.h +52 -0
  97. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.m +152 -0
  98. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.h +73 -0
  99. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.m +234 -0
  100. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.h +97 -0
  101. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.m +424 -0
  102. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.h +78 -0
  103. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.m +362 -0
  104. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.h +82 -0
  105. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.m +298 -0
  106. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.h +110 -0
  107. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.m +541 -0
  108. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.h +74 -0
  109. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.m +243 -0
  110. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.h +46 -0
  111. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.m +99 -0
  112. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.h +124 -0
  113. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.m +821 -0
  114. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.h +57 -0
  115. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.m +161 -0
  116. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.h +60 -0
  117. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.m +146 -0
  118. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.h +61 -0
  119. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.m +190 -0
  120. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.h +47 -0
  121. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.m +113 -0
  122. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.h +71 -0
  123. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.m +236 -0
  124. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.h +146 -0
  125. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.m +1487 -0
  126. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.h +60 -0
  127. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.m +192 -0
  128. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.h +126 -0
  129. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.m +453 -0
  130. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.h +70 -0
  131. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.m +249 -0
  132. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.h +67 -0
  133. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.m +242 -0
  134. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.h +75 -0
  135. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.m +311 -0
  136. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.h +184 -0
  137. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.m +911 -0
  138. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.h +65 -0
  139. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.m +242 -0
  140. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.h +91 -0
  141. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.m +444 -0
  142. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.h +72 -0
  143. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.m +38 -0
  144. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.h +79 -0
  145. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.m +288 -0
  146. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.h +65 -0
  147. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.m +161 -0
  148. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.h +45 -0
  149. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.m +137 -0
  150. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.h +56 -0
  151. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.m +218 -0
  152. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.h +105 -0
  153. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.m +556 -0
  154. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.h +53 -0
  155. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.m +104 -0
  156. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.h +52 -0
  157. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.m +170 -0
  158. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.h +54 -0
  159. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.m +166 -0
  160. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.h +54 -0
  161. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.m +184 -0
  162. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.h +57 -0
  163. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.m +275 -0
  164. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.h +212 -0
  165. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.m +1219 -0
  166. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.h +111 -0
  167. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.m +694 -0
  168. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.h +71 -0
  169. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.m +258 -0
  170. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.h +45 -0
  171. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.m +36 -0
  172. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.h +57 -0
  173. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.m +151 -0
  174. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.h +53 -0
  175. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.m +92 -0
  176. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.h +72 -0
  177. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +175 -0
  178. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.h +59 -0
  179. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.m +249 -0
  180. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.h +199 -0
  181. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.m +1170 -0
  182. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.h +113 -0
  183. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.m +710 -0
  184. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.h +66 -0
  185. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.m +189 -0
  186. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.h +69 -0
  187. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.m +210 -0
  188. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.h +45 -0
  189. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.m +59 -0
  190. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.h +45 -0
  191. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.m +55 -0
  192. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.h +45 -0
  193. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.m +54 -0
  194. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.h +45 -0
  195. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.m +54 -0
  196. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.h +45 -0
  197. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.m +438 -0
  198. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.h +60 -0
  199. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.m +37 -0
  200. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.h +45 -0
  201. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.m +55 -0
  202. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.h +45 -0
  203. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.m +55 -0
  204. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.h +41 -0
  205. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.m +100 -0
  206. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.h +41 -0
  207. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.m +101 -0
  208. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.h +41 -0
  209. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.m +48 -0
  210. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.h +41 -0
  211. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.m +77 -0
  212. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.h +41 -0
  213. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.m +47 -0
  214. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.h +52 -0
  215. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.m +177 -0
  216. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.h +44 -0
  217. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.m +57 -0
  218. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.h +50 -0
  219. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.m +283 -0
  220. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.h +52 -0
  221. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.m +178 -0
  222. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.h +44 -0
  223. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.m +58 -0
  224. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.h +44 -0
  225. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.m +57 -0
  226. metadata +226 -3
@@ -0,0 +1,1170 @@
1
+ //
2
+ // ______ ______ ______
3
+ // /\ __ \ /\ ___\ /\ ___\
4
+ // \ \ __< \ \ __\_ \ \ __\_
5
+ // \ \_____\ \ \_____\ \ \_____\
6
+ // \/_____/ \/_____/ \/_____/
7
+ //
8
+ // Copyright (c) 2012 BEE creators
9
+ // http://www.whatsbug.com
10
+ //
11
+ // Permission is hereby granted, free of charge, to any person obtaining a
12
+ // copy of this software and associated documentation files (the "Software"),
13
+ // to deal in the Software without restriction, including without limitation
14
+ // the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
+ // and/or sell copies of the Software, and to permit persons to whom the
16
+ // Software is furnished to do so, subject to the following conditions:
17
+ //
18
+ // The above copyright notice and this permission notice shall be included in
19
+ // all copies or substantial portions of the Software.
20
+ //
21
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
+ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27
+ // IN THE SOFTWARE.
28
+ //
29
+ //
30
+ // Bee_UILayout.m
31
+ //
32
+
33
+ #import "Bee_Log.h"
34
+ #import "Bee_UILayout.h"
35
+ #import "NSArray+BeeExtension.h"
36
+ #import "UIView+BeeExtension.h"
37
+ #import "CGRect+BeeExtension.h"
38
+
39
+ #import <objc/runtime.h>
40
+
41
+ #pragma mark -
42
+
43
+ #undef LAYOUT_MAX_WIDTH
44
+ #define LAYOUT_MAX_WIDTH (99999.0f)
45
+
46
+ #undef LAYOUT_MAX_HEIGHT
47
+ #define LAYOUT_MAX_HEIGHT (99999.0f)
48
+
49
+ #pragma mark -
50
+
51
+ @implementation BeeUIValue
52
+
53
+ DEF_INT( PIXEL, 0 )
54
+ DEF_INT( PERCENT, 1 )
55
+ DEF_INT( FILL_PARENT, 2 )
56
+ DEF_INT( WRAP_CONTENT, 3 )
57
+
58
+ @synthesize type = _type;
59
+ @synthesize value = _value;
60
+
61
+ - (NSString *)description
62
+ {
63
+ if ( self.PIXEL == self.type )
64
+ {
65
+ return [NSString stringWithFormat:@"%.1fpx", _value];
66
+ }
67
+ else if ( self.PERCENT == self.type )
68
+ {
69
+ return [NSString stringWithFormat:@"%.1f%%", _value];
70
+ }
71
+ else if ( self.FILL_PARENT == self.type )
72
+ {
73
+ return @"fill_parent";
74
+ }
75
+ else if ( self.WRAP_CONTENT == self.type )
76
+ {
77
+ return @"wrap_content";
78
+ }
79
+
80
+ return @"";
81
+ }
82
+
83
+ + (BeeUIValue *)pixel:(CGFloat)val
84
+ {
85
+ BeeUIValue * value = [[[BeeUIValue alloc] init] autorelease];
86
+ value.type = self.PIXEL;
87
+ value.value = val;
88
+ return value;
89
+ }
90
+
91
+ + (BeeUIValue *)percent:(CGFloat)val
92
+ {
93
+ BeeUIValue * value = [[[BeeUIValue alloc] init] autorelease];
94
+ value.type = self.PERCENT;
95
+ value.value = val;
96
+ return value;
97
+ }
98
+
99
+ + (BeeUIValue *)fillParent
100
+ {
101
+ BeeUIValue * value = [[[BeeUIValue alloc] init] autorelease];
102
+ value.type = self.FILL_PARENT;
103
+ return value;
104
+ }
105
+
106
+ + (BeeUIValue *)wrapContent
107
+ {
108
+ BeeUIValue * value = [[[BeeUIValue alloc] init] autorelease];
109
+ value.type = self.WRAP_CONTENT;
110
+ return value;
111
+ }
112
+
113
+ + (BeeUIValue *)fromString:(NSString *)str
114
+ {
115
+ if ( 0 == str.length )
116
+ return nil;
117
+
118
+ BeeUIValue * value = [[[BeeUIValue alloc] init] autorelease];
119
+ if ( value )
120
+ {
121
+ if ( [str hasSuffix:@"px"] )
122
+ {
123
+ value.type = self.PIXEL;
124
+ }
125
+ else if ( [str hasSuffix:@"%"] )
126
+ {
127
+ value.type = self.PERCENT;
128
+ }
129
+ else if ( NSOrderedSame == [str compare:@"fill_parent" options:NSCaseInsensitiveSearch] )
130
+ {
131
+ value.type = self.FILL_PARENT;
132
+ }
133
+ else if ( NSOrderedSame == [str compare:@"wrap_content" options:NSCaseInsensitiveSearch] )
134
+ {
135
+ value.type = self.WRAP_CONTENT;
136
+ }
137
+ else
138
+ {
139
+ value.type = self.PIXEL;
140
+ }
141
+
142
+ value.value = [str floatValue];
143
+ }
144
+ return value;
145
+ }
146
+
147
+ @end
148
+
149
+ #pragma mark -
150
+
151
+ @implementation BeeUILayout
152
+
153
+ DEF_STRING( ALIGN_CENTER, @"center" )
154
+ DEF_STRING( ALIGN_LEFT, @"left" )
155
+ DEF_STRING( ALIGN_TOP, @"top" )
156
+ DEF_STRING( ALIGN_BOTTOM, @"bottom" )
157
+ DEF_STRING( ALIGN_RIGHT, @"right" )
158
+
159
+ DEF_STRING( ORIENTATION_HORIZONAL, @"horizonal" )
160
+ DEF_STRING( ORIENTATION_VERTICAL, @"vertical" )
161
+
162
+ DEF_STRING( POSITION_ABSOLUTE, @"absolute" )
163
+ DEF_STRING( POSITION_RELATIVE, @"relative" )
164
+
165
+ @synthesize always = _always;
166
+ @synthesize containable = _containable;
167
+ @synthesize visible = _visible;
168
+ @synthesize root = _root;
169
+ @synthesize parent = _parent;
170
+ @synthesize name = _name;
171
+ @synthesize value = _value;
172
+ @synthesize styleID = _styleID;
173
+ @synthesize style = _style;
174
+ @synthesize classType = _classType;
175
+ @synthesize properties = _properties;
176
+ @synthesize childs = _childs;
177
+ @dynamic canvas;
178
+
179
+ @synthesize autoresizingWidth = _autoresizingWidth;
180
+ @synthesize autoresizingHeight = _autoresizingHeight;
181
+
182
+ @dynamic ADD;
183
+ @dynamic REMOVE;
184
+ @dynamic REMOVE_ALL;
185
+
186
+ @dynamic x;
187
+ @dynamic y;
188
+ @dynamic w;
189
+ @dynamic h;
190
+ @dynamic position;
191
+ @dynamic align;
192
+ @dynamic v_align;
193
+ @dynamic orientation;
194
+
195
+ @dynamic X;
196
+ @dynamic Y;
197
+ @dynamic W;
198
+ @dynamic H;
199
+ @dynamic POSITION;
200
+ @dynamic ALIGN;
201
+ @dynamic V_ALIGN;
202
+ @dynamic ORIENTATION;
203
+ @dynamic AUTORESIZE_WIDTH;
204
+ @dynamic AUTORESIZE_HEIGHT;
205
+ @dynamic VISIBLE;
206
+ @dynamic ALWAYS;
207
+ @dynamic FULLFILL;
208
+
209
+ @dynamic EMPTY;
210
+ @dynamic REBUILD;
211
+ @dynamic RELAYOUT;
212
+
213
+ @dynamic BEGIN_LAYOUT;
214
+ @dynamic END_LAYOUT;
215
+ @dynamic BEGIN_CONTAINER;
216
+ @dynamic END_CONTAINER;
217
+ @dynamic VIEW;
218
+ @dynamic SPACE;
219
+
220
+ @dynamic DUMP;
221
+
222
+ - (NSString *)description
223
+ {
224
+ return [NSString stringWithFormat:@"%@ (%@, %@, %@, %@)",
225
+ self.name,
226
+ self.x ? [self.x description] : @"nil",
227
+ self.y ? [self.y description] : @"nil",
228
+ self.w ? [self.w description] : @"nil",
229
+ self.h ? [self.h description] : @"nil"];
230
+ }
231
+
232
+ + (NSString *)generateName
233
+ {
234
+ static NSUInteger __seed = 0;
235
+ return [NSString stringWithFormat:@"layout_%u", __seed++];
236
+ }
237
+
238
+ - (id)init
239
+ {
240
+ self = [super init];
241
+ if ( self )
242
+ {
243
+ self.always = NO;
244
+ self.containable = YES;
245
+ self.visible = YES;
246
+ self.root = self;
247
+ self.parent = nil;
248
+ self.name = [BeeUILayout generateName];
249
+ self.value = nil;
250
+ self.styleID = nil;
251
+ self.style = nil;
252
+ self.classType = nil;
253
+ self.properties = [NSMutableDictionary dictionary];
254
+ self.childs = [NSMutableArray array];
255
+
256
+ self.autoresizingWidth = NO;
257
+ self.autoresizingHeight = NO;
258
+ }
259
+ return self;
260
+ }
261
+
262
+ - (void)dealloc
263
+ {
264
+ [self.properties removeAllObjects];
265
+ self.properties = nil;
266
+
267
+ [self.childs removeAllObjects];
268
+ self.childs = nil;
269
+
270
+ self.root = nil;
271
+ self.parent = nil;
272
+ self.name = nil;
273
+ self.value = nil;
274
+ self.styleID = nil;
275
+ self.style = nil;
276
+ self.classType = nil;
277
+
278
+ [_stack removeAllObjects];
279
+ [_stack release];
280
+ _stack = nil;
281
+
282
+ [super dealloc];
283
+ }
284
+
285
+ - (void)dump
286
+ {
287
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
288
+
289
+ CC( @"%@(%d childs)", self.name, self.childs.count );
290
+
291
+ BeeLogIndent( 1 );
292
+
293
+ for ( BeeUILayout * child in self.childs )
294
+ {
295
+ [child dump];
296
+ }
297
+
298
+ BeeLogUnindent( 1 );
299
+
300
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
301
+ }
302
+
303
+ - (void)setCanvas:(UIView *)c;
304
+ {
305
+ _canvas = c;
306
+
307
+ for ( BeeUILayout * layout in self.childs )
308
+ {
309
+ [layout setCanvas:c];
310
+ }
311
+ }
312
+
313
+ - (UIView *)canvas
314
+ {
315
+ return _canvas;
316
+ }
317
+
318
+ - (UIView *)buildView
319
+ {
320
+ if ( nil == self.classType )
321
+ return nil;
322
+
323
+ if ( self.classType != [UIView class] && NO == [self.classType isSubclassOfClass:[UIView class]] )
324
+ return nil;
325
+
326
+ CC( @"buildView %@", [self.classType description] );
327
+
328
+ UIView * view = [[[self.classType alloc] initWithFrame:CGRectZero] autorelease];
329
+ if ( view )
330
+ {
331
+ view.tagString = self.name;
332
+ }
333
+
334
+ if ( self.style )
335
+ {
336
+ [self.style applyFor:view];
337
+ }
338
+
339
+ return view;
340
+ }
341
+
342
+ - (UIView *)buildViewAndSubviews
343
+ {
344
+ UIView * view = [self buildView];
345
+ if ( view )
346
+ {
347
+ for ( UIView * subview in [[view.subviews copy] autorelease] )
348
+ {
349
+ [subview removeFromSuperview];
350
+ }
351
+
352
+ [self buildSubviewsFor:view];
353
+ }
354
+ return view;
355
+ }
356
+
357
+ - (void)buildSubviewsForCanvas
358
+ {
359
+ [self buildSubviewsFor:_canvas];
360
+ }
361
+
362
+ - (void)buildSubviewsFor:(UIView *)c depth:(NSUInteger)depth
363
+ {
364
+ if ( nil == c )
365
+ {
366
+ CC( @"canvas not found" );
367
+ return;
368
+ }
369
+
370
+ for ( BeeUILayout * layout in self.childs )
371
+ {
372
+ UIView * view = [layout buildView];
373
+ if ( view )
374
+ {
375
+ [c addSubview:view];
376
+ [c bringSubviewToFront:view];
377
+ }
378
+ }
379
+
380
+ for ( BeeUILayout * layout in self.childs )
381
+ {
382
+ [layout buildSubviewsFor:c depth:(depth + 1)];
383
+ }
384
+
385
+ if ( 0 == depth )
386
+ {
387
+ [self reorderSubviewsFor:c];
388
+ }
389
+ }
390
+
391
+ - (void)buildSubviewsFor:(UIView *)c
392
+ {
393
+ [self buildSubviewsFor:c depth:0];
394
+ }
395
+
396
+ - (void)reorderSubviewsFor:(UIView *)c
397
+ {
398
+ if ( nil == c )
399
+ {
400
+ CC( @"canvas not found" );
401
+ return;
402
+ }
403
+
404
+ for ( BeeUILayout * layout in self.childs )
405
+ {
406
+ [layout reorderSubviewsFor:c];
407
+ }
408
+
409
+ UIView * view = [c viewWithTagString:self.name];
410
+ if ( view )
411
+ {
412
+ [c bringSubviewToFront:view];
413
+ }
414
+ }
415
+
416
+ - (CGPoint)estimateOriginForCanvas
417
+ {
418
+ return [self estimateOriginBy:(_canvas ? _canvas.bounds : CGRectZero)];
419
+ }
420
+
421
+ - (CGPoint)estimateOriginBy:(CGRect)parentFrame
422
+ {
423
+ BeeUIValue * x = self.x;
424
+ BeeUIValue * y = self.y;
425
+ NSString * pos = self.position;
426
+ CGPoint origin = CGPointZero;
427
+
428
+ CGFloat xPixels = 0.0f;
429
+ CGFloat yPixels = 0.0f;
430
+
431
+ if ( x )
432
+ {
433
+ if ( BeeUIValue.PIXEL == x.type )
434
+ {
435
+ xPixels = x.value;
436
+ }
437
+ else if ( BeeUIValue.PERCENT == x.type )
438
+ {
439
+ xPixels = floorf( parentFrame.size.width * x.value / 100.0f );
440
+ }
441
+ }
442
+
443
+ if ( y )
444
+ {
445
+ if ( BeeUIValue.PIXEL == y.type )
446
+ {
447
+ yPixels = y.value;
448
+ }
449
+ else if ( BeeUIValue.PERCENT == y.type )
450
+ {
451
+ yPixels = floorf( parentFrame.size.width * y.value / 100.0f );
452
+ }
453
+ }
454
+
455
+ // Relative : the origin is ParentFrame.origin
456
+ // Absolute : thr origin is CGPointZero
457
+
458
+ if ( [pos isEqualToString:self.POSITION_ABSOLUTE] )
459
+ {
460
+ origin = CGPointZero;
461
+ }
462
+ else if ( [pos isEqualToString:self.POSITION_RELATIVE] )
463
+ {
464
+ origin = parentFrame.origin;
465
+ }
466
+ else
467
+ {
468
+ origin = parentFrame.origin;
469
+ }
470
+
471
+ origin.x += xPixels;
472
+ origin.y += yPixels;
473
+
474
+ return origin;
475
+ }
476
+
477
+ - (CGSize)estimateSizeForCanvas
478
+ {
479
+ return [self estimateSizeBy:(_canvas ? _canvas.bounds : CGRectZero)];
480
+ }
481
+
482
+ - (CGSize)estimateSizeBy:(CGRect)parentFrame
483
+ {
484
+ BeeUIValue * w = self.w;
485
+ BeeUIValue * h = self.h;
486
+ CGSize size = CGSizeZero;
487
+
488
+ if ( w )
489
+ {
490
+ CGFloat wPixels = 0.0f;
491
+
492
+ if ( BeeUIValue.PIXEL == w.type )
493
+ {
494
+ wPixels = w.value;
495
+ }
496
+ else if ( BeeUIValue.PERCENT == w.type )
497
+ {
498
+ wPixels = floorf( parentFrame.size.width * w.value / 100.0f );
499
+ }
500
+ else if ( BeeUIValue.FILL_PARENT == w.type )
501
+ {
502
+ wPixels = parentFrame.size.width;
503
+ }
504
+ else if ( BeeUIValue.WRAP_CONTENT == w.type )
505
+ {
506
+ wPixels = parentFrame.size.width;
507
+ }
508
+
509
+ size.width = wPixels;
510
+ }
511
+ else
512
+ {
513
+ size.width = parentFrame.size.width;
514
+ }
515
+
516
+ if ( h )
517
+ {
518
+ CGFloat hPixels = 0.0f;
519
+
520
+ if ( BeeUIValue.PIXEL == h.type )
521
+ {
522
+ hPixels = h.value;
523
+ }
524
+ else if ( BeeUIValue.PERCENT == h.type )
525
+ {
526
+ hPixels = floorf( parentFrame.size.height * h.value / 100.0f );
527
+ }
528
+ else if ( BeeUIValue.FILL_PARENT == h.type )
529
+ {
530
+ hPixels = parentFrame.size.height;
531
+ }
532
+ else if ( BeeUIValue.WRAP_CONTENT == h.type )
533
+ {
534
+ hPixels = parentFrame.size.height;
535
+ }
536
+
537
+ size.height = hPixels;
538
+ }
539
+ else
540
+ {
541
+ size.height = parentFrame.size.height;
542
+ }
543
+
544
+ return size;
545
+ }
546
+
547
+ - (CGRect)estimateFrameForCanvas
548
+ {
549
+ return [self estimateFrameBy:(_canvas ? _canvas.bounds : CGRectZero)];
550
+ }
551
+
552
+ - (CGRect)estimateFrameBy:(CGRect)parentFrame
553
+ {
554
+ return [self estimateFrameBy:parentFrame changeViewFrame:NO];
555
+ }
556
+
557
+ - (CGRect)estimateFrameBy:(CGRect)parentFrame changeViewFrame:(BOOL)flag
558
+ {
559
+ NSString * align = self.align;
560
+ NSString * valign = self.v_align;
561
+
562
+ CGRect thisFrame;
563
+ thisFrame.origin = [self estimateOriginBy:parentFrame];
564
+ thisFrame.size = [self estimateSizeBy:parentFrame];
565
+
566
+ CGRect layoutBound;
567
+ layoutBound.origin = thisFrame.origin;
568
+ layoutBound.size.width = self.autoresizingWidth ? LAYOUT_MAX_WIDTH : thisFrame.size.width;
569
+ layoutBound.size.height = self.autoresizingHeight ? LAYOUT_MAX_HEIGHT : thisFrame.size.height;
570
+
571
+ CGRect lineWindow = layoutBound;
572
+ CGSize layoutMaxSize = CGSizeZero;
573
+
574
+ NSString * orient = self.orientation;
575
+
576
+ BOOL horizonal = (NSOrderedSame == [orient compare:self.ORIENTATION_HORIZONAL options:NSCaseInsensitiveSearch]) ? YES : NO;
577
+
578
+ for ( BeeUILayout * child in self.childs )
579
+ {
580
+ if ( NO == child.visible && NO == child.always )
581
+ continue;
582
+
583
+ CGRect relativeBound;
584
+
585
+ if ( [child.position isEqualToString:self.POSITION_ABSOLUTE] )
586
+ {
587
+ relativeBound.origin = thisFrame.origin;
588
+ relativeBound.size = layoutBound.size;
589
+ }
590
+ else
591
+ {
592
+ relativeBound.origin = lineWindow.origin;
593
+ relativeBound.size = layoutBound.size;
594
+
595
+ // relativeBound.origin default frame is lineWindow.origin, but when the align/v_algin
596
+ // is valued it should be layoutBound.origin, the really parentFrame.origin
597
+
598
+ if ( child.align )
599
+ {
600
+ relativeBound.origin.x = layoutBound.origin.x;
601
+ }
602
+
603
+ if ( child.v_align )
604
+ {
605
+ relativeBound.origin.y = layoutBound.origin.y;
606
+ }
607
+ }
608
+
609
+ CGRect childFrame = [child relayoutForBound:relativeBound];
610
+
611
+ if ( horizonal )
612
+ {
613
+ // Step 1)
614
+ // move window
615
+
616
+ lineWindow.origin.x += childFrame.size.width;
617
+ lineWindow.size.width -= childFrame.size.width;
618
+
619
+ if ( childFrame.size.height > lineWindow.size.height )
620
+ {
621
+ lineWindow.size.height = childFrame.size.height;
622
+ }
623
+
624
+ // Step 2)
625
+ // calculate max size
626
+
627
+ // todo : if the lineWindow.size.width <= 0.0f, layoutMaxSize calculate error
628
+
629
+ if ( lineWindow.origin.x > layoutMaxSize.width )
630
+ {
631
+ layoutMaxSize.width = lineWindow.origin.x;
632
+ }
633
+
634
+ if ( childFrame.size.height > layoutMaxSize.height )
635
+ {
636
+ layoutMaxSize.height = childFrame.size.height;
637
+ }
638
+
639
+ // Step 3)
640
+ // break line if reach right edge
641
+
642
+ if ( lineWindow.size.width <= 0.0f )
643
+ {
644
+ lineWindow.origin.x = layoutBound.origin.x;
645
+ lineWindow.origin.y += layoutMaxSize.height;
646
+ lineWindow.size.width = layoutBound.size.width;
647
+ lineWindow.size.height = layoutBound.size.height - lineWindow.origin.y;
648
+
649
+ if ( lineWindow.origin.y > layoutMaxSize.height )
650
+ {
651
+ layoutMaxSize.height = lineWindow.origin.y;
652
+ }
653
+ }
654
+ }
655
+ else
656
+ {
657
+
658
+ // Step 1)
659
+ // move window
660
+
661
+ lineWindow.origin.y += childFrame.size.height;
662
+ lineWindow.size.height -= childFrame.size.height;
663
+
664
+ if ( childFrame.size.width > lineWindow.size.width )
665
+ {
666
+ lineWindow.size.width = childFrame.size.width;
667
+ }
668
+
669
+ // Step 2)
670
+ // calculate max size
671
+
672
+ if ( childFrame.size.width > layoutMaxSize.width )
673
+ {
674
+ layoutMaxSize.width = childFrame.size.width;
675
+ }
676
+
677
+ if ( lineWindow.origin.y > layoutMaxSize.height )
678
+ {
679
+ layoutMaxSize.height = lineWindow.origin.y;
680
+ }
681
+
682
+ // Step 3)
683
+ // break line if reach bottom edge
684
+
685
+ if ( lineWindow.size.height <= 0.0f )
686
+ {
687
+ lineWindow.origin.y = layoutBound.origin.y;
688
+ lineWindow.origin.x += layoutMaxSize.width;
689
+ lineWindow.size.height = layoutBound.size.height;
690
+ lineWindow.size.width = layoutBound.size.width - lineWindow.origin.x;
691
+
692
+ if ( lineWindow.origin.x > layoutMaxSize.width )
693
+ {
694
+ layoutMaxSize.width = lineWindow.origin.x;
695
+ }
696
+ }
697
+ }
698
+ }
699
+
700
+ if ( self.autoresizingWidth )
701
+ {
702
+ thisFrame.size.width = layoutMaxSize.width;
703
+ }
704
+ else
705
+ {
706
+ if ( [align isEqualToString:self.ALIGN_CENTER] )
707
+ {
708
+ thisFrame = CGRectAlignX( thisFrame , parentFrame );
709
+ }
710
+ else if ( [align isEqualToString:self.ALIGN_LEFT] )
711
+ {
712
+ thisFrame = CGRectAlignLeft( thisFrame , parentFrame );
713
+ }
714
+ else if ( [align isEqualToString:self.ALIGN_RIGHT] )
715
+ {
716
+ thisFrame = CGRectAlignRight( thisFrame , parentFrame );
717
+ }
718
+ }
719
+
720
+ if ( self.autoresizingHeight )
721
+ {
722
+ thisFrame.size.height = layoutMaxSize.height;
723
+ }
724
+ else
725
+ {
726
+ if ( [valign isEqualToString:self.ALIGN_CENTER] )
727
+ {
728
+ thisFrame = CGRectAlignY( thisFrame , parentFrame );
729
+ }
730
+ else if ( [valign isEqualToString:self.ALIGN_TOP] )
731
+ {
732
+ thisFrame = CGRectAlignTop( thisFrame , parentFrame );
733
+ }
734
+ else if ( [valign isEqualToString:self.ALIGN_BOTTOM] )
735
+ {
736
+ thisFrame = CGRectAlignBottom( thisFrame , parentFrame );
737
+ }
738
+ }
739
+
740
+ if ( flag )
741
+ {
742
+ if ( _canvas && _name )
743
+ {
744
+ UIView * view = [_canvas viewWithTagString:_name];
745
+ if ( view )
746
+ {
747
+ view.frame = thisFrame;
748
+ }
749
+ }
750
+ }
751
+
752
+ return thisFrame;
753
+ }
754
+
755
+ - (CGRect)relayoutForCanvas;
756
+ {
757
+ return [self relayoutForBound:_canvas.frame];
758
+ }
759
+
760
+ - (CGRect)relayoutForBound:(CGRect)parentFrame
761
+ {
762
+ return [self estimateFrameBy:parentFrame changeViewFrame:YES];
763
+ }
764
+
765
+ #pragma mark -
766
+
767
+ - (BeeUILayout *)topLayout
768
+ {
769
+ if ( nil == _stack || 0 == _stack.count )
770
+ return self;
771
+
772
+ return _stack.lastObject;
773
+ }
774
+
775
+ - (void)pushLayout:(BeeUILayout *)layout
776
+ {
777
+ if ( nil == layout )
778
+ return;
779
+
780
+ if ( nil == _stack )
781
+ {
782
+ _stack = [[NSMutableArray alloc] init];
783
+ }
784
+
785
+ [_stack pushTail:layout];
786
+ }
787
+
788
+ - (void)popLayout
789
+ {
790
+ if ( _stack )
791
+ {
792
+ [_stack popTail];
793
+ }
794
+ }
795
+
796
+ #pragma mark -
797
+
798
+ - (BeeUIValue *)x
799
+ {
800
+ return [self.properties objectForKey:@"x"];
801
+ }
802
+
803
+ - (BeeUIValue *)y
804
+ {
805
+ return [self.properties objectForKey:@"y"];
806
+ }
807
+
808
+ - (BeeUIValue *)w
809
+ {
810
+ return [self.properties objectForKey:@"w"];
811
+ }
812
+
813
+ - (BeeUIValue *)h
814
+ {
815
+ return [self.properties objectForKey:@"h"];
816
+ }
817
+
818
+ - (NSString *)position
819
+ {
820
+ return [self.properties objectForKey:@"position"];
821
+ }
822
+
823
+ - (NSString *)align
824
+ {
825
+ return [self.properties objectForKey:@"align"];
826
+ }
827
+
828
+ - (NSString *)v_align
829
+ {
830
+ return [self.properties objectForKey:@"v_align"];
831
+ }
832
+
833
+ - (NSString *)orientation
834
+ {
835
+ return [self.properties objectForKey:@"orientation"];
836
+ }
837
+
838
+ #pragma mark -
839
+
840
+ - (BeeUILayoutBlockN)X
841
+ {
842
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
843
+ {
844
+ BeeUIValue * value = [BeeUIValue fromString:(NSString *)first];
845
+ if ( value )
846
+ {
847
+ [self.properties setObject:value forKey:@"x"];
848
+ }
849
+ return self;
850
+ };
851
+
852
+ return [[block copy] autorelease];
853
+ }
854
+
855
+ - (BeeUILayoutBlockN)Y
856
+ {
857
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
858
+ {
859
+ BeeUIValue * value = [BeeUIValue fromString:(NSString *)first];
860
+ if ( value )
861
+ {
862
+ [self.properties setObject:value forKey:@"y"];
863
+ }
864
+ return self;
865
+ };
866
+
867
+ return [[block copy] autorelease];
868
+ }
869
+
870
+ - (BeeUILayoutBlockN)W
871
+ {
872
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
873
+ {
874
+ BeeUIValue * value = [BeeUIValue fromString:(NSString *)first];
875
+ if ( value )
876
+ {
877
+ [self.properties setObject:value forKey:@"w"];
878
+ }
879
+ return self;
880
+ };
881
+
882
+ return [[block copy] autorelease];
883
+ }
884
+
885
+ - (BeeUILayoutBlockN)H
886
+ {
887
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
888
+ {
889
+ BeeUIValue * value = [BeeUIValue fromString:(NSString *)first];
890
+ if ( value )
891
+ {
892
+ [self.properties setObject:value forKey:@"h"];
893
+ }
894
+ return self;
895
+ };
896
+
897
+ return [[block copy] autorelease];
898
+ }
899
+
900
+ - (BeeUILayoutBlockN)POSITION
901
+ {
902
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
903
+ {
904
+ [self.properties setObject:first forKey:@"position"];
905
+ return self;
906
+ };
907
+
908
+ return [[block copy] autorelease];
909
+ }
910
+
911
+ - (BeeUILayoutBlockN)ALIGN
912
+ {
913
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
914
+ {
915
+ [self.properties setObject:first forKey:@"align"];
916
+ return self;
917
+ };
918
+
919
+ return [[block copy] autorelease];
920
+ }
921
+
922
+ - (BeeUILayoutBlockN)V_ALIGN
923
+ {
924
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
925
+ {
926
+ [self.properties setObject:first forKey:@"v_align"];
927
+ return self;
928
+ };
929
+
930
+ return [[block copy] autorelease];
931
+ }
932
+
933
+ - (BeeUILayoutBlockN)ORIENTATION
934
+ {
935
+ BeeUILayoutBlockN block = ^ BeeUILayout * ( id first, ... )
936
+ {
937
+ [self.properties setObject:first forKey:@"orientation"];
938
+ return self;
939
+ };
940
+
941
+ return [[block copy] autorelease];
942
+ }
943
+
944
+ - (BeeUILayoutBlockB)AUTORESIZE_WIDTH
945
+ {
946
+ BeeUILayoutBlockB block = ^ BeeUILayout * ( BOOL flag )
947
+ {
948
+ self.autoresizingWidth = flag;
949
+ return self;
950
+ };
951
+
952
+ return [[block copy] autorelease];
953
+ }
954
+
955
+ - (BeeUILayoutBlockB)AUTORESIZE_HEIGHT
956
+ {
957
+ BeeUILayoutBlockB block = ^ BeeUILayout * ( BOOL flag )
958
+ {
959
+ self.autoresizingHeight = flag;
960
+ return self;
961
+ };
962
+
963
+ return [[block copy] autorelease];
964
+ }
965
+
966
+ - (BeeUILayoutBlockB)VISIBLE
967
+ {
968
+ BeeUILayoutBlockB block = ^ BeeUILayout * ( BOOL flag )
969
+ {
970
+ self.visible = flag;
971
+ return self;
972
+ };
973
+
974
+ return [[block copy] autorelease];
975
+ }
976
+
977
+ - (BeeUILayoutBlockB)ALWAYS
978
+ {
979
+ BeeUILayoutBlockB block = ^ BeeUILayout * ( BOOL flag )
980
+ {
981
+ self.always = flag;
982
+ return self;
983
+ };
984
+
985
+ return [[block copy] autorelease];
986
+ }
987
+
988
+ - (BeeUILayoutBlock)FULLFILL
989
+ {
990
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
991
+ {
992
+ [self.properties setObject:[BeeUIValue pixel:0] forKey:@"x"];
993
+ [self.properties setObject:[BeeUIValue pixel:0] forKey:@"y"];
994
+ [self.properties setObject:[BeeUIValue percent:100] forKey:@"w"];
995
+ [self.properties setObject:[BeeUIValue percent:100] forKey:@"h"];
996
+
997
+ return self;
998
+ };
999
+
1000
+ return [[block copy] autorelease];
1001
+ }
1002
+
1003
+ - (BeeUILayoutBlock)EMPTY
1004
+ {
1005
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1006
+ {
1007
+ CC( @"empty layout" );
1008
+ [self.childs removeAllObjects];
1009
+ return self;
1010
+ };
1011
+
1012
+ return [[block copy] autorelease];
1013
+ }
1014
+
1015
+ - (BeeUILayoutBlock)REBUILD
1016
+ {
1017
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1018
+ {
1019
+ CC( @"build layout" );
1020
+ [self buildSubviewsForCanvas];
1021
+ return self;
1022
+ };
1023
+
1024
+ return [[block copy] autorelease];
1025
+ }
1026
+
1027
+ - (BeeUILayoutBlock)RELAYOUT
1028
+ {
1029
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1030
+ {
1031
+ [self relayoutForCanvas];
1032
+ return self;
1033
+ };
1034
+
1035
+ return [[block copy] autorelease];
1036
+ }
1037
+
1038
+ - (BeeUILayoutBlock)BEGIN_LAYOUT
1039
+ {
1040
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1041
+ {
1042
+ CC( @"begin layout" );
1043
+ BeeLogIndent( 1 );
1044
+
1045
+ [self.childs removeAllObjects];
1046
+ return self;
1047
+ };
1048
+
1049
+ return [[block copy] autorelease];
1050
+ }
1051
+
1052
+ - (BeeUILayoutBlock)END_LAYOUT
1053
+ {
1054
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1055
+ {
1056
+ BeeUILayout * layout = self;
1057
+
1058
+ while ( layout && layout.parent )
1059
+ {
1060
+ layout = layout.parent;
1061
+ }
1062
+
1063
+ BeeLogUnindent( 1 );
1064
+ CC( @"end layout" );
1065
+
1066
+ return layout;
1067
+ };
1068
+
1069
+ return [[block copy] autorelease];
1070
+ }
1071
+
1072
+ - (BeeUILayoutBlockS)BEGIN_CONTAINER
1073
+ {
1074
+ BeeUILayoutBlockS block = ^ BeeUILayout * ( NSString * tag )
1075
+ {
1076
+ BeeLogIndent( 1 );
1077
+
1078
+ BeeUILayout * layout = [[[BeeUILayout alloc] init] autorelease];
1079
+ if ( layout )
1080
+ {
1081
+ layout.containable = YES;
1082
+ layout.root = self.root;
1083
+ layout.parent = self.containable ? self : self.parent;
1084
+ layout.canvas = self.canvas;
1085
+ layout.classType = nil;
1086
+ layout.visible = layout.parent.visible;
1087
+
1088
+ [layout.parent.childs addObject:layout];
1089
+ }
1090
+
1091
+ CC( @"container %@", layout.name );
1092
+
1093
+ [self.root pushLayout:layout];
1094
+ return [self.root topLayout];
1095
+ };
1096
+
1097
+ return [[block copy] autorelease];
1098
+ }
1099
+
1100
+ - (BeeUILayoutBlock)END_CONTAINER
1101
+ {
1102
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1103
+ {
1104
+ BeeLogUnindent( 1 );
1105
+
1106
+ CC( @"end of container" );
1107
+
1108
+ [self.root popLayout];
1109
+ return [self.root topLayout];
1110
+ };
1111
+
1112
+ return [[block copy] autorelease];
1113
+ }
1114
+
1115
+ - (BeeUILayoutBlockCS)VIEW
1116
+ {
1117
+ BeeUILayoutBlockCS block = ^ BeeUILayout * ( Class clazz, NSString * tag )
1118
+ {
1119
+ BeeUILayout * layout = [[[BeeUILayout alloc] init] autorelease];
1120
+ if ( layout )
1121
+ {
1122
+ layout.containable = NO;
1123
+ layout.root = self.root;
1124
+ layout.parent = self.containable ? self : self.parent;
1125
+ layout.canvas = self.canvas;
1126
+ layout.classType = clazz;
1127
+ layout.visible = layout.parent.visible;
1128
+
1129
+ if ( tag )
1130
+ {
1131
+ layout.name = tag;
1132
+ }
1133
+
1134
+ [layout.parent.childs addObject:layout];
1135
+ }
1136
+
1137
+ CC( @"subview(%@) %@", [clazz description], layout.name );
1138
+
1139
+ return layout;
1140
+ };
1141
+
1142
+ return [[block copy] autorelease];
1143
+ }
1144
+
1145
+ - (BeeUILayoutBlock)SPACE
1146
+ {
1147
+ BeeUILayoutBlock block = ^ BeeUILayout * ( void )
1148
+ {
1149
+ BeeUILayout * layout = [[[BeeUILayout alloc] init] autorelease];
1150
+ if ( layout )
1151
+ {
1152
+ layout.containable = NO;
1153
+ layout.root = self.root;
1154
+ layout.parent = self.containable ? self : self.parent;
1155
+ layout.canvas = self.canvas;
1156
+ layout.classType = nil;
1157
+ layout.visible = layout.parent.visible;
1158
+
1159
+ CC( @"space %@", layout.name );
1160
+
1161
+ [layout.parent.childs addObject:layout];
1162
+ }
1163
+
1164
+ return layout;
1165
+ };
1166
+
1167
+ return [[block copy] autorelease];
1168
+ }
1169
+
1170
+ @end