Moka-Layouts.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. define("amber_core/Moka-Layouts", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Layouts');
  3. smalltalk.packages["Moka-Layouts"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKLayout', smalltalk.Object, ['properties'], 'Moka-Layouts');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "asCssString",
  8. category: 'converting',
  9. fn: function (){
  10. var self=this;
  11. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  12. return smalltalk.withContext(function($ctx1) {
  13. var $1;
  14. $1=_st($String())._streamContents_((function(stream){
  15. return smalltalk.withContext(function($ctx2) {
  16. return _st(self["@properties"])._valuesDo_((function(each){
  17. return smalltalk.withContext(function($ctx3) {
  18. _st(each)._printCssOn_(stream);
  19. return _st(stream).__lt_lt(";");
  20. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)})}));
  21. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  22. return $1;
  23. }, function($ctx1) {$ctx1.fill(self,"asCssString",{},smalltalk.MKLayout)})},
  24. args: [],
  25. source: "asCssString\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09properties valuesDo: [ :each | \x0a\x09\x09\x09each printCssOn: stream.\x0a\x09\x09\x09stream << ';' ] ]",
  26. messageSends: ["streamContents:", "valuesDo:", "printCssOn:", "<<"],
  27. referencedClasses: ["String"]
  28. }),
  29. smalltalk.MKLayout);
  30. smalltalk.addMethod(
  31. smalltalk.method({
  32. selector: "bottom:",
  33. category: 'accessing',
  34. fn: function (aNumber){
  35. var self=this;
  36. return smalltalk.withContext(function($ctx1) {
  37. var $1;
  38. _st(self["@properties"])._at_put_("bottom",self._propertyLabelled_value_("bottom",aNumber));
  39. $1=self._hasProperty_("top");
  40. if(smalltalk.assert($1)){
  41. self._removeProperty_("height");
  42. $ctx1.sendIdx["removeProperty:"]=1;
  43. };
  44. self._removeProperty_("centerY");
  45. return self}, function($ctx1) {$ctx1.fill(self,"bottom:",{aNumber:aNumber},smalltalk.MKLayout)})},
  46. args: ["aNumber"],
  47. source: "bottom: aNumber\x0a\x09properties \x0a\x09\x09at: 'bottom' \x0a\x09\x09put: (self propertyLabelled: 'bottom' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'top') ifTrue: [\x0a\x09\x09self removeProperty: 'height' ].\x0a\x09self removeProperty: 'centerY'",
  48. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  49. referencedClasses: []
  50. }),
  51. smalltalk.MKLayout);
  52. smalltalk.addMethod(
  53. smalltalk.method({
  54. selector: "centerX:",
  55. category: 'accessing',
  56. fn: function (aNumber){
  57. var self=this;
  58. function $MKHorizontalCenteringLayoutProperty(){return smalltalk.MKHorizontalCenteringLayoutProperty||(typeof MKHorizontalCenteringLayoutProperty=="undefined"?nil:MKHorizontalCenteringLayoutProperty)}
  59. return smalltalk.withContext(function($ctx1) {
  60. var $1;
  61. _st(self["@properties"])._at_put_("centerX",_st($MKHorizontalCenteringLayoutProperty())._layout_value_(self,aNumber));
  62. self._removeProperty_("left");
  63. $ctx1.sendIdx["removeProperty:"]=1;
  64. $1=self._removeProperty_("right");
  65. return self}, function($ctx1) {$ctx1.fill(self,"centerX:",{aNumber:aNumber},smalltalk.MKLayout)})},
  66. args: ["aNumber"],
  67. source: "centerX: aNumber\x0a\x09properties\x0a\x09\x09at: 'centerX'\x0a\x09\x09put: (MKHorizontalCenteringLayoutProperty layout: self value: aNumber).\x0a\x09\x0a\x09self \x0a\x09\x09removeProperty: 'left';\x0a\x09\x09removeProperty: 'right'",
  68. messageSends: ["at:put:", "layout:value:", "removeProperty:"],
  69. referencedClasses: ["MKHorizontalCenteringLayoutProperty"]
  70. }),
  71. smalltalk.MKLayout);
  72. smalltalk.addMethod(
  73. smalltalk.method({
  74. selector: "centerY:",
  75. category: 'accessing',
  76. fn: function (aNumber){
  77. var self=this;
  78. function $MKVerticalCenteringLayoutProperty(){return smalltalk.MKVerticalCenteringLayoutProperty||(typeof MKVerticalCenteringLayoutProperty=="undefined"?nil:MKVerticalCenteringLayoutProperty)}
  79. return smalltalk.withContext(function($ctx1) {
  80. var $1;
  81. _st(self["@properties"])._at_put_("centerY",_st($MKVerticalCenteringLayoutProperty())._layout_value_(self,aNumber));
  82. self._removeProperty_("top");
  83. $ctx1.sendIdx["removeProperty:"]=1;
  84. $1=self._removeProperty_("bottom");
  85. return self}, function($ctx1) {$ctx1.fill(self,"centerY:",{aNumber:aNumber},smalltalk.MKLayout)})},
  86. args: ["aNumber"],
  87. source: "centerY: aNumber\x0a\x09properties\x0a\x09\x09at: 'centerY'\x0a\x09\x09put: (MKVerticalCenteringLayoutProperty layout: self value: aNumber).\x0a\x09\x09\x0a\x09self \x0a\x09\x09removeProperty: 'top';\x0a\x09\x09removeProperty: 'bottom'",
  88. messageSends: ["at:put:", "layout:value:", "removeProperty:"],
  89. referencedClasses: ["MKVerticalCenteringLayoutProperty"]
  90. }),
  91. smalltalk.MKLayout);
  92. smalltalk.addMethod(
  93. smalltalk.method({
  94. selector: "hasProperty:",
  95. category: 'private',
  96. fn: function (aString){
  97. var self=this;
  98. return smalltalk.withContext(function($ctx1) {
  99. var $1;
  100. $1=_st(self["@properties"])._includesKey_(aString);
  101. return $1;
  102. }, function($ctx1) {$ctx1.fill(self,"hasProperty:",{aString:aString},smalltalk.MKLayout)})},
  103. args: ["aString"],
  104. source: "hasProperty: aString\x0a\x09^ properties includesKey: aString",
  105. messageSends: ["includesKey:"],
  106. referencedClasses: []
  107. }),
  108. smalltalk.MKLayout);
  109. smalltalk.addMethod(
  110. smalltalk.method({
  111. selector: "height",
  112. category: 'accessing',
  113. fn: function (){
  114. var self=this;
  115. return smalltalk.withContext(function($ctx1) {
  116. var $1;
  117. $1=_st(self["@properties"])._at_ifPresent_ifAbsent_("height",(function(property){
  118. return smalltalk.withContext(function($ctx2) {
  119. return _st(property)._value();
  120. }, function($ctx2) {$ctx2.fillBlock({property:property},$ctx1,1)})}),(function(){
  121. return smalltalk.withContext(function($ctx2) {
  122. return (1);
  123. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  124. return $1;
  125. }, function($ctx1) {$ctx1.fill(self,"height",{},smalltalk.MKLayout)})},
  126. args: [],
  127. source: "height\x0a\x09^ properties \x0a\x09\x09at: 'height' \x0a\x09\x09ifPresent: [ :property | property value ]\x0a\x09\x09ifAbsent: [ 1 ]",
  128. messageSends: ["at:ifPresent:ifAbsent:", "value"],
  129. referencedClasses: []
  130. }),
  131. smalltalk.MKLayout);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "height:",
  135. category: 'accessing',
  136. fn: function (aNumber){
  137. var self=this;
  138. return smalltalk.withContext(function($ctx1) {
  139. var $1;
  140. _st(self["@properties"])._at_put_("height",self._propertyLabelled_value_("height",aNumber));
  141. $1=self._hasProperty_("top");
  142. if(smalltalk.assert($1)){
  143. self._removeProperty_("bottom");
  144. };
  145. return self}, function($ctx1) {$ctx1.fill(self,"height:",{aNumber:aNumber},smalltalk.MKLayout)})},
  146. args: ["aNumber"],
  147. source: "height: aNumber\x0a\x09properties \x0a\x09\x09at: 'height' \x0a\x09\x09put: (self propertyLabelled: 'height' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'top') ifTrue: [\x0a\x09\x09self removeProperty: 'bottom' ]",
  148. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  149. referencedClasses: []
  150. }),
  151. smalltalk.MKLayout);
  152. smalltalk.addMethod(
  153. smalltalk.method({
  154. selector: "initialize",
  155. category: 'initialization',
  156. fn: function (){
  157. var self=this;
  158. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  159. return smalltalk.withContext(function($ctx1) {
  160. smalltalk.MKLayout.superclass.fn.prototype._initialize.apply(_st(self), []);
  161. self["@properties"]=_st($Dictionary())._new();
  162. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.MKLayout)})},
  163. args: [],
  164. source: "initialize\x0a\x09super initialize.\x0a\x09properties := Dictionary new",
  165. messageSends: ["initialize", "new"],
  166. referencedClasses: ["Dictionary"]
  167. }),
  168. smalltalk.MKLayout);
  169. smalltalk.addMethod(
  170. smalltalk.method({
  171. selector: "left:",
  172. category: 'accessing',
  173. fn: function (aNumber){
  174. var self=this;
  175. return smalltalk.withContext(function($ctx1) {
  176. var $1;
  177. _st(self["@properties"])._at_put_("left",self._propertyLabelled_value_("left",aNumber));
  178. $1=self._hasProperty_("width");
  179. if(smalltalk.assert($1)){
  180. self._removeProperty_("right");
  181. $ctx1.sendIdx["removeProperty:"]=1;
  182. };
  183. self._removeProperty_("centerX");
  184. return self}, function($ctx1) {$ctx1.fill(self,"left:",{aNumber:aNumber},smalltalk.MKLayout)})},
  185. args: ["aNumber"],
  186. source: "left: aNumber\x0a\x09properties \x0a\x09\x09at: 'left' \x0a\x09\x09put: (self propertyLabelled: 'left' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'width') ifTrue: [\x0a\x09\x09self removeProperty: 'right' ].\x0a\x09self removeProperty: 'centerX'",
  187. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  188. referencedClasses: []
  189. }),
  190. smalltalk.MKLayout);
  191. smalltalk.addMethod(
  192. smalltalk.method({
  193. selector: "propertyLabelled:value:",
  194. category: 'factory',
  195. fn: function (aString,aValue){
  196. var self=this;
  197. function $MKLabelledLayoutProperty(){return smalltalk.MKLabelledLayoutProperty||(typeof MKLabelledLayoutProperty=="undefined"?nil:MKLabelledLayoutProperty)}
  198. return smalltalk.withContext(function($ctx1) {
  199. var $1;
  200. $1=_st($MKLabelledLayoutProperty())._layout_label_value_(self,aString,aValue);
  201. return $1;
  202. }, function($ctx1) {$ctx1.fill(self,"propertyLabelled:value:",{aString:aString,aValue:aValue},smalltalk.MKLayout)})},
  203. args: ["aString", "aValue"],
  204. source: "propertyLabelled: aString value: aValue\x0a\x09^ MKLabelledLayoutProperty layout: self label: aString value: aValue",
  205. messageSends: ["layout:label:value:"],
  206. referencedClasses: ["MKLabelledLayoutProperty"]
  207. }),
  208. smalltalk.MKLayout);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "removeProperty:",
  212. category: 'private',
  213. fn: function (aString){
  214. var self=this;
  215. return smalltalk.withContext(function($ctx1) {
  216. _st(self["@properties"])._remove_ifAbsent_(aString,(function(){
  217. return smalltalk.withContext(function($ctx2) {
  218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  219. return self}, function($ctx1) {$ctx1.fill(self,"removeProperty:",{aString:aString},smalltalk.MKLayout)})},
  220. args: ["aString"],
  221. source: "removeProperty: aString\x0a\x09properties remove: aString ifAbsent: []",
  222. messageSends: ["remove:ifAbsent:"],
  223. referencedClasses: []
  224. }),
  225. smalltalk.MKLayout);
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "right:",
  229. category: 'accessing',
  230. fn: function (aNumber){
  231. var self=this;
  232. return smalltalk.withContext(function($ctx1) {
  233. var $1;
  234. _st(self["@properties"])._at_put_("right",self._propertyLabelled_value_("right",aNumber));
  235. $1=self._hasProperty_("width");
  236. if(smalltalk.assert($1)){
  237. self._removeProperty_("left");
  238. $ctx1.sendIdx["removeProperty:"]=1;
  239. };
  240. self._removeProperty_("centerX");
  241. return self}, function($ctx1) {$ctx1.fill(self,"right:",{aNumber:aNumber},smalltalk.MKLayout)})},
  242. args: ["aNumber"],
  243. source: "right: aNumber\x0a\x09properties \x0a\x09\x09at: 'right' \x0a\x09\x09put: (self propertyLabelled: 'right' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'width') ifTrue: [\x0a\x09\x09self removeProperty: 'left' ].\x0a\x09self removeProperty: 'centerX'",
  244. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  245. referencedClasses: []
  246. }),
  247. smalltalk.MKLayout);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "top:",
  251. category: 'accessing',
  252. fn: function (aNumber){
  253. var self=this;
  254. return smalltalk.withContext(function($ctx1) {
  255. var $1;
  256. _st(self["@properties"])._at_put_("top",self._propertyLabelled_value_("top",aNumber));
  257. $1=self._hasProperty_("height");
  258. if(smalltalk.assert($1)){
  259. self._removeProperty_("bottom");
  260. $ctx1.sendIdx["removeProperty:"]=1;
  261. };
  262. self._removeProperty_("centerY");
  263. return self}, function($ctx1) {$ctx1.fill(self,"top:",{aNumber:aNumber},smalltalk.MKLayout)})},
  264. args: ["aNumber"],
  265. source: "top: aNumber\x0a\x09properties \x0a\x09\x09at: 'top' \x0a\x09\x09put: (self propertyLabelled: 'top' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'height') ifTrue: [\x0a\x09\x09self removeProperty: 'bottom' ].\x0a\x09self removeProperty: 'centerY'",
  266. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  267. referencedClasses: []
  268. }),
  269. smalltalk.MKLayout);
  270. smalltalk.addMethod(
  271. smalltalk.method({
  272. selector: "width",
  273. category: 'accessing',
  274. fn: function (){
  275. var self=this;
  276. return smalltalk.withContext(function($ctx1) {
  277. var $1;
  278. $1=_st(self["@properties"])._at_ifPresent_ifAbsent_("width",(function(property){
  279. return smalltalk.withContext(function($ctx2) {
  280. return _st(property)._value();
  281. }, function($ctx2) {$ctx2.fillBlock({property:property},$ctx1,1)})}),(function(){
  282. return smalltalk.withContext(function($ctx2) {
  283. return (1);
  284. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  285. return $1;
  286. }, function($ctx1) {$ctx1.fill(self,"width",{},smalltalk.MKLayout)})},
  287. args: [],
  288. source: "width\x0a\x09^ properties \x0a\x09\x09at: 'width' \x0a\x09\x09ifPresent: [ :property | property value ]\x0a\x09\x09ifAbsent: [ 1 ]",
  289. messageSends: ["at:ifPresent:ifAbsent:", "value"],
  290. referencedClasses: []
  291. }),
  292. smalltalk.MKLayout);
  293. smalltalk.addMethod(
  294. smalltalk.method({
  295. selector: "width:",
  296. category: 'accessing',
  297. fn: function (aNumber){
  298. var self=this;
  299. return smalltalk.withContext(function($ctx1) {
  300. var $1;
  301. _st(self["@properties"])._at_put_("width",self._propertyLabelled_value_("width",aNumber));
  302. $1=self._hasProperty_("left");
  303. if(smalltalk.assert($1)){
  304. self._removeProperty_("right");
  305. };
  306. return self}, function($ctx1) {$ctx1.fill(self,"width:",{aNumber:aNumber},smalltalk.MKLayout)})},
  307. args: ["aNumber"],
  308. source: "width: aNumber\x0a\x09properties \x0a\x09\x09at: 'width' \x0a\x09\x09put: (self propertyLabelled: 'width' value: aNumber).\x0a\x09\x0a\x09(self hasProperty: 'left') ifTrue: [\x0a\x09\x09self removeProperty: 'right' ]",
  309. messageSends: ["at:put:", "propertyLabelled:value:", "ifTrue:", "hasProperty:", "removeProperty:"],
  310. referencedClasses: []
  311. }),
  312. smalltalk.MKLayout);
  313. smalltalk.addClass('MKLabelLayout', smalltalk.MKLayout, [], 'Moka-Layouts');
  314. smalltalk.MKLabelLayout.comment="I am a specialized layout for label views. I can set a `textAlign` property, taking a string argument, `'left'`, `'center'` or `'right'`.";
  315. smalltalk.addMethod(
  316. smalltalk.method({
  317. selector: "textAlign:",
  318. category: 'accessing',
  319. fn: function (aString){
  320. var self=this;
  321. return smalltalk.withContext(function($ctx1) {
  322. _st(self["@properties"])._at_put_("text-align",self._propertyLabelled_value_("text-align",aString));
  323. return self}, function($ctx1) {$ctx1.fill(self,"textAlign:",{aString:aString},smalltalk.MKLabelLayout)})},
  324. args: ["aString"],
  325. source: "textAlign: aString\x0a\x09\x22Map to CSS' text-align property. Possible values are `'left'`, `'center'` and `'right'`\x22\x0a\x09\x0a\x09properties \x0a\x09\x09at: 'text-align' \x0a\x09\x09put: (self propertyLabelled: 'text-align' value: aString)",
  326. messageSends: ["at:put:", "propertyLabelled:value:"],
  327. referencedClasses: []
  328. }),
  329. smalltalk.MKLabelLayout);
  330. smalltalk.addClass('MKPaneLayout', smalltalk.MKLayout, [], 'Moka-Layouts');
  331. smalltalk.MKPaneLayout.comment="I am a specialized layout for pane views. I can set border widths to my views.";
  332. smalltalk.addMethod(
  333. smalltalk.method({
  334. selector: "borderBottom:",
  335. category: 'accessing',
  336. fn: function (aNumber){
  337. var self=this;
  338. return smalltalk.withContext(function($ctx1) {
  339. _st(self["@properties"])._at_put_("border-bottom",self._propertyLabelled_value_("border-bottom-width",_st(aNumber)._asMokaPixelString()));
  340. return self}, function($ctx1) {$ctx1.fill(self,"borderBottom:",{aNumber:aNumber},smalltalk.MKPaneLayout)})},
  341. args: ["aNumber"],
  342. source: "borderBottom: aNumber\x0a\x09properties \x0a\x09\x09at: 'border-bottom' \x0a\x09\x09put: (self propertyLabelled: 'border-bottom-width' value: aNumber asMokaPixelString)",
  343. messageSends: ["at:put:", "propertyLabelled:value:", "asMokaPixelString"],
  344. referencedClasses: []
  345. }),
  346. smalltalk.MKPaneLayout);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "borderLeft:",
  350. category: 'accessing',
  351. fn: function (aNumber){
  352. var self=this;
  353. return smalltalk.withContext(function($ctx1) {
  354. _st(self["@properties"])._at_put_("border-left",self._propertyLabelled_value_("border-left-width",_st(aNumber)._asMokaPixelString()));
  355. return self}, function($ctx1) {$ctx1.fill(self,"borderLeft:",{aNumber:aNumber},smalltalk.MKPaneLayout)})},
  356. args: ["aNumber"],
  357. source: "borderLeft: aNumber\x0a\x09properties \x0a\x09\x09at: 'border-left' \x0a\x09\x09put: (self propertyLabelled: 'border-left-width' value: aNumber asMokaPixelString)",
  358. messageSends: ["at:put:", "propertyLabelled:value:", "asMokaPixelString"],
  359. referencedClasses: []
  360. }),
  361. smalltalk.MKPaneLayout);
  362. smalltalk.addMethod(
  363. smalltalk.method({
  364. selector: "borderRight:",
  365. category: 'accessing',
  366. fn: function (aNumber){
  367. var self=this;
  368. return smalltalk.withContext(function($ctx1) {
  369. _st(self["@properties"])._at_put_("border-right",self._propertyLabelled_value_("border-right-width",_st(aNumber)._asMokaPixelString()));
  370. return self}, function($ctx1) {$ctx1.fill(self,"borderRight:",{aNumber:aNumber},smalltalk.MKPaneLayout)})},
  371. args: ["aNumber"],
  372. source: "borderRight: aNumber\x0a\x09properties \x0a\x09\x09at: 'border-right' \x0a\x09\x09put: (self propertyLabelled: 'border-right-width' value: aNumber asMokaPixelString)",
  373. messageSends: ["at:put:", "propertyLabelled:value:", "asMokaPixelString"],
  374. referencedClasses: []
  375. }),
  376. smalltalk.MKPaneLayout);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "borderTop:",
  380. category: 'accessing',
  381. fn: function (aNumber){
  382. var self=this;
  383. return smalltalk.withContext(function($ctx1) {
  384. _st(self["@properties"])._at_put_("border-top",self._propertyLabelled_value_("border-top-width",_st(aNumber)._asMokaPixelString()));
  385. return self}, function($ctx1) {$ctx1.fill(self,"borderTop:",{aNumber:aNumber},smalltalk.MKPaneLayout)})},
  386. args: ["aNumber"],
  387. source: "borderTop: aNumber\x0a\x09properties \x0a\x09\x09at: 'border-top' \x0a\x09\x09put: (self propertyLabelled: 'border-top-width' value: aNumber asMokaPixelString)",
  388. messageSends: ["at:put:", "propertyLabelled:value:", "asMokaPixelString"],
  389. referencedClasses: []
  390. }),
  391. smalltalk.MKPaneLayout);
  392. smalltalk.addClass('MKLayoutProperty', smalltalk.Object, ['layout', 'value'], 'Moka-Layouts');
  393. smalltalk.addMethod(
  394. smalltalk.method({
  395. selector: "asCssString",
  396. category: 'converting',
  397. fn: function (){
  398. var self=this;
  399. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  400. return smalltalk.withContext(function($ctx1) {
  401. var $1;
  402. $1=_st($String())._streamContents_((function(stream){
  403. return smalltalk.withContext(function($ctx2) {
  404. return self._printCssOn_(stream);
  405. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
  406. return $1;
  407. }, function($ctx1) {$ctx1.fill(self,"asCssString",{},smalltalk.MKLayoutProperty)})},
  408. args: [],
  409. source: "asCssString\x0a\x09^ String streamContents: [ :stream | \x0a\x09\x09self printCssOn: stream ]",
  410. messageSends: ["streamContents:", "printCssOn:"],
  411. referencedClasses: ["String"]
  412. }),
  413. smalltalk.MKLayoutProperty);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "layout",
  417. category: 'accessing',
  418. fn: function (){
  419. var self=this;
  420. return smalltalk.withContext(function($ctx1) {
  421. var $1;
  422. $1=self["@layout"];
  423. return $1;
  424. }, function($ctx1) {$ctx1.fill(self,"layout",{},smalltalk.MKLayoutProperty)})},
  425. args: [],
  426. source: "layout\x0a\x09^ layout",
  427. messageSends: [],
  428. referencedClasses: []
  429. }),
  430. smalltalk.MKLayoutProperty);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "layout:",
  434. category: 'accessing',
  435. fn: function (aLayout){
  436. var self=this;
  437. return smalltalk.withContext(function($ctx1) {
  438. self["@layout"]=aLayout;
  439. return self}, function($ctx1) {$ctx1.fill(self,"layout:",{aLayout:aLayout},smalltalk.MKLayoutProperty)})},
  440. args: ["aLayout"],
  441. source: "layout: aLayout\x0a\x09layout := aLayout",
  442. messageSends: [],
  443. referencedClasses: []
  444. }),
  445. smalltalk.MKLayoutProperty);
  446. smalltalk.addMethod(
  447. smalltalk.method({
  448. selector: "printCssOn:",
  449. category: 'printing',
  450. fn: function (aStream){
  451. var self=this;
  452. return smalltalk.withContext(function($ctx1) {
  453. self._subclassResponsibility();
  454. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},smalltalk.MKLayoutProperty)})},
  455. args: ["aStream"],
  456. source: "printCssOn: aStream\x0a\x09self subclassResponsibility",
  457. messageSends: ["subclassResponsibility"],
  458. referencedClasses: []
  459. }),
  460. smalltalk.MKLayoutProperty);
  461. smalltalk.addMethod(
  462. smalltalk.method({
  463. selector: "value",
  464. category: 'accessing',
  465. fn: function (){
  466. var self=this;
  467. return smalltalk.withContext(function($ctx1) {
  468. var $1;
  469. $1=self["@value"];
  470. return $1;
  471. }, function($ctx1) {$ctx1.fill(self,"value",{},smalltalk.MKLayoutProperty)})},
  472. args: [],
  473. source: "value\x0a\x09^ value",
  474. messageSends: [],
  475. referencedClasses: []
  476. }),
  477. smalltalk.MKLayoutProperty);
  478. smalltalk.addMethod(
  479. smalltalk.method({
  480. selector: "value:",
  481. category: 'accessing',
  482. fn: function (aValue){
  483. var self=this;
  484. return smalltalk.withContext(function($ctx1) {
  485. self["@value"]=aValue;
  486. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue},smalltalk.MKLayoutProperty)})},
  487. args: ["aValue"],
  488. source: "value: aValue\x0a\x09value := aValue",
  489. messageSends: [],
  490. referencedClasses: []
  491. }),
  492. smalltalk.MKLayoutProperty);
  493. smalltalk.addMethod(
  494. smalltalk.method({
  495. selector: "layout:value:",
  496. category: 'instance creation',
  497. fn: function (aLayout,aValue){
  498. var self=this;
  499. return smalltalk.withContext(function($ctx1) {
  500. var $2,$3,$1;
  501. $2=self._new();
  502. _st($2)._layout_(aLayout);
  503. _st($2)._value_(aValue);
  504. $3=_st($2)._yourself();
  505. $1=$3;
  506. return $1;
  507. }, function($ctx1) {$ctx1.fill(self,"layout:value:",{aLayout:aLayout,aValue:aValue},smalltalk.MKLayoutProperty.klass)})},
  508. args: ["aLayout", "aValue"],
  509. source: "layout: aLayout value: aValue\x0a\x09^ self new\x0a\x09\x09layout: aLayout;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  510. messageSends: ["layout:", "new", "value:", "yourself"],
  511. referencedClasses: []
  512. }),
  513. smalltalk.MKLayoutProperty.klass);
  514. smalltalk.addClass('MKHorizontalCenteringLayoutProperty', smalltalk.MKLayoutProperty, [], 'Moka-Layouts');
  515. smalltalk.addMethod(
  516. smalltalk.method({
  517. selector: "marginLeft",
  518. category: 'accessing',
  519. fn: function (){
  520. var self=this;
  521. return smalltalk.withContext(function($ctx1) {
  522. var $1;
  523. $1=(0).__minus(_st(_st(_st(self._layout())._width()).__slash((2))).__plus(self._value()));
  524. return $1;
  525. }, function($ctx1) {$ctx1.fill(self,"marginLeft",{},smalltalk.MKHorizontalCenteringLayoutProperty)})},
  526. args: [],
  527. source: "marginLeft\x0a\x09^ 0 - ((self layout width / 2) + self value)",
  528. messageSends: ["-", "+", "/", "width", "layout", "value"],
  529. referencedClasses: []
  530. }),
  531. smalltalk.MKHorizontalCenteringLayoutProperty);
  532. smalltalk.addMethod(
  533. smalltalk.method({
  534. selector: "printCssOn:",
  535. category: 'printing',
  536. fn: function (aStream){
  537. var self=this;
  538. return smalltalk.withContext(function($ctx1) {
  539. _st(aStream).__lt_lt("left:50%;");
  540. $ctx1.sendIdx["<<"]=1;
  541. _st(_st(aStream).__lt_lt("margin-left:")).__lt_lt(_st(self._marginLeft())._asMokaCssString());
  542. $ctx1.sendIdx["<<"]=2;
  543. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},smalltalk.MKHorizontalCenteringLayoutProperty)})},
  544. args: ["aStream"],
  545. source: "printCssOn: aStream\x0a\x09aStream << 'left:50%;'.\x0a\x09aStream << 'margin-left:' << self marginLeft asMokaCssString",
  546. messageSends: ["<<", "asMokaCssString", "marginLeft"],
  547. referencedClasses: []
  548. }),
  549. smalltalk.MKHorizontalCenteringLayoutProperty);
  550. smalltalk.addClass('MKLabelledLayoutProperty', smalltalk.MKLayoutProperty, ['label'], 'Moka-Layouts');
  551. smalltalk.addMethod(
  552. smalltalk.method({
  553. selector: "label",
  554. category: 'accessing',
  555. fn: function (){
  556. var self=this;
  557. return smalltalk.withContext(function($ctx1) {
  558. var $1;
  559. $1=self["@label"];
  560. return $1;
  561. }, function($ctx1) {$ctx1.fill(self,"label",{},smalltalk.MKLabelledLayoutProperty)})},
  562. args: [],
  563. source: "label\x0a\x09^ label",
  564. messageSends: [],
  565. referencedClasses: []
  566. }),
  567. smalltalk.MKLabelledLayoutProperty);
  568. smalltalk.addMethod(
  569. smalltalk.method({
  570. selector: "label:",
  571. category: 'accessing',
  572. fn: function (aString){
  573. var self=this;
  574. return smalltalk.withContext(function($ctx1) {
  575. self["@label"]=aString;
  576. return self}, function($ctx1) {$ctx1.fill(self,"label:",{aString:aString},smalltalk.MKLabelledLayoutProperty)})},
  577. args: ["aString"],
  578. source: "label: aString\x0a\x09label := aString",
  579. messageSends: [],
  580. referencedClasses: []
  581. }),
  582. smalltalk.MKLabelledLayoutProperty);
  583. smalltalk.addMethod(
  584. smalltalk.method({
  585. selector: "printCssOn:",
  586. category: 'printing',
  587. fn: function (aStream){
  588. var self=this;
  589. return smalltalk.withContext(function($ctx1) {
  590. var $1;
  591. $1=_st(_st(aStream).__lt_lt(self._label())).__lt_lt(":");
  592. $ctx1.sendIdx["<<"]=2;
  593. _st($1).__lt_lt(_st(self._value())._asMokaCssString());
  594. $ctx1.sendIdx["<<"]=1;
  595. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},smalltalk.MKLabelledLayoutProperty)})},
  596. args: ["aStream"],
  597. source: "printCssOn: aStream\x0a\x09aStream << self label << ':' << self value asMokaCssString",
  598. messageSends: ["<<", "label", "asMokaCssString", "value"],
  599. referencedClasses: []
  600. }),
  601. smalltalk.MKLabelledLayoutProperty);
  602. smalltalk.addMethod(
  603. smalltalk.method({
  604. selector: "layout:label:value:",
  605. category: 'instance creation',
  606. fn: function (aLayout,aString,aValue){
  607. var self=this;
  608. return smalltalk.withContext(function($ctx1) {
  609. var $2,$3,$1;
  610. $2=self._new();
  611. _st($2)._layout_(aLayout);
  612. _st($2)._label_(aString);
  613. _st($2)._value_(aValue);
  614. $3=_st($2)._yourself();
  615. $1=$3;
  616. return $1;
  617. }, function($ctx1) {$ctx1.fill(self,"layout:label:value:",{aLayout:aLayout,aString:aString,aValue:aValue},smalltalk.MKLabelledLayoutProperty.klass)})},
  618. args: ["aLayout", "aString", "aValue"],
  619. source: "layout: aLayout label: aString value: aValue\x0a\x09^ self new\x0a\x09\x09layout: aLayout;\x0a\x09\x09label: aString;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  620. messageSends: ["layout:", "new", "label:", "value:", "yourself"],
  621. referencedClasses: []
  622. }),
  623. smalltalk.MKLabelledLayoutProperty.klass);
  624. smalltalk.addClass('MKVerticalCenteringLayoutProperty', smalltalk.MKLayoutProperty, [], 'Moka-Layouts');
  625. smalltalk.addMethod(
  626. smalltalk.method({
  627. selector: "marginTop",
  628. category: 'accessing',
  629. fn: function (){
  630. var self=this;
  631. return smalltalk.withContext(function($ctx1) {
  632. var $1;
  633. $1=(0).__minus(_st(_st(_st(self._layout())._height()).__slash((2))).__plus(self._value()));
  634. return $1;
  635. }, function($ctx1) {$ctx1.fill(self,"marginTop",{},smalltalk.MKVerticalCenteringLayoutProperty)})},
  636. args: [],
  637. source: "marginTop\x0a\x09^ 0 - ((self layout height / 2) + self value)",
  638. messageSends: ["-", "+", "/", "height", "layout", "value"],
  639. referencedClasses: []
  640. }),
  641. smalltalk.MKVerticalCenteringLayoutProperty);
  642. smalltalk.addMethod(
  643. smalltalk.method({
  644. selector: "printCssOn:",
  645. category: 'printing',
  646. fn: function (aStream){
  647. var self=this;
  648. return smalltalk.withContext(function($ctx1) {
  649. _st(aStream).__lt_lt("top:50%;");
  650. $ctx1.sendIdx["<<"]=1;
  651. _st(_st(aStream).__lt_lt("margin-top:")).__lt_lt(_st(self._marginTop())._asMokaCssString());
  652. $ctx1.sendIdx["<<"]=2;
  653. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},smalltalk.MKVerticalCenteringLayoutProperty)})},
  654. args: ["aStream"],
  655. source: "printCssOn: aStream\x0a\x09aStream << 'top:50%;'.\x0a\x09aStream << 'margin-top:' << self marginTop asMokaCssString",
  656. messageSends: ["<<", "asMokaCssString", "marginTop"],
  657. referencedClasses: []
  658. }),
  659. smalltalk.MKVerticalCenteringLayoutProperty);
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "asMokaCssString",
  663. category: '*Moka-Layouts',
  664. fn: function (){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $2,$1;
  668. $2=_st(self._abs()).__gt((1));
  669. if(smalltalk.assert($2)){
  670. $1=self._asMokaPixelString();
  671. } else {
  672. $1=self._asMokaPercentString();
  673. };
  674. return $1;
  675. }, function($ctx1) {$ctx1.fill(self,"asMokaCssString",{},smalltalk.Number)})},
  676. args: [],
  677. source: "asMokaCssString\x0a\x09^ self abs > 1 \x09\x0a\x09\x09ifTrue: [ self asMokaPixelString ]\x0a\x09\x09ifFalse: [ self asMokaPercentString ]",
  678. messageSends: ["ifTrue:ifFalse:", ">", "abs", "asMokaPixelString", "asMokaPercentString"],
  679. referencedClasses: []
  680. }),
  681. smalltalk.Number);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "asMokaPercentString",
  685. category: '*Moka-Layouts',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1;
  690. $1=_st(_st(self.__star((100)))._asString()).__comma("%");
  691. return $1;
  692. }, function($ctx1) {$ctx1.fill(self,"asMokaPercentString",{},smalltalk.Number)})},
  693. args: [],
  694. source: "asMokaPercentString\x0a\x09^ (self * 100) asString, '%'",
  695. messageSends: [",", "asString", "*"],
  696. referencedClasses: []
  697. }),
  698. smalltalk.Number);
  699. smalltalk.addMethod(
  700. smalltalk.method({
  701. selector: "asMokaPixelString",
  702. category: '*Moka-Layouts',
  703. fn: function (){
  704. var self=this;
  705. return smalltalk.withContext(function($ctx1) {
  706. var $1;
  707. $1=_st(self._asString()).__comma("px");
  708. return $1;
  709. }, function($ctx1) {$ctx1.fill(self,"asMokaPixelString",{},smalltalk.Number)})},
  710. args: [],
  711. source: "asMokaPixelString\x0a\x09^ self asString, 'px'",
  712. messageSends: [",", "asString"],
  713. referencedClasses: []
  714. }),
  715. smalltalk.Number);
  716. smalltalk.addMethod(
  717. smalltalk.method({
  718. selector: "asMokaCssString",
  719. category: '*Moka-Layouts',
  720. fn: function (){
  721. var self=this;
  722. return smalltalk.withContext(function($ctx1) {
  723. return self;
  724. }, function($ctx1) {$ctx1.fill(self,"asMokaCssString",{},smalltalk.String)})},
  725. args: [],
  726. source: "asMokaCssString\x0a\x09^ self",
  727. messageSends: [],
  728. referencedClasses: []
  729. }),
  730. smalltalk.String);
  731. });