Helios-Layout.deploy.js 14 KB

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