1
0

Helios-Layout.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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,$9,$11,$10,$8,$13,$16,$15,$14,$12,$18,$21,$20,$19,$17;
  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. $9=_st(self["@firstPane"])._asJQuery();
  352. $ctx1.sendIdx["asJQuery"]=3;
  353. $11=_st(percentage)._asString();
  354. $ctx1.sendIdx["asString"]=1;
  355. $10=_st($11).__comma("%");
  356. $ctx1.sendIdx[","]=1;
  357. $8=_st($9)._css_put_("bottom",$10);
  358. $ctx1.sendIdx["css:put:"]=1;
  359. $13=_st(self["@splitter"])._asJQuery();
  360. $ctx1.sendIdx["asJQuery"]=4;
  361. $16=(100).__minus(percentage);
  362. $ctx1.sendIdx["-"]=3;
  363. $15=_st($16)._asString();
  364. $ctx1.sendIdx["asString"]=2;
  365. $14=_st($15).__comma("%");
  366. $ctx1.sendIdx[","]=2;
  367. $12=_st($13)._css_put_("top",$14);
  368. $ctx1.sendIdx["css:put:"]=2;
  369. $18=_st(self["@secondPane"])._asJQuery();
  370. $21=(100).__minus(percentage);
  371. $20=_st($21)._asString();
  372. $19=_st($20).__comma("%");
  373. $17=_st($18)._css_put_("top",$19);
  374. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},smalltalk.HLHorizontalSplitter)})},
  375. args: ["anInteger"],
  376. 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, '%'",
  377. messageSends: ["parent", "asJQuery", "top", "offset", "height", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
  378. referencedClasses: []
  379. }),
  380. smalltalk.HLHorizontalSplitter);
  381. smalltalk.addMethod(
  382. smalltalk.method({
  383. selector: "setupSplitter",
  384. category: 'rendering',
  385. fn: function (){
  386. var self=this;
  387. return smalltalk.withContext(function($ctx1) {
  388. var $1,$3,$6,$5,$4,$7,$8,$9,$2;
  389. $1=_st(self["@splitter"])._asJQuery();
  390. $ctx1.sendIdx["asJQuery"]=1;
  391. $3="axis".__minus_gt("y");
  392. $ctx1.sendIdx["->"]=1;
  393. $6=_st(self["@splitter"])._asJQuery();
  394. $5=_st($6)._parent();
  395. $4="containment".__minus_gt($5);
  396. $ctx1.sendIdx["->"]=2;
  397. $7="helper".__minus_gt("clone");
  398. $ctx1.sendIdx["->"]=3;
  399. $8="start".__minus_gt((function(e,ui){
  400. return smalltalk.withContext(function($ctx2) {
  401. return self._startResizing_(_st(ui)._helper());
  402. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}));
  403. $ctx1.sendIdx["->"]=4;
  404. $9="drag".__minus_gt((function(e,ui){
  405. return smalltalk.withContext(function($ctx2) {
  406. return self._resize_(_st(_st(ui)._offset())._top());
  407. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})}));
  408. $2=smalltalk.HashedCollection._from_([$3,$4,$7,$8,$9]);
  409. _st($1)._draggable_($2);
  410. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},smalltalk.HLHorizontalSplitter)})},
  411. args: [],
  412. 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 ] }",
  413. messageSends: ["draggable:", "asJQuery", "->", "parent", "startResizing:", "helper", "resize:", "top", "offset"],
  414. referencedClasses: []
  415. }),
  416. smalltalk.HLHorizontalSplitter);
  417. smalltalk.addMethod(
  418. smalltalk.method({
  419. selector: "startResizing:",
  420. category: 'actions',
  421. fn: function (aSplitter){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) {
  424. _st(aSplitter)._width_(_st(_st(self["@splitter"])._asJQuery())._width());
  425. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},smalltalk.HLHorizontalSplitter)})},
  426. args: ["aSplitter"],
  427. source: "startResizing: aSplitter\x0a\x09aSplitter width: splitter asJQuery width",
  428. messageSends: ["width:", "width", "asJQuery"],
  429. referencedClasses: []
  430. }),
  431. smalltalk.HLHorizontalSplitter);
  432. smalltalk.addClass('HLVerticalSplitter', smalltalk.HLSplitter, [], 'Helios-Layout');
  433. smalltalk.addMethod(
  434. smalltalk.method({
  435. selector: "cssClass",
  436. category: 'accessing',
  437. fn: function (){
  438. var self=this;
  439. return smalltalk.withContext(function($ctx1) {
  440. var $1;
  441. $1=_st(smalltalk.HLVerticalSplitter.superclass.fn.prototype._cssClass.apply(_st(self), [])).__comma(" vertical");
  442. return $1;
  443. }, function($ctx1) {$ctx1.fill(self,"cssClass",{},smalltalk.HLVerticalSplitter)})},
  444. args: [],
  445. source: "cssClass\x0a\x09^ super cssClass, ' vertical'",
  446. messageSends: [",", "cssClass"],
  447. referencedClasses: []
  448. }),
  449. smalltalk.HLVerticalSplitter);
  450. smalltalk.addMethod(
  451. smalltalk.method({
  452. selector: "panesCssClass",
  453. category: 'accessing',
  454. fn: function (){
  455. var self=this;
  456. return smalltalk.withContext(function($ctx1) {
  457. var $1;
  458. $1=_st(smalltalk.HLVerticalSplitter.superclass.fn.prototype._panesCssClass.apply(_st(self), [])).__comma(" vertical");
  459. return $1;
  460. }, function($ctx1) {$ctx1.fill(self,"panesCssClass",{},smalltalk.HLVerticalSplitter)})},
  461. args: [],
  462. source: "panesCssClass\x0a\x09^ super panesCssClass, ' vertical'",
  463. messageSends: [",", "panesCssClass"],
  464. referencedClasses: []
  465. }),
  466. smalltalk.HLVerticalSplitter);
  467. smalltalk.addMethod(
  468. smalltalk.method({
  469. selector: "resize",
  470. category: 'actions',
  471. fn: function (){
  472. var self=this;
  473. return smalltalk.withContext(function($ctx1) {
  474. self._resize_(_st(_st(self["@splitter"])._asJQuery())._css_("left"));
  475. return self}, function($ctx1) {$ctx1.fill(self,"resize",{},smalltalk.HLVerticalSplitter)})},
  476. args: [],
  477. source: "resize\x0a\x09self resize: (splitter asJQuery css: 'left')",
  478. messageSends: ["resize:", "css:", "asJQuery"],
  479. referencedClasses: []
  480. }),
  481. smalltalk.HLVerticalSplitter);
  482. smalltalk.addMethod(
  483. smalltalk.method({
  484. selector: "resize:",
  485. category: 'actions',
  486. fn: function (anInteger){
  487. var self=this;
  488. var container,size,offset,percentage;
  489. return smalltalk.withContext(function($ctx1) {
  490. var $1,$3,$2,$6,$7,$5,$4,$9,$11,$10,$8,$13,$16,$15,$14,$12,$18,$21,$20,$19,$17;
  491. $1=_st(self["@firstPane"])._asJQuery();
  492. $ctx1.sendIdx["asJQuery"]=1;
  493. container=_st($1)._parent();
  494. $3=_st(self["@firstPane"])._asJQuery();
  495. $ctx1.sendIdx["asJQuery"]=2;
  496. $2=_st($3)._offset();
  497. offset=_st($2)._left();
  498. size=_st(container)._width();
  499. $6=size;
  500. $7=_st(anInteger).__minus(offset);
  501. $ctx1.sendIdx["-"]=2;
  502. $5=_st($6).__minus($7);
  503. $ctx1.sendIdx["-"]=1;
  504. $4=_st($5).__slash(size);
  505. percentage=_st($4).__star((100));
  506. percentage=(80)._min_(_st(percentage)._max_((20)));
  507. $9=_st(self["@firstPane"])._asJQuery();
  508. $ctx1.sendIdx["asJQuery"]=3;
  509. $11=_st(percentage)._asString();
  510. $ctx1.sendIdx["asString"]=1;
  511. $10=_st($11).__comma("%");
  512. $ctx1.sendIdx[","]=1;
  513. $8=_st($9)._css_put_("right",$10);
  514. $ctx1.sendIdx["css:put:"]=1;
  515. $13=_st(self["@splitter"])._asJQuery();
  516. $ctx1.sendIdx["asJQuery"]=4;
  517. $16=(100).__minus(percentage);
  518. $ctx1.sendIdx["-"]=3;
  519. $15=_st($16)._asString();
  520. $ctx1.sendIdx["asString"]=2;
  521. $14=_st($15).__comma("%");
  522. $ctx1.sendIdx[","]=2;
  523. $12=_st($13)._css_put_("left",$14);
  524. $ctx1.sendIdx["css:put:"]=2;
  525. $18=_st(self["@secondPane"])._asJQuery();
  526. $21=(100).__minus(percentage);
  527. $20=_st($21)._asString();
  528. $19=_st($20).__comma("%");
  529. $17=_st($18)._css_put_("left",$19);
  530. return self}, function($ctx1) {$ctx1.fill(self,"resize:",{anInteger:anInteger,container:container,size:size,offset:offset,percentage:percentage},smalltalk.HLVerticalSplitter)})},
  531. args: ["anInteger"],
  532. 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, '%'",
  533. messageSends: ["parent", "asJQuery", "left", "offset", "width", "*", "/", "-", "min:", "max:", "css:put:", ",", "asString"],
  534. referencedClasses: []
  535. }),
  536. smalltalk.HLVerticalSplitter);
  537. smalltalk.addMethod(
  538. smalltalk.method({
  539. selector: "setupSplitter",
  540. category: 'rendering',
  541. fn: function (){
  542. var self=this;
  543. return smalltalk.withContext(function($ctx1) {
  544. var $1,$3,$6,$5,$4,$7,$8,$9,$2;
  545. $1=_st(self["@splitter"])._asJQuery();
  546. $ctx1.sendIdx["asJQuery"]=1;
  547. $3="axis".__minus_gt("x");
  548. $ctx1.sendIdx["->"]=1;
  549. $6=_st(self["@splitter"])._asJQuery();
  550. $5=_st($6)._parent();
  551. $4="containment".__minus_gt($5);
  552. $ctx1.sendIdx["->"]=2;
  553. $7="helper".__minus_gt("clone");
  554. $ctx1.sendIdx["->"]=3;
  555. $8="start".__minus_gt((function(e,ui){
  556. return smalltalk.withContext(function($ctx2) {
  557. return self._startResizing_(_st(ui)._helper());
  558. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,1)})}));
  559. $ctx1.sendIdx["->"]=4;
  560. $9="drag".__minus_gt((function(e,ui){
  561. return smalltalk.withContext(function($ctx2) {
  562. return self._resize_(_st(_st(ui)._offset())._left());
  563. }, function($ctx2) {$ctx2.fillBlock({e:e,ui:ui},$ctx1,2)})}));
  564. $2=smalltalk.HashedCollection._from_([$3,$4,$7,$8,$9]);
  565. _st($1)._draggable_($2);
  566. return self}, function($ctx1) {$ctx1.fill(self,"setupSplitter",{},smalltalk.HLVerticalSplitter)})},
  567. args: [],
  568. 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) ] }",
  569. messageSends: ["draggable:", "asJQuery", "->", "parent", "startResizing:", "helper", "resize:", "left", "offset"],
  570. referencedClasses: []
  571. }),
  572. smalltalk.HLVerticalSplitter);
  573. smalltalk.addMethod(
  574. smalltalk.method({
  575. selector: "startResizing:",
  576. category: 'actions',
  577. fn: function (aSplitter){
  578. var self=this;
  579. return smalltalk.withContext(function($ctx1) {
  580. _st(aSplitter)._height_(_st(_st(self["@splitter"])._asJQuery())._height());
  581. return self}, function($ctx1) {$ctx1.fill(self,"startResizing:",{aSplitter:aSplitter},smalltalk.HLVerticalSplitter)})},
  582. args: ["aSplitter"],
  583. source: "startResizing: aSplitter\x0a\x09aSplitter height: splitter asJQuery height",
  584. messageSends: ["height:", "height", "asJQuery"],
  585. referencedClasses: []
  586. }),
  587. smalltalk.HLVerticalSplitter);
  588. smalltalk.addMethod(
  589. smalltalk.method({
  590. selector: "isHeliosSplitter",
  591. category: '*Helios-Layout',
  592. fn: function (){
  593. var self=this;
  594. return smalltalk.withContext(function($ctx1) {
  595. return false;
  596. }, function($ctx1) {$ctx1.fill(self,"isHeliosSplitter",{},smalltalk.Object)})},
  597. args: [],
  598. source: "isHeliosSplitter\x0a\x09^ false",
  599. messageSends: [],
  600. referencedClasses: []
  601. }),
  602. smalltalk.Object);
  603. });