Helios-Layout.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. define("amber_core/Helios-Layout", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Helios-Core", "amber_core/Canvas", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Helios-Layout');
  3. smalltalk.packages["Helios-Layout"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('HLContainer', smalltalk.HLWidget, ['splitter'], 'Helios-Layout');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "renderOn:",
  8. category: 'rendering',
  9. fn: function (html){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1,$2;
  13. $1=_st(html)._div();
  14. _st($1)._class_("tool_container");
  15. $2=_st($1)._with_(self._splitter());
  16. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.HLContainer)})},
  17. args: ["html"],
  18. source: "renderOn: html\x0a\x09html div \x0a \x09class: 'tool_container'; \x0a with: self splitter",
  19. messageSends: ["class:", "div", "with:", "splitter"],
  20. referencedClasses: []
  21. }),
  22. smalltalk.HLContainer);
  23. smalltalk.addMethod(
  24. smalltalk.method({
  25. selector: "splitter",
  26. category: 'accessing',
  27. fn: function (){
  28. var self=this;
  29. return smalltalk.withContext(function($ctx1) {
  30. var $1;
  31. $1=self["@splitter"];
  32. return $1;
  33. }, function($ctx1) {$ctx1.fill(self,"splitter",{},smalltalk.HLContainer)})},
  34. args: [],
  35. source: "splitter\x0a\x09^ splitter",
  36. messageSends: [],
  37. referencedClasses: []
  38. }),
  39. smalltalk.HLContainer);
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "splitter:",
  43. category: 'accessing',
  44. fn: function (aSplitter){
  45. var self=this;
  46. return smalltalk.withContext(function($ctx1) {
  47. self["@splitter"]=aSplitter;
  48. return self}, function($ctx1) {$ctx1.fill(self,"splitter:",{aSplitter:aSplitter},smalltalk.HLContainer)})},
  49. args: ["aSplitter"],
  50. source: "splitter: aSplitter\x0a\x09splitter := aSplitter",
  51. messageSends: [],
  52. referencedClasses: []
  53. }),
  54. smalltalk.HLContainer);
  55. smalltalk.addMethod(
  56. smalltalk.method({
  57. selector: "with:",
  58. category: 'instance creation',
  59. fn: function (aSplitter){
  60. var self=this;
  61. return smalltalk.withContext(function($ctx1) {
  62. var $2,$3,$1;
  63. $2=self._new();
  64. _st($2)._splitter_(aSplitter);
  65. $3=_st($2)._yourself();
  66. $1=$3;
  67. return $1;
  68. }, function($ctx1) {$ctx1.fill(self,"with:",{aSplitter:aSplitter},smalltalk.HLContainer.klass)})},
  69. args: ["aSplitter"],
  70. source: "with: aSplitter\x0a\x09^ self new \x0a \x09splitter: aSplitter; \x0a yourself",
  71. messageSends: ["splitter:", "new", "yourself"],
  72. referencedClasses: []
  73. }),
  74. smalltalk.HLContainer.klass);
  75. smalltalk.addClass('HLSplitter', smalltalk.Widget, ['firstWidget', 'secondWidget', 'firstPane', 'secondPane', 'splitter'], 'Helios-Layout');
  76. smalltalk.addMethod(
  77. smalltalk.method({
  78. selector: "cssClass",
  79. category: 'accessing',
  80. fn: function (){
  81. var self=this;
  82. return smalltalk.withContext(function($ctx1) {
  83. return "splitter";
  84. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLSplitter)})},
  85. args: [],
  86. source: "cssClass\x0a\x09^ 'splitter'",
  87. messageSends: [],
  88. referencedClasses: []
  89. }),
  90. smalltalk.HLSplitter);
  91. smalltalk.addMethod(
  92. smalltalk.method({
  93. selector: "firstWidget",
  94. category: 'accessing',
  95. fn: function (){
  96. var self=this;
  97. return smalltalk.withContext(function($ctx1) {
  98. var $1;
  99. $1=self["@firstWidget"];
  100. return $1;
  101. }, function($ctx1) {$ctx1.fill(self,"firstWidget",{},smalltalk.HLSplitter)})},
  102. args: [],
  103. source: "firstWidget\x0a\x09^ firstWidget",
  104. messageSends: [],
  105. referencedClasses: []
  106. }),
  107. smalltalk.HLSplitter);
  108. smalltalk.addMethod(
  109. smalltalk.method({
  110. selector: "firstWidget:",
  111. category: 'accessing',
  112. fn: function (aWidget){
  113. var self=this;
  114. return smalltalk.withContext(function($ctx1) {
  115. self["@firstWidget"]=aWidget;
  116. return self}, function($ctx1) {$ctx1.fill(self,"firstWidget:",{aWidget:aWidget},smalltalk.HLSplitter)})},
  117. args: ["aWidget"],
  118. source: "firstWidget: aWidget\x0a\x09firstWidget := aWidget",
  119. messageSends: [],
  120. referencedClasses: []
  121. }),
  122. smalltalk.HLSplitter);
  123. smalltalk.addMethod(
  124. smalltalk.method({
  125. selector: "isHeliosSplitter",
  126. category: 'testing',
  127. fn: function (){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx1) {
  130. return true;
  131. }, function($ctx1) {$ctx1.fill(self,"isHeliosSplitter",{},smalltalk.HLSplitter)})},
  132. args: [],
  133. source: "isHeliosSplitter\x0a\x09^ true",
  134. messageSends: [],
  135. referencedClasses: []
  136. }),
  137. smalltalk.HLSplitter);
  138. smalltalk.addMethod(
  139. smalltalk.method({
  140. selector: "panesCssClass",
  141. category: 'rendering',
  142. fn: function (){
  143. var self=this;
  144. return smalltalk.withContext(function($ctx1) {
  145. return "panes";
  146. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},smalltalk.HLSplitter)})},
  147. args: [],
  148. source: "panesCssClass\x0a\x09^ 'panes'",
  149. messageSends: [],
  150. referencedClasses: []
  151. }),
  152. smalltalk.HLSplitter);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "renderOn:",
  156. category: 'rendering',
  157. fn: function (html){
  158. var self=this;
  159. return smalltalk.withContext(function($ctx1) {
  160. var $1,$3,$4,$5,$6,$7,$2;
  161. $1=_st(html)._div();
  162. $ctx1.sendIdx["div"]=1;
  163. _st($1)._class_(self._panesCssClass());
  164. $ctx1.sendIdx["class:"]=1;
  165. $2=_st($1)._with_((function(){
  166. return smalltalk.withContext(function($ctx2) {
  167. $3=_st(html)._div();
  168. $ctx2.sendIdx["div"]=2;
  169. _st($3)._class_("pane");
  170. $ctx2.sendIdx["class:"]=2;
  171. $4=_st($3)._with_(self._firstWidget());
  172. $ctx2.sendIdx["with:"]=2;
  173. self["@firstPane"]=$4;
  174. self["@firstPane"];
  175. $5=_st(html)._div();
  176. $ctx2.sendIdx["div"]=3;
  177. self["@splitter"]=_st($5)._class_(self._cssClass());
  178. $ctx2.sendIdx["class:"]=3;
  179. self["@splitter"];
  180. $6=_st(html)._div();
  181. _st($6)._class_("pane");
  182. $7=_st($6)._with_(self._secondWidget());
  183. self["@secondPane"]=$7;
  184. return self["@secondPane"];
  185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  186. $ctx1.sendIdx["with:"]=1;
  187. self._setupSplitter();
  188. return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{html:html},smalltalk.HLSplitter)})},
  189. args: ["html"],
  190. source: "renderOn: html\x0a\x09html div class: self panesCssClass; with: [\x0a\x09\x09firstPane := html div class: 'pane'; with: self firstWidget.\x0a \x09splitter := html div class: self cssClass.\x0a \x09secondPane := html div class: 'pane'; with: self secondWidget ].\x0a \x0a\x09self setupSplitter",
  191. messageSends: ["class:", "div", "panesCssClass", "with:", "firstWidget", "cssClass", "secondWidget", "setupSplitter"],
  192. referencedClasses: []
  193. }),
  194. smalltalk.HLSplitter);
  195. smalltalk.addMethod(
  196. smalltalk.method({
  197. selector: "resize",
  198. category: 'rendering',
  199. fn: function (){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) {
  202. return self}, function($ctx1) {$ctx1.fill(self,"resize",{},smalltalk.HLSplitter)})},
  203. args: [],
  204. source: "resize",
  205. messageSends: [],
  206. referencedClasses: []
  207. }),
  208. smalltalk.HLSplitter);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "secondWidget",
  212. category: 'accessing',
  213. fn: function (){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. var $1;
  217. $1=self["@secondWidget"];
  218. return $1;
  219. }, function($ctx1) {$ctx1.fill(self,"secondWidget",{},smalltalk.HLSplitter)})},
  220. args: [],
  221. source: "secondWidget\x0a\x09^ secondWidget",
  222. messageSends: [],
  223. referencedClasses: []
  224. }),
  225. smalltalk.HLSplitter);
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "secondWidget:",
  229. category: 'accessing',
  230. fn: function (aWidget){
  231. var self=this;
  232. return smalltalk.withContext(function($ctx1) {
  233. self["@secondWidget"]=aWidget;
  234. return self}, function($ctx1) {$ctx1.fill(self,"secondWidget:",{aWidget:aWidget},smalltalk.HLSplitter)})},
  235. args: ["aWidget"],
  236. source: "secondWidget: aWidget\x0a\x09secondWidget := aWidget",
  237. messageSends: [],
  238. referencedClasses: []
  239. }),
  240. smalltalk.HLSplitter);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "setupSplitter",
  244. category: 'rendering',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},smalltalk.HLSplitter)})},
  249. args: [],
  250. source: "setupSplitter",
  251. messageSends: [],
  252. referencedClasses: []
  253. }),
  254. smalltalk.HLSplitter);
  255. smalltalk.addMethod(
  256. smalltalk.method({
  257. selector: "with:with:",
  258. category: 'instance creation',
  259. fn: function (aWidget,anotherWidget){
  260. var self=this;
  261. return smalltalk.withContext(function($ctx1) {
  262. var $2,$3,$1;
  263. $2=self._new();
  264. _st($2)._firstWidget_(aWidget);
  265. _st($2)._secondWidget_(anotherWidget);
  266. $3=_st($2)._yourself();
  267. $1=$3;
  268. return $1;
  269. }, function($ctx1) {$ctx1.fill(self,"with:with:",{aWidget:aWidget,anotherWidget:anotherWidget},smalltalk.HLSplitter.klass)})},
  270. args: ["aWidget", "anotherWidget"],
  271. source: "with: aWidget with: anotherWidget\x0a\x09^ self new\x0a \x09\x09firstWidget: aWidget;\x0a secondWidget: anotherWidget;\x0a yourself",
  272. messageSends: ["firstWidget:", "new", "secondWidget:", "yourself"],
  273. referencedClasses: []
  274. }),
  275. smalltalk.HLSplitter.klass);
  276. smalltalk.addClass('HLHorizontalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  277. smalltalk.addMethod(
  278. smalltalk.method({
  279. selector: "cssClass",
  280. category: 'accessing',
  281. fn: function (){
  282. var self=this;
  283. return smalltalk.withContext(function($ctx1) {
  284. var $1;
  285. $1=_st(smalltalk.HLHorizontalSplitter.superclass.fn.prototype._cssClass.apply(_st(self), [])).__comma(" horizontal");
  286. return $1;
  287. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLHorizontalSplitter)})},
  288. args: [],
  289. source: "cssClass\x0a\x09^ super cssClass, ' horizontal'",
  290. messageSends: [",", "cssClass"],
  291. referencedClasses: []
  292. }),
  293. smalltalk.HLHorizontalSplitter);
  294. smalltalk.addMethod(
  295. smalltalk.method({
  296. selector: "panesCssClass",
  297. category: 'accessing',
  298. fn: function (){
  299. var self=this;
  300. return smalltalk.withContext(function($ctx1) {
  301. var $1;
  302. $1=_st(smalltalk.HLHorizontalSplitter.superclass.fn.prototype._panesCssClass.apply(_st(self), [])).__comma(" horizontal");
  303. return $1;
  304. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},smalltalk.HLHorizontalSplitter)})},
  305. args: [],
  306. source: "panesCssClass\x0a\x09^ super panesCssClass, ' horizontal'",
  307. messageSends: [",", "panesCssClass"],
  308. referencedClasses: []
  309. }),
  310. smalltalk.HLHorizontalSplitter);
  311. smalltalk.addMethod(
  312. smalltalk.method({
  313. selector: "resize",
  314. category: 'actions',
  315. fn: function (){
  316. var self=this;
  317. return smalltalk.withContext(function($ctx1) {
  318. self._resize_(_st(_st(self["@splitter"])._asJQuery())._css_("top"));
  319. return self}, function($ctx1) {$ctx1.fill(self,"resize",{},smalltalk.HLHorizontalSplitter)})},
  320. args: [],
  321. source: "resize\x0a\x09self resize: (splitter asJQuery css: 'top')",
  322. messageSends: ["resize:", "css:", "asJQuery"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.HLHorizontalSplitter);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "resize:",
  329. category: 'actions',
  330. fn: function (anInteger){
  331. var self=this;
  332. var container,size,offset,percentage;
  333. return smalltalk.withContext(function($ctx1) {
  334. var $1,$3,$2,$6,$7,$5,$4,$8,$10,$9,$11,$14,$13,$12;
  335. $1=_st(self["@firstPane"])._asJQuery();
  336. $ctx1.sendIdx["asJQuery"]=1;
  337. container=_st($1)._parent();
  338. $3=_st(self["@firstPane"])._asJQuery();
  339. $ctx1.sendIdx["asJQuery"]=2;
  340. $2=_st($3)._offset();
  341. offset=_st($2)._top();
  342. size=_st(container)._height();
  343. $6=size;
  344. $7=_st(anInteger).__minus(offset);
  345. $ctx1.sendIdx["-"]=2;
  346. $5=_st($6).__minus($7);
  347. $ctx1.sendIdx["-"]=1;
  348. $4=_st($5).__slash(size);
  349. percentage=_st($4).__star((100));
  350. percentage=(80)._min_(_st(percentage)._max_((20)));
  351. $8=_st(self["@firstPane"])._asJQuery();
  352. $ctx1.sendIdx["asJQuery"]=3;
  353. $10=_st(percentage)._asString();
  354. $ctx1.sendIdx["asString"]=1;
  355. $9=_st($10).__comma("%");
  356. $ctx1.sendIdx[","]=1;
  357. _st($8)._css_put_("bottom",$9);
  358. $ctx1.sendIdx["css:put:"]=1;
  359. $11=_st(self["@splitter"])._asJQuery();
  360. $ctx1.sendIdx["asJQuery"]=4;
  361. $14=(100).__minus(percentage);
  362. $ctx1.sendIdx["-"]=3;
  363. $13=_st($14)._asString();
  364. $ctx1.sendIdx["asString"]=2;
  365. $12=_st($13).__comma("%");
  366. $ctx1.sendIdx[","]=2;
  367. _st($11)._css_put_("top",$12);
  368. $ctx1.sendIdx["css:put:"]=2;
  369. _st(_st(self["@secondPane"])._asJQuery())._css_put_("top",_st(_st((100).__minus(percentage))._asString()).__comma("%"));
  370. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},smalltalk.HLHorizontalSplitter)})},
  371. args: ["anInteger"],
  372. source: "resize: anInteger\x0a\x09| container size offset percentage |\x0a \x0a container := firstPane asJQuery parent.\x0a\x09offset := firstPane asJQuery offset top.\x0a size := container height.\x0a\x09\x0a\x09percentage := (size - (anInteger - offset)) / size * 100.\x0a\x09percentage := 80 min: (percentage max: 20).\x0a\x09\x0a firstPane asJQuery css: 'bottom' put: percentage asString, '%'.\x0a\x09\x0a\x09splitter asJQuery css: 'top' put: (100 - percentage) asString, '%'.\x0a\x09secondPane asJQuery css: 'top' put: (100 - percentage) asString, '%'",
  373. messageSends: ["parent", "asJQuery", "top", "offset", "height", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
  374. referencedClasses: []
  375. }),
  376. smalltalk.HLHorizontalSplitter);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "setupSplitter",
  380. category: 'rendering',
  381. fn: function (){
  382. var self=this;
  383. return smalltalk.withContext(function($ctx1) {
  384. var $1,$3,$4,$5,$6,$2;
  385. $1=_st(self["@splitter"])._asJQuery();
  386. $ctx1.sendIdx["asJQuery"]=1;
  387. $3="axis".__minus_gt("y");
  388. $ctx1.sendIdx["->"]=1;
  389. $4="containment".__minus_gt(_st(_st(self["@splitter"])._asJQuery())._parent());
  390. $ctx1.sendIdx["->"]=2;
  391. $5="helper".__minus_gt("clone");
  392. $ctx1.sendIdx["->"]=3;
  393. $6="start".__minus_gt((function(e,ui){
  394. return smalltalk.withContext(function($ctx2) {
  395. return self._startResizing_(_st(ui)._helper());
  396. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}));
  397. $ctx1.sendIdx["->"]=4;
  398. $2=smalltalk.HashedCollection._from_([$3,$4,$5,$6,"drag".__minus_gt((function(e,ui){
  399. return smalltalk.withContext(function($ctx2) {
  400. return self._resize_(_st(_st(ui)._offset())._top());
  401. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})}))]);
  402. _st($1)._draggable_($2);
  403. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},smalltalk.HLHorizontalSplitter)})},
  404. args: [],
  405. source: "setupSplitter\x0a\x09splitter asJQuery draggable: #{ \x0a \x09'axis' -> 'y'. \x0a 'containment' -> splitter asJQuery parent.\x0a 'helper' -> 'clone'.\x0a 'start' -> [ :e :ui | self startResizing: ui helper ].\x0a 'drag' -> [ :e :ui | self resize: ui offset top ] }",
  406. messageSends: ["draggable:", "asJQuery", "->", "parent", "startResizing:", "helper", "resize:", "top", "offset"],
  407. referencedClasses: []
  408. }),
  409. smalltalk.HLHorizontalSplitter);
  410. smalltalk.addMethod(
  411. smalltalk.method({
  412. selector: "startResizing:",
  413. category: 'actions',
  414. fn: function (aSplitter){
  415. var self=this;
  416. return smalltalk.withContext(function($ctx1) {
  417. _st(aSplitter)._width_(_st(_st(self["@splitter"])._asJQuery())._width());
  418. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},smalltalk.HLHorizontalSplitter)})},
  419. args: ["aSplitter"],
  420. source: "startResizing: aSplitter\x0a\x09aSplitter width: splitter asJQuery width",
  421. messageSends: ["width:", "width", "asJQuery"],
  422. referencedClasses: []
  423. }),
  424. smalltalk.HLHorizontalSplitter);
  425. smalltalk.addClass('HLVerticalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  426. smalltalk.addMethod(
  427. smalltalk.method({
  428. selector: "cssClass",
  429. category: 'accessing',
  430. fn: function (){
  431. var self=this;
  432. return smalltalk.withContext(function($ctx1) {
  433. var $1;
  434. $1=_st(smalltalk.HLVerticalSplitter.superclass.fn.prototype._cssClass.apply(_st(self), [])).__comma(" vertical");
  435. return $1;
  436. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLVerticalSplitter)})},
  437. args: [],
  438. source: "cssClass\x0a\x09^ super cssClass, ' vertical'",
  439. messageSends: [",", "cssClass"],
  440. referencedClasses: []
  441. }),
  442. smalltalk.HLVerticalSplitter);
  443. smalltalk.addMethod(
  444. smalltalk.method({
  445. selector: "panesCssClass",
  446. category: 'accessing',
  447. fn: function (){
  448. var self=this;
  449. return smalltalk.withContext(function($ctx1) {
  450. var $1;
  451. $1=_st(smalltalk.HLVerticalSplitter.superclass.fn.prototype._panesCssClass.apply(_st(self), [])).__comma(" vertical");
  452. return $1;
  453. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},smalltalk.HLVerticalSplitter)})},
  454. args: [],
  455. source: "panesCssClass\x0a\x09^ super panesCssClass, ' vertical'",
  456. messageSends: [",", "panesCssClass"],
  457. referencedClasses: []
  458. }),
  459. smalltalk.HLVerticalSplitter);
  460. smalltalk.addMethod(
  461. smalltalk.method({
  462. selector: "resize",
  463. category: 'actions',
  464. fn: function (){
  465. var self=this;
  466. return smalltalk.withContext(function($ctx1) {
  467. self._resize_(_st(_st(self["@splitter"])._asJQuery())._css_("left"));
  468. return self}, function($ctx1) {$ctx1.fill(self,"resize",{},smalltalk.HLVerticalSplitter)})},
  469. args: [],
  470. source: "resize\x0a\x09self resize: (splitter asJQuery css: 'left')",
  471. messageSends: ["resize:", "css:", "asJQuery"],
  472. referencedClasses: []
  473. }),
  474. smalltalk.HLVerticalSplitter);
  475. smalltalk.addMethod(
  476. smalltalk.method({
  477. selector: "resize:",
  478. category: 'actions',
  479. fn: function (anInteger){
  480. var self=this;
  481. var container,size,offset,percentage;
  482. return smalltalk.withContext(function($ctx1) {
  483. var $1,$3,$2,$6,$7,$5,$4,$8,$10,$9,$11,$14,$13,$12;
  484. $1=_st(self["@firstPane"])._asJQuery();
  485. $ctx1.sendIdx["asJQuery"]=1;
  486. container=_st($1)._parent();
  487. $3=_st(self["@firstPane"])._asJQuery();
  488. $ctx1.sendIdx["asJQuery"]=2;
  489. $2=_st($3)._offset();
  490. offset=_st($2)._left();
  491. size=_st(container)._width();
  492. $6=size;
  493. $7=_st(anInteger).__minus(offset);
  494. $ctx1.sendIdx["-"]=2;
  495. $5=_st($6).__minus($7);
  496. $ctx1.sendIdx["-"]=1;
  497. $4=_st($5).__slash(size);
  498. percentage=_st($4).__star((100));
  499. percentage=(80)._min_(_st(percentage)._max_((20)));
  500. $8=_st(self["@firstPane"])._asJQuery();
  501. $ctx1.sendIdx["asJQuery"]=3;
  502. $10=_st(percentage)._asString();
  503. $ctx1.sendIdx["asString"]=1;
  504. $9=_st($10).__comma("%");
  505. $ctx1.sendIdx[","]=1;
  506. _st($8)._css_put_("right",$9);
  507. $ctx1.sendIdx["css:put:"]=1;
  508. $11=_st(self["@splitter"])._asJQuery();
  509. $ctx1.sendIdx["asJQuery"]=4;
  510. $14=(100).__minus(percentage);
  511. $ctx1.sendIdx["-"]=3;
  512. $13=_st($14)._asString();
  513. $ctx1.sendIdx["asString"]=2;
  514. $12=_st($13).__comma("%");
  515. $ctx1.sendIdx[","]=2;
  516. _st($11)._css_put_("left",$12);
  517. $ctx1.sendIdx["css:put:"]=2;
  518. _st(_st(self["@secondPane"])._asJQuery())._css_put_("left",_st(_st((100).__minus(percentage))._asString()).__comma("%"));
  519. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},smalltalk.HLVerticalSplitter)})},
  520. args: ["anInteger"],
  521. source: "resize: anInteger\x0a\x09| container size offset percentage |\x0a \x0a container := firstPane asJQuery parent.\x0a\x09offset := firstPane asJQuery offset left.\x0a size := container width.\x0a\x09\x0a\x09percentage := (size - (anInteger - offset)) / size * 100.\x0a\x09percentage := 80 min: (percentage max: 20).\x0a\x09\x0a firstPane asJQuery css: 'right' put: percentage asString, '%'.\x0a\x09\x0a\x09splitter asJQuery css: 'left' put: (100 - percentage) asString, '%'.\x0a\x09secondPane asJQuery css: 'left' put: (100 - percentage) asString, '%'",
  522. messageSends: ["parent", "asJQuery", "left", "offset", "width", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
  523. referencedClasses: []
  524. }),
  525. smalltalk.HLVerticalSplitter);
  526. smalltalk.addMethod(
  527. smalltalk.method({
  528. selector: "setupSplitter",
  529. category: 'rendering',
  530. fn: function (){
  531. var self=this;
  532. return smalltalk.withContext(function($ctx1) {
  533. var $1,$3,$4,$5,$6,$2;
  534. $1=_st(self["@splitter"])._asJQuery();
  535. $ctx1.sendIdx["asJQuery"]=1;
  536. $3="axis".__minus_gt("x");
  537. $ctx1.sendIdx["->"]=1;
  538. $4="containment".__minus_gt(_st(_st(self["@splitter"])._asJQuery())._parent());
  539. $ctx1.sendIdx["->"]=2;
  540. $5="helper".__minus_gt("clone");
  541. $ctx1.sendIdx["->"]=3;
  542. $6="start".__minus_gt((function(e,ui){
  543. return smalltalk.withContext(function($ctx2) {
  544. return self._startResizing_(_st(ui)._helper());
  545. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}));
  546. $ctx1.sendIdx["->"]=4;
  547. $2=smalltalk.HashedCollection._from_([$3,$4,$5,$6,"drag".__minus_gt((function(e,ui){
  548. return smalltalk.withContext(function($ctx2) {
  549. return self._resize_(_st(_st(ui)._offset())._left());
  550. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})}))]);
  551. _st($1)._draggable_($2);
  552. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},smalltalk.HLVerticalSplitter)})},
  553. args: [],
  554. source: "setupSplitter\x0a\x09splitter asJQuery draggable: #{ \x0a \x09'axis' -> 'x'. \x0a 'containment' -> splitter asJQuery parent.\x0a 'helper' -> 'clone'.\x0a 'start' -> [ :e :ui | self startResizing: ui helper ].\x0a 'drag' -> [ :e :ui | self resize: (ui offset left) ] }",
  555. messageSends: ["draggable:", "asJQuery", "->", "parent", "startResizing:", "helper", "resize:", "left", "offset"],
  556. referencedClasses: []
  557. }),
  558. smalltalk.HLVerticalSplitter);
  559. smalltalk.addMethod(
  560. smalltalk.method({
  561. selector: "startResizing:",
  562. category: 'actions',
  563. fn: function (aSplitter){
  564. var self=this;
  565. return smalltalk.withContext(function($ctx1) {
  566. _st(aSplitter)._height_(_st(_st(self["@splitter"])._asJQuery())._height());
  567. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},smalltalk.HLVerticalSplitter)})},
  568. args: ["aSplitter"],
  569. source: "startResizing: aSplitter\x0a\x09aSplitter height: splitter asJQuery height",
  570. messageSends: ["height:", "height", "asJQuery"],
  571. referencedClasses: []
  572. }),
  573. smalltalk.HLVerticalSplitter);
  574. smalltalk.addMethod(
  575. smalltalk.method({
  576. selector: "isHeliosSplitter",
  577. category: '*Helios-Layout',
  578. fn: function (){
  579. var self=this;
  580. return smalltalk.withContext(function($ctx1) {
  581. return false;
  582. }, function($ctx1) {$ctx1.fill(self,"isHeliosSplitter",{},smalltalk.Object)})},
  583. args: [],
  584. source: "isHeliosSplitter\x0a\x09^ false",
  585. messageSends: [],
  586. referencedClasses: []
  587. }),
  588. smalltalk.Object);
  589. });