Helios-Layout.deploy.js 14 KB

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