Helios-Layout.deploy.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. smalltalk.addPackage('Helios-Layout', {});
  2. smalltalk.addClass('HLContainer', smalltalk.Widget, ['splitter'], 'Helios-Layout');
  3. smalltalk.addMethod(
  4. "_renderOn_",
  5. smalltalk.method({
  6. selector: "renderOn:",
  7. fn: function (html) {
  8. var self = this;
  9. var $1, $2;
  10. $1 = smalltalk.send(html, "_div", []);
  11. smalltalk.send($1, "_id_", ["container"]);
  12. $2 = smalltalk.send($1, "_with_", [smalltalk.send(self, "_splitter", [])]);
  13. smalltalk.send(smalltalk.send(window, "_jQuery_", [window]), "_bind_do_", ["resize", function () {return smalltalk.send(smalltalk.send(self, "_splitter", []), "_resize", []);}]);
  14. return self;
  15. }
  16. }),
  17. smalltalk.HLContainer);
  18. smalltalk.addMethod(
  19. "_splitter",
  20. smalltalk.method({
  21. selector: "splitter",
  22. fn: function () {
  23. var self = this;
  24. return self['@splitter'];
  25. }
  26. }),
  27. smalltalk.HLContainer);
  28. smalltalk.addMethod(
  29. "_splitter_",
  30. smalltalk.method({
  31. selector: "splitter:",
  32. fn: function (aSplitter) {
  33. var self = this;
  34. self['@splitter'] = aSplitter;
  35. return self;
  36. }
  37. }),
  38. smalltalk.HLContainer);
  39. smalltalk.addMethod(
  40. "_with_",
  41. smalltalk.method({
  42. selector: "with:",
  43. fn: function (aSplitter) {
  44. var self = this;
  45. var $2, $3, $1;
  46. $2 = smalltalk.send(self, "_new", []);
  47. smalltalk.send($2, "_splitter_", [aSplitter]);
  48. $3 = smalltalk.send($2, "_yourself", []);
  49. $1 = $3;
  50. return $1;
  51. }
  52. }),
  53. smalltalk.HLContainer.klass);
  54. smalltalk.addClass('HLSplitter', smalltalk.Widget, ['firstWidget', 'secondWidget', 'firstPane', 'secondPane', 'splitter'], 'Helios-Layout');
  55. smalltalk.addMethod(
  56. "_cssClass",
  57. smalltalk.method({
  58. selector: "cssClass",
  59. fn: function () {
  60. var self = this;
  61. return "splitter";
  62. }
  63. }),
  64. smalltalk.HLSplitter);
  65. smalltalk.addMethod(
  66. "_firstWidget",
  67. smalltalk.method({
  68. selector: "firstWidget",
  69. fn: function () {
  70. var self = this;
  71. return self['@firstWidget'];
  72. }
  73. }),
  74. smalltalk.HLSplitter);
  75. smalltalk.addMethod(
  76. "_firstWidget_",
  77. smalltalk.method({
  78. selector: "firstWidget:",
  79. fn: function (aWidget) {
  80. var self = this;
  81. self['@firstWidget'] = aWidget;
  82. return self;
  83. }
  84. }),
  85. smalltalk.HLSplitter);
  86. smalltalk.addMethod(
  87. "_isHeliosSplitter",
  88. smalltalk.method({
  89. selector: "isHeliosSplitter",
  90. fn: function () {
  91. var self = this;
  92. return true;
  93. }
  94. }),
  95. smalltalk.HLSplitter);
  96. smalltalk.addMethod(
  97. "_panesCssClass",
  98. smalltalk.method({
  99. selector: "panesCssClass",
  100. fn: function () {
  101. var self = this;
  102. return "panes";
  103. }
  104. }),
  105. smalltalk.HLSplitter);
  106. smalltalk.addMethod(
  107. "_renderOn_",
  108. smalltalk.method({
  109. selector: "renderOn:",
  110. fn: function (html) {
  111. var self = this;
  112. var $1, $3, $4, $5, $6, $2, $7;
  113. $1 = smalltalk.send(html, "_div", []);
  114. smalltalk.send($1, "_class_", [smalltalk.send(self, "_panesCssClass", [])]);
  115. $2 = smalltalk.send($1, "_with_", [function () {$3 = smalltalk.send(html, "_div", []);smalltalk.send($3, "_class_", ["pane"]);$4 = smalltalk.send($3, "_with_", [smalltalk.send(self, "_firstWidget", [])]);self['@firstPane'] = $4;self['@firstPane'];self['@splitter'] = smalltalk.send(smalltalk.send(html, "_div", []), "_class_", [smalltalk.send(self, "_cssClass", [])]);self['@splitter'];$5 = smalltalk.send(html, "_div", []);smalltalk.send($5, "_class_", ["pane"]);$6 = smalltalk.send($5, "_with_", [smalltalk.send(self, "_secondWidget", [])]);self['@secondPane'] = $6;return self['@secondPane'];}]);
  116. smalltalk.send(self, "_setupSplitter", []);
  117. $7 = smalltalk.send(self, "_resize", []);
  118. return self;
  119. }
  120. }),
  121. smalltalk.HLSplitter);
  122. smalltalk.addMethod(
  123. "_resize",
  124. smalltalk.method({
  125. selector: "resize",
  126. fn: function () {
  127. var self = this;
  128. var $1, $2;
  129. $1 = smalltalk.send(smalltalk.send(self, "_firstWidget", []), "_isHeliosSplitter", []);
  130. if (smalltalk.assert($1)) {
  131. smalltalk.send(smalltalk.send(self, "_firstWidget", []), "_resize", []);
  132. }
  133. $2 = smalltalk.send(smalltalk.send(self, "_secondWidget", []), "_isHeliosSplitter", []);
  134. if (smalltalk.assert($2)) {
  135. smalltalk.send(smalltalk.send(self, "_secondWidget", []), "_resize", []);
  136. }
  137. return self;
  138. }
  139. }),
  140. smalltalk.HLSplitter);
  141. smalltalk.addMethod(
  142. "_secondWidget",
  143. smalltalk.method({
  144. selector: "secondWidget",
  145. fn: function () {
  146. var self = this;
  147. return self['@secondWidget'];
  148. }
  149. }),
  150. smalltalk.HLSplitter);
  151. smalltalk.addMethod(
  152. "_secondWidget_",
  153. smalltalk.method({
  154. selector: "secondWidget:",
  155. fn: function (aWidget) {
  156. var self = this;
  157. self['@secondWidget'] = aWidget;
  158. return self;
  159. }
  160. }),
  161. smalltalk.HLSplitter);
  162. smalltalk.addMethod(
  163. "_setupSplitter",
  164. smalltalk.method({
  165. selector: "setupSplitter",
  166. fn: function () {
  167. var self = this;
  168. return self;
  169. }
  170. }),
  171. smalltalk.HLSplitter);
  172. smalltalk.addMethod(
  173. "_with_with_",
  174. smalltalk.method({
  175. selector: "with:with:",
  176. fn: function (aWidget, anotherWidget) {
  177. var self = this;
  178. var $2, $3, $1;
  179. $2 = smalltalk.send(self, "_new", []);
  180. smalltalk.send($2, "_firstWidget_", [aWidget]);
  181. smalltalk.send($2, "_secondWidget_", [anotherWidget]);
  182. $3 = smalltalk.send($2, "_yourself", []);
  183. $1 = $3;
  184. return $1;
  185. }
  186. }),
  187. smalltalk.HLSplitter.klass);
  188. smalltalk.addClass('HLHorizontalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  189. smalltalk.addMethod(
  190. "_cssClass",
  191. smalltalk.method({
  192. selector: "cssClass",
  193. fn: function () {
  194. var self = this;
  195. var $1;
  196. $1 = smalltalk.send(smalltalk.send(self, "_cssClass", [], smalltalk.HLSplitter), "__comma", [" horizontal"]);
  197. return $1;
  198. }
  199. }),
  200. smalltalk.HLHorizontalSplitter);
  201. smalltalk.addMethod(
  202. "_panesCssClass",
  203. smalltalk.method({
  204. selector: "panesCssClass",
  205. fn: function () {
  206. var self = this;
  207. var $1;
  208. $1 = smalltalk.send(smalltalk.send(self, "_panesCssClass", [], smalltalk.HLSplitter), "__comma", [" horizontal"]);
  209. return $1;
  210. }
  211. }),
  212. smalltalk.HLHorizontalSplitter);
  213. smalltalk.addMethod(
  214. "_resize",
  215. smalltalk.method({
  216. selector: "resize",
  217. fn: function () {
  218. var self = this;
  219. smalltalk.send(self, "_resize_", [smalltalk.send(smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_offset", []), "_top", [])]);
  220. return self;
  221. }
  222. }),
  223. smalltalk.HLHorizontalSplitter);
  224. smalltalk.addMethod(
  225. "_resize_",
  226. smalltalk.method({
  227. selector: "resize:",
  228. fn: function (anInteger) {
  229. var self = this;
  230. var container;
  231. var position;
  232. container = smalltalk.send(smalltalk.send(self['@firstPane'], "_asJQuery", []), "_parent", []);
  233. position = smalltalk.send(anInteger, "__minus", [smalltalk.send(smalltalk.send(container, "_offset", []), "_top", [])]);
  234. smalltalk.send(smalltalk.send(self['@firstPane'], "_asJQuery", []), "_height_", [smalltalk.send(smalltalk.send(position, "_min_", [smalltalk.send(smalltalk.send(container, "_height", []), "__minus", [100])]), "_max_", [100])]);
  235. smalltalk.send(smalltalk.send(self['@secondPane'], "_asJQuery", []), "_height_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(container, "_height", []), "__minus", [position]), "_min_", [smalltalk.send(smalltalk.send(container, "_height", []), "__minus", [100])]), "_max_", [100]), "__minus", [6])]);
  236. smalltalk.send(self, "_resize", [], smalltalk.HLSplitter);
  237. return self;
  238. }
  239. }),
  240. smalltalk.HLHorizontalSplitter);
  241. smalltalk.addMethod(
  242. "_setupSplitter",
  243. smalltalk.method({
  244. selector: "setupSplitter",
  245. fn: function () {
  246. var self = this;
  247. smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_draggable_", [smalltalk.HashedCollection._fromPairs_([smalltalk.send("axis", "__minus_gt", ["y"]), smalltalk.send("containment", "__minus_gt", [smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_parent", [])]), smalltalk.send("helper", "__minus_gt", ["clone"]), smalltalk.send("start", "__minus_gt", [function (e, ui) {return smalltalk.send(self, "_startResizing_", [smalltalk.send(ui, "_helper", [])]);}]), smalltalk.send("drag", "__minus_gt", [function (e, ui) {return smalltalk.send(self, "_resize_", [smalltalk.send(smalltalk.send(ui, "_offset", []), "_top", [])]);}])])]);
  248. return self;
  249. }
  250. }),
  251. smalltalk.HLHorizontalSplitter);
  252. smalltalk.addMethod(
  253. "_startResizing_",
  254. smalltalk.method({
  255. selector: "startResizing:",
  256. fn: function (aSplitter) {
  257. var self = this;
  258. smalltalk.send(aSplitter, "_width_", [smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_width", [])]);
  259. return self;
  260. }
  261. }),
  262. smalltalk.HLHorizontalSplitter);
  263. smalltalk.addClass('HLVerticalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  264. smalltalk.addMethod(
  265. "_cssClass",
  266. smalltalk.method({
  267. selector: "cssClass",
  268. fn: function () {
  269. var self = this;
  270. var $1;
  271. $1 = smalltalk.send(smalltalk.send(self, "_cssClass", [], smalltalk.HLSplitter), "__comma", [" vertical"]);
  272. return $1;
  273. }
  274. }),
  275. smalltalk.HLVerticalSplitter);
  276. smalltalk.addMethod(
  277. "_panesCssClass",
  278. smalltalk.method({
  279. selector: "panesCssClass",
  280. fn: function () {
  281. var self = this;
  282. var $1;
  283. $1 = smalltalk.send(smalltalk.send(self, "_panesCssClass", [], smalltalk.HLSplitter), "__comma", [" vertical"]);
  284. return $1;
  285. }
  286. }),
  287. smalltalk.HLVerticalSplitter);
  288. smalltalk.addMethod(
  289. "_resize",
  290. smalltalk.method({
  291. selector: "resize",
  292. fn: function () {
  293. var self = this;
  294. smalltalk.send(self, "_resize_", [smalltalk.send(smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_offset", []), "_left", [])]);
  295. return self;
  296. }
  297. }),
  298. smalltalk.HLVerticalSplitter);
  299. smalltalk.addMethod(
  300. "_resize_",
  301. smalltalk.method({
  302. selector: "resize:",
  303. fn: function (anInteger) {
  304. var self = this;
  305. var container;
  306. var position;
  307. container = smalltalk.send(smalltalk.send(self['@firstPane'], "_asJQuery", []), "_parent", []);
  308. position = smalltalk.send(anInteger, "__minus", [smalltalk.send(smalltalk.send(container, "_offset", []), "_left", [])]);
  309. smalltalk.send(smalltalk.send(self['@firstPane'], "_asJQuery", []), "_width_", [smalltalk.send(smalltalk.send(position, "_min_", [smalltalk.send(smalltalk.send(container, "_width", []), "__minus", [100])]), "_max_", [100])]);
  310. smalltalk.send(smalltalk.send(self['@secondPane'], "_asJQuery", []), "_width_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(container, "_width", []), "__minus", [position]), "_min_", [smalltalk.send(smalltalk.send(container, "_width", []), "__minus", [100])]), "_max_", [100]), "__minus", [6])]);
  311. smalltalk.send(self, "_resize", [], smalltalk.HLSplitter);
  312. return self;
  313. }
  314. }),
  315. smalltalk.HLVerticalSplitter);
  316. smalltalk.addMethod(
  317. "_setupSplitter",
  318. smalltalk.method({
  319. selector: "setupSplitter",
  320. fn: function () {
  321. var self = this;
  322. smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_draggable_", [smalltalk.HashedCollection._fromPairs_([smalltalk.send("axis", "__minus_gt", ["x"]), smalltalk.send("containment", "__minus_gt", [smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_parent", [])]), smalltalk.send("helper", "__minus_gt", ["clone"]), smalltalk.send("start", "__minus_gt", [function (e, ui) {return smalltalk.send(self, "_startResizing_", [smalltalk.send(ui, "_helper", [])]);}]), smalltalk.send("drag", "__minus_gt", [function (e, ui) {return smalltalk.send(self, "_resize_", [smalltalk.send(smalltalk.send(ui, "_offset", []), "_left", [])]);}])])]);
  323. return self;
  324. }
  325. }),
  326. smalltalk.HLVerticalSplitter);
  327. smalltalk.addMethod(
  328. "_startResizing_",
  329. smalltalk.method({
  330. selector: "startResizing:",
  331. fn: function (aSplitter) {
  332. var self = this;
  333. smalltalk.send(aSplitter, "_height_", [smalltalk.send(smalltalk.send(self['@splitter'], "_asJQuery", []), "_height", [])]);
  334. return self;
  335. }
  336. }),
  337. smalltalk.HLVerticalSplitter);
  338. smalltalk.addMethod(
  339. "_isHeliosSplitter",
  340. smalltalk.method({
  341. selector: "isHeliosSplitter",
  342. fn: function () {
  343. var self = this;
  344. return false;
  345. }
  346. }),
  347. smalltalk.Object);