Moka-Layouts.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777
  1. define("amber_core/Moka-Layouts", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Collections"], function(smalltalk,nil,_st, globals){
  2. smalltalk.addPackage('Moka-Layouts');
  3. smalltalk.packages["Moka-Layouts"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKLayout', globals.Object, ['properties'], 'Moka-Layouts');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "asCssString",
  8. protocol: 'converting',
  9. fn: function (){
  10. var self=this;
  11. function $String(){return globals.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",{},globals.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. globals.MKLayout);
  30. smalltalk.addMethod(
  31. smalltalk.method({
  32. selector: "bottom:",
  33. protocol: '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},globals.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. globals.MKLayout);
  52. smalltalk.addMethod(
  53. smalltalk.method({
  54. selector: "centerX:",
  55. protocol: 'accessing',
  56. fn: function (aNumber){
  57. var self=this;
  58. function $MKHorizontalCenteringLayoutProperty(){return globals.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},globals.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. globals.MKLayout);
  72. smalltalk.addMethod(
  73. smalltalk.method({
  74. selector: "centerY:",
  75. protocol: 'accessing',
  76. fn: function (aNumber){
  77. var self=this;
  78. function $MKVerticalCenteringLayoutProperty(){return globals.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},globals.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. globals.MKLayout);
  92. smalltalk.addMethod(
  93. smalltalk.method({
  94. selector: "hasProperty:",
  95. protocol: '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},globals.MKLayout)})},
  103. args: ["aString"],
  104. source: "hasProperty: aString\x0a\x09^ properties includesKey: aString",
  105. messageSends: ["includesKey:"],
  106. referencedClasses: []
  107. }),
  108. globals.MKLayout);
  109. smalltalk.addMethod(
  110. smalltalk.method({
  111. selector: "height",
  112. protocol: '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",{},globals.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. globals.MKLayout);
  132. smalltalk.addMethod(
  133. smalltalk.method({
  134. selector: "height:",
  135. protocol: '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},globals.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. globals.MKLayout);
  152. smalltalk.addMethod(
  153. smalltalk.method({
  154. selector: "initialize",
  155. protocol: 'initialization',
  156. fn: function (){
  157. var self=this;
  158. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  159. return smalltalk.withContext(function($ctx1) {
  160. globals.MKLayout.superclass.fn.prototype._initialize.apply(_st(self), []);
  161. self["@properties"]=_st($Dictionary())._new();
  162. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.MKLayout)})},
  163. args: [],
  164. source: "initialize\x0a\x09super initialize.\x0a\x09properties := Dictionary new",
  165. messageSends: ["initialize", "new"],
  166. referencedClasses: ["Dictionary"]
  167. }),
  168. globals.MKLayout);
  169. smalltalk.addMethod(
  170. smalltalk.method({
  171. selector: "left:",
  172. protocol: '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},globals.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. globals.MKLayout);
  191. smalltalk.addMethod(
  192. smalltalk.method({
  193. selector: "propertyLabelled:value:",
  194. protocol: 'factory',
  195. fn: function (aString,aValue){
  196. var self=this;
  197. function $MKLabelledLayoutProperty(){return globals.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},globals.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. globals.MKLayout);
  209. smalltalk.addMethod(
  210. smalltalk.method({
  211. selector: "removeProperty:",
  212. protocol: '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},globals.MKLayout)})},
  220. args: ["aString"],
  221. source: "removeProperty: aString\x0a\x09properties remove: aString ifAbsent: []",
  222. messageSends: ["remove:ifAbsent:"],
  223. referencedClasses: []
  224. }),
  225. globals.MKLayout);
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "right:",
  229. protocol: '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},globals.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. globals.MKLayout);
  248. smalltalk.addMethod(
  249. smalltalk.method({
  250. selector: "top:",
  251. protocol: '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},globals.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. globals.MKLayout);
  270. smalltalk.addMethod(
  271. smalltalk.method({
  272. selector: "width",
  273. protocol: '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",{},globals.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. globals.MKLayout);
  293. smalltalk.addMethod(
  294. smalltalk.method({
  295. selector: "width:",
  296. protocol: '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},globals.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. globals.MKLayout);
  313. smalltalk.addClass('MKLabelLayout', globals.MKLayout, [], 'Moka-Layouts');
  314. globals.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. protocol: '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},globals.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. globals.MKLabelLayout);
  330. smalltalk.addClass('MKPaneLayout', globals.MKLayout, [], 'Moka-Layouts');
  331. globals.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. protocol: '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},globals.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. globals.MKPaneLayout);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "borderLeft:",
  350. protocol: '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},globals.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. globals.MKPaneLayout);
  362. smalltalk.addMethod(
  363. smalltalk.method({
  364. selector: "borderRight:",
  365. protocol: '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},globals.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. globals.MKPaneLayout);
  377. smalltalk.addMethod(
  378. smalltalk.method({
  379. selector: "borderTop:",
  380. protocol: '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},globals.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. globals.MKPaneLayout);
  392. smalltalk.addClass('MKLayoutProperty', globals.Object, ['layout', 'value'], 'Moka-Layouts');
  393. smalltalk.addMethod(
  394. smalltalk.method({
  395. selector: "asCssString",
  396. protocol: 'converting',
  397. fn: function (){
  398. var self=this;
  399. function $String(){return globals.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",{},globals.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. globals.MKLayoutProperty);
  414. smalltalk.addMethod(
  415. smalltalk.method({
  416. selector: "layout",
  417. protocol: 'accessing',
  418. fn: function (){
  419. var self=this;
  420. var $1;
  421. $1=self["@layout"];
  422. return $1;
  423. },
  424. args: [],
  425. source: "layout\x0a\x09^ layout",
  426. messageSends: [],
  427. referencedClasses: []
  428. }),
  429. globals.MKLayoutProperty);
  430. smalltalk.addMethod(
  431. smalltalk.method({
  432. selector: "layout:",
  433. protocol: 'accessing',
  434. fn: function (aLayout){
  435. var self=this;
  436. self["@layout"]=aLayout;
  437. return self},
  438. args: ["aLayout"],
  439. source: "layout: aLayout\x0a\x09layout := aLayout",
  440. messageSends: [],
  441. referencedClasses: []
  442. }),
  443. globals.MKLayoutProperty);
  444. smalltalk.addMethod(
  445. smalltalk.method({
  446. selector: "printCssOn:",
  447. protocol: 'printing',
  448. fn: function (aStream){
  449. var self=this;
  450. return smalltalk.withContext(function($ctx1) {
  451. self._subclassResponsibility();
  452. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},globals.MKLayoutProperty)})},
  453. args: ["aStream"],
  454. source: "printCssOn: aStream\x0a\x09self subclassResponsibility",
  455. messageSends: ["subclassResponsibility"],
  456. referencedClasses: []
  457. }),
  458. globals.MKLayoutProperty);
  459. smalltalk.addMethod(
  460. smalltalk.method({
  461. selector: "value",
  462. protocol: 'accessing',
  463. fn: function (){
  464. var self=this;
  465. var $1;
  466. $1=self["@value"];
  467. return $1;
  468. },
  469. args: [],
  470. source: "value\x0a\x09^ value",
  471. messageSends: [],
  472. referencedClasses: []
  473. }),
  474. globals.MKLayoutProperty);
  475. smalltalk.addMethod(
  476. smalltalk.method({
  477. selector: "value:",
  478. protocol: 'accessing',
  479. fn: function (aValue){
  480. var self=this;
  481. self["@value"]=aValue;
  482. return self},
  483. args: ["aValue"],
  484. source: "value: aValue\x0a\x09value := aValue",
  485. messageSends: [],
  486. referencedClasses: []
  487. }),
  488. globals.MKLayoutProperty);
  489. smalltalk.addMethod(
  490. smalltalk.method({
  491. selector: "layout:value:",
  492. protocol: 'instance creation',
  493. fn: function (aLayout,aValue){
  494. var self=this;
  495. return smalltalk.withContext(function($ctx1) {
  496. var $2,$3,$1;
  497. $2=self._new();
  498. _st($2)._layout_(aLayout);
  499. _st($2)._value_(aValue);
  500. $3=_st($2)._yourself();
  501. $1=$3;
  502. return $1;
  503. }, function($ctx1) {$ctx1.fill(self,"layout:value:",{aLayout:aLayout,aValue:aValue},globals.MKLayoutProperty.klass)})},
  504. args: ["aLayout", "aValue"],
  505. source: "layout: aLayout value: aValue\x0a\x09^ self new\x0a\x09\x09layout: aLayout;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  506. messageSends: ["layout:", "new", "value:", "yourself"],
  507. referencedClasses: []
  508. }),
  509. globals.MKLayoutProperty.klass);
  510. smalltalk.addClass('MKHorizontalCenteringLayoutProperty', globals.MKLayoutProperty, [], 'Moka-Layouts');
  511. smalltalk.addMethod(
  512. smalltalk.method({
  513. selector: "marginLeft",
  514. protocol: 'accessing',
  515. fn: function (){
  516. var self=this;
  517. return smalltalk.withContext(function($ctx1) {
  518. var $1;
  519. $1=(0).__minus(_st(_st(_st(self._layout())._width()).__slash((2))).__plus(self._value()));
  520. return $1;
  521. }, function($ctx1) {$ctx1.fill(self,"marginLeft",{},globals.MKHorizontalCenteringLayoutProperty)})},
  522. args: [],
  523. source: "marginLeft\x0a\x09^ 0 - ((self layout width / 2) + self value)",
  524. messageSends: ["-", "+", "/", "width", "layout", "value"],
  525. referencedClasses: []
  526. }),
  527. globals.MKHorizontalCenteringLayoutProperty);
  528. smalltalk.addMethod(
  529. smalltalk.method({
  530. selector: "printCssOn:",
  531. protocol: 'printing',
  532. fn: function (aStream){
  533. var self=this;
  534. return smalltalk.withContext(function($ctx1) {
  535. _st(aStream).__lt_lt("left:50%;");
  536. $ctx1.sendIdx["<<"]=1;
  537. _st(_st(aStream).__lt_lt("margin-left:")).__lt_lt(_st(self._marginLeft())._asMokaCssString());
  538. $ctx1.sendIdx["<<"]=2;
  539. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},globals.MKHorizontalCenteringLayoutProperty)})},
  540. args: ["aStream"],
  541. source: "printCssOn: aStream\x0a\x09aStream << 'left:50%;'.\x0a\x09aStream << 'margin-left:' << self marginLeft asMokaCssString",
  542. messageSends: ["<<", "asMokaCssString", "marginLeft"],
  543. referencedClasses: []
  544. }),
  545. globals.MKHorizontalCenteringLayoutProperty);
  546. smalltalk.addClass('MKLabelledLayoutProperty', globals.MKLayoutProperty, ['label'], 'Moka-Layouts');
  547. smalltalk.addMethod(
  548. smalltalk.method({
  549. selector: "label",
  550. protocol: 'accessing',
  551. fn: function (){
  552. var self=this;
  553. var $1;
  554. $1=self["@label"];
  555. return $1;
  556. },
  557. args: [],
  558. source: "label\x0a\x09^ label",
  559. messageSends: [],
  560. referencedClasses: []
  561. }),
  562. globals.MKLabelledLayoutProperty);
  563. smalltalk.addMethod(
  564. smalltalk.method({
  565. selector: "label:",
  566. protocol: 'accessing',
  567. fn: function (aString){
  568. var self=this;
  569. self["@label"]=aString;
  570. return self},
  571. args: ["aString"],
  572. source: "label: aString\x0a\x09label := aString",
  573. messageSends: [],
  574. referencedClasses: []
  575. }),
  576. globals.MKLabelledLayoutProperty);
  577. smalltalk.addMethod(
  578. smalltalk.method({
  579. selector: "printCssOn:",
  580. protocol: 'printing',
  581. fn: function (aStream){
  582. var self=this;
  583. return smalltalk.withContext(function($ctx1) {
  584. var $1;
  585. $1=_st(_st(aStream).__lt_lt(self._label())).__lt_lt(":");
  586. $ctx1.sendIdx["<<"]=2;
  587. _st($1).__lt_lt(_st(self._value())._asMokaCssString());
  588. $ctx1.sendIdx["<<"]=1;
  589. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},globals.MKLabelledLayoutProperty)})},
  590. args: ["aStream"],
  591. source: "printCssOn: aStream\x0a\x09aStream << self label << ':' << self value asMokaCssString",
  592. messageSends: ["<<", "label", "asMokaCssString", "value"],
  593. referencedClasses: []
  594. }),
  595. globals.MKLabelledLayoutProperty);
  596. smalltalk.addMethod(
  597. smalltalk.method({
  598. selector: "layout:label:value:",
  599. protocol: 'instance creation',
  600. fn: function (aLayout,aString,aValue){
  601. var self=this;
  602. return smalltalk.withContext(function($ctx1) {
  603. var $2,$3,$1;
  604. $2=self._new();
  605. _st($2)._layout_(aLayout);
  606. _st($2)._label_(aString);
  607. _st($2)._value_(aValue);
  608. $3=_st($2)._yourself();
  609. $1=$3;
  610. return $1;
  611. }, function($ctx1) {$ctx1.fill(self,"layout:label:value:",{aLayout:aLayout,aString:aString,aValue:aValue},globals.MKLabelledLayoutProperty.klass)})},
  612. args: ["aLayout", "aString", "aValue"],
  613. 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",
  614. messageSends: ["layout:", "new", "label:", "value:", "yourself"],
  615. referencedClasses: []
  616. }),
  617. globals.MKLabelledLayoutProperty.klass);
  618. smalltalk.addClass('MKVerticalCenteringLayoutProperty', globals.MKLayoutProperty, [], 'Moka-Layouts');
  619. smalltalk.addMethod(
  620. smalltalk.method({
  621. selector: "marginTop",
  622. protocol: 'accessing',
  623. fn: function (){
  624. var self=this;
  625. return smalltalk.withContext(function($ctx1) {
  626. var $1;
  627. $1=(0).__minus(_st(_st(_st(self._layout())._height()).__slash((2))).__plus(self._value()));
  628. return $1;
  629. }, function($ctx1) {$ctx1.fill(self,"marginTop",{},globals.MKVerticalCenteringLayoutProperty)})},
  630. args: [],
  631. source: "marginTop\x0a\x09^ 0 - ((self layout height / 2) + self value)",
  632. messageSends: ["-", "+", "/", "height", "layout", "value"],
  633. referencedClasses: []
  634. }),
  635. globals.MKVerticalCenteringLayoutProperty);
  636. smalltalk.addMethod(
  637. smalltalk.method({
  638. selector: "printCssOn:",
  639. protocol: 'printing',
  640. fn: function (aStream){
  641. var self=this;
  642. return smalltalk.withContext(function($ctx1) {
  643. _st(aStream).__lt_lt("top:50%;");
  644. $ctx1.sendIdx["<<"]=1;
  645. _st(_st(aStream).__lt_lt("margin-top:")).__lt_lt(_st(self._marginTop())._asMokaCssString());
  646. $ctx1.sendIdx["<<"]=2;
  647. return self}, function($ctx1) {$ctx1.fill(self,"printCssOn:",{aStream:aStream},globals.MKVerticalCenteringLayoutProperty)})},
  648. args: ["aStream"],
  649. source: "printCssOn: aStream\x0a\x09aStream << 'top:50%;'.\x0a\x09aStream << 'margin-top:' << self marginTop asMokaCssString",
  650. messageSends: ["<<", "asMokaCssString", "marginTop"],
  651. referencedClasses: []
  652. }),
  653. globals.MKVerticalCenteringLayoutProperty);
  654. smalltalk.addMethod(
  655. smalltalk.method({
  656. selector: "asMokaCssString",
  657. protocol: '*Moka-Layouts',
  658. fn: function (){
  659. var self=this;
  660. return smalltalk.withContext(function($ctx1) {
  661. var $2,$1;
  662. $2=_st(self._abs()).__gt((1));
  663. if(smalltalk.assert($2)){
  664. $1=self._asMokaPixelString();
  665. } else {
  666. $1=self._asMokaPercentString();
  667. };
  668. return $1;
  669. }, function($ctx1) {$ctx1.fill(self,"asMokaCssString",{},globals.Number)})},
  670. args: [],
  671. source: "asMokaCssString\x0a\x09^ self abs > 1 \x09\x0a\x09\x09ifTrue: [ self asMokaPixelString ]\x0a\x09\x09ifFalse: [ self asMokaPercentString ]",
  672. messageSends: ["ifTrue:ifFalse:", ">", "abs", "asMokaPixelString", "asMokaPercentString"],
  673. referencedClasses: []
  674. }),
  675. globals.Number);
  676. smalltalk.addMethod(
  677. smalltalk.method({
  678. selector: "asMokaPercentString",
  679. protocol: '*Moka-Layouts',
  680. fn: function (){
  681. var self=this;
  682. return smalltalk.withContext(function($ctx1) {
  683. var $1;
  684. $1=_st(_st(self.__star((100)))._asString()).__comma("%");
  685. return $1;
  686. }, function($ctx1) {$ctx1.fill(self,"asMokaPercentString",{},globals.Number)})},
  687. args: [],
  688. source: "asMokaPercentString\x0a\x09^ (self * 100) asString, '%'",
  689. messageSends: [",", "asString", "*"],
  690. referencedClasses: []
  691. }),
  692. globals.Number);
  693. smalltalk.addMethod(
  694. smalltalk.method({
  695. selector: "asMokaPixelString",
  696. protocol: '*Moka-Layouts',
  697. fn: function (){
  698. var self=this;
  699. return smalltalk.withContext(function($ctx1) {
  700. var $1;
  701. $1=_st(self._asString()).__comma("px");
  702. return $1;
  703. }, function($ctx1) {$ctx1.fill(self,"asMokaPixelString",{},globals.Number)})},
  704. args: [],
  705. source: "asMokaPixelString\x0a\x09^ self asString, 'px'",
  706. messageSends: [",", "asString"],
  707. referencedClasses: []
  708. }),
  709. globals.Number);
  710. smalltalk.addMethod(
  711. smalltalk.method({
  712. selector: "asMokaCssString",
  713. protocol: '*Moka-Layouts',
  714. fn: function (){
  715. var self=this;
  716. return self;
  717. },
  718. args: [],
  719. source: "asMokaCssString\x0a\x09^ self",
  720. messageSends: [],
  721. referencedClasses: []
  722. }),
  723. globals.String);
  724. });