Moka-Controllers.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. define("amber_core/Moka-Controllers", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Moka-Core"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Moka-Controllers');
  3. smalltalk.packages["Moka-Controllers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('MKAnyKeyInputController', smalltalk.MKAspectController, [], 'Moka-Controllers');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "inputText",
  8. category: 'accessing]',
  9. fn: function (){
  10. var self=this;
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1;
  13. $1=_st(self._view())._value();
  14. return $1;
  15. }, function($ctx1) {$ctx1.fill(self,"inputText",{},smalltalk.MKAnyKeyInputController)})},
  16. args: [],
  17. source: "inputText\x0a\x09^ self view value",
  18. messageSends: ["value", "view"],
  19. referencedClasses: []
  20. }),
  21. smalltalk.MKAnyKeyInputController);
  22. smalltalk.addMethod(
  23. smalltalk.method({
  24. selector: "onKeyPressed:",
  25. category: 'actions',
  26. fn: function (anEvent){
  27. var self=this;
  28. return smalltalk.withContext(function($ctx1) {
  29. self._performActionWith_(self._inputText());
  30. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPressed:",{anEvent:anEvent},smalltalk.MKAnyKeyInputController)})},
  31. args: ["anEvent"],
  32. source: "onKeyPressed: anEvent\x0a\x09self performActionWith: self inputText",
  33. messageSends: ["performActionWith:", "inputText"],
  34. referencedClasses: []
  35. }),
  36. smalltalk.MKAnyKeyInputController);
  37. smalltalk.addClass('MKEnterInputController', smalltalk.MKAnyKeyInputController, [], 'Moka-Controllers');
  38. smalltalk.MKEnterInputController.comment="I am the default controller for `MKInputView`. \x0aActions are performed on 'enter' key press.";
  39. smalltalk.addMethod(
  40. smalltalk.method({
  41. selector: "onKeyPressed:",
  42. category: 'actions',
  43. fn: function (anEvent){
  44. var self=this;
  45. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  46. return smalltalk.withContext(function($ctx1) {
  47. var $1;
  48. $1=_st(_st(anEvent)._keyCode()).__eq(_st(_st($String())._cr())._asciiValue());
  49. if(smalltalk.assert($1)){
  50. smalltalk.MKEnterInputController.superclass.fn.prototype._onKeyPressed_.apply(_st(self), [anEvent]);
  51. };
  52. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPressed:",{anEvent:anEvent},smalltalk.MKEnterInputController)})},
  53. args: ["anEvent"],
  54. source: "onKeyPressed: anEvent\x0a\x09anEvent keyCode = String cr asciiValue ifTrue: [\x0a\x09\x09super onKeyPressed: anEvent ]",
  55. messageSends: ["ifTrue:", "=", "keyCode", "asciiValue", "cr", "onKeyPressed:"],
  56. referencedClasses: ["String"]
  57. }),
  58. smalltalk.MKEnterInputController);
  59. smalltalk.addClass('MKButtonController', smalltalk.MKAspectController, [], 'Moka-Controllers');
  60. smalltalk.MKButtonController.comment="I am the default controller for `MKButtonView`.";
  61. smalltalk.addMethod(
  62. smalltalk.method({
  63. selector: "onPressed",
  64. category: 'actions',
  65. fn: function (){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) {
  68. self._performAction();
  69. return self}, function($ctx1) {$ctx1.fill(self,"onPressed",{},smalltalk.MKButtonController)})},
  70. args: [],
  71. source: "onPressed\x0a\x09self performAction",
  72. messageSends: ["performAction"],
  73. referencedClasses: []
  74. }),
  75. smalltalk.MKButtonController);
  76. smalltalk.addClass('MKCheckboxController', smalltalk.MKAspectController, [], 'Moka-Controllers');
  77. smalltalk.MKCheckboxController.comment="I am the default controller for `MKCheckboxView`.";
  78. smalltalk.addMethod(
  79. smalltalk.method({
  80. selector: "onToggled:",
  81. category: 'actions',
  82. fn: function (aBoolean){
  83. var self=this;
  84. return smalltalk.withContext(function($ctx1) {
  85. self._performActionWith_(aBoolean);
  86. return self}, function($ctx1) {$ctx1.fill(self,"onToggled:",{aBoolean:aBoolean},smalltalk.MKCheckboxController)})},
  87. args: ["aBoolean"],
  88. source: "onToggled: aBoolean\x0a\x09self performActionWith: aBoolean",
  89. messageSends: ["performActionWith:"],
  90. referencedClasses: []
  91. }),
  92. smalltalk.MKCheckboxController);
  93. });