1
0

Helios-Layout.js 19 KB

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