Canvas.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. smalltalk.addClass('CanvasRenderingContext', smalltalk.Object, [], 'Canvas');
  2. smalltalk.addMethod(
  3. '_fillStyle_',
  4. smalltalk.method({
  5. selector: 'fillStyle:',
  6. category: 'drawing paths',
  7. fn: function (aString) {
  8. var self = this;
  9. (function () {self.fillStyle = String(aString);}());
  10. return self;
  11. },
  12. source: unescape('fillStyle%3A%20aString%0A%09%7B%27self.fillStyle%20%3D%20String%28aString%29%27%7D')}),
  13. smalltalk.CanvasRenderingContext);
  14. smalltalk.addMethod(
  15. '_beginPath',
  16. smalltalk.method({
  17. selector: 'beginPath',
  18. category: 'drawing paths',
  19. fn: function () {
  20. var self = this;
  21. (function () {self.beginPath();}());
  22. return self;
  23. },
  24. source: unescape('beginPath%0A%09%7B%27self.beginPath%28%29%27%7D')}),
  25. smalltalk.CanvasRenderingContext);
  26. smalltalk.addMethod(
  27. '_closePath',
  28. smalltalk.method({
  29. selector: 'closePath',
  30. category: 'drawing paths',
  31. fn: function () {
  32. var self = this;
  33. (function () {self.closePath();}());
  34. return self;
  35. },
  36. source: unescape('closePath%0A%09%7B%27self.closePath%28%29%27%7D')}),
  37. smalltalk.CanvasRenderingContext);
  38. smalltalk.addMethod(
  39. '_fill',
  40. smalltalk.method({
  41. selector: 'fill',
  42. category: 'drawing paths',
  43. fn: function () {
  44. var self = this;
  45. (function () {self.fill();}());
  46. return self;
  47. },
  48. source: unescape('fill%0A%09%7B%27self.fill%28%29%27%7D')}),
  49. smalltalk.CanvasRenderingContext);
  50. smalltalk.addMethod(
  51. '_stroke',
  52. smalltalk.method({
  53. selector: 'stroke',
  54. category: 'drawing paths',
  55. fn: function () {
  56. var self = this;
  57. (function () {self.stroke();}());
  58. return self;
  59. },
  60. source: unescape('stroke%0A%09%7B%27self.stroke%28%29%27%7D')}),
  61. smalltalk.CanvasRenderingContext);
  62. smalltalk.addMethod(
  63. '_moveTo_',
  64. smalltalk.method({
  65. selector: 'moveTo:',
  66. category: 'drawing paths',
  67. fn: function (aPoint) {
  68. var self = this;
  69. (function () {self.moveTo(aPoint._x(), aPoint._y());}());
  70. return self;
  71. },
  72. source: unescape('moveTo%3A%20aPoint%0A%09%7B%27self.moveTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D')}),
  73. smalltalk.CanvasRenderingContext);
  74. smalltalk.addMethod(
  75. '_lineTo_',
  76. smalltalk.method({
  77. selector: 'lineTo:',
  78. category: 'drawing paths',
  79. fn: function (aPoint) {
  80. var self = this;
  81. (function () {self.lineTo(aPoint._x(), aPoint._y());}());
  82. return self;
  83. },
  84. source: unescape('lineTo%3A%20aPoint%0A%09%7B%27self.lineTo%28aPoint._x%28%29%2C%20aPoint._y%28%29%29%27%7D')}),
  85. smalltalk.CanvasRenderingContext);
  86. smalltalk.addMethod(
  87. '_arcTo_radius_startAngle_endAngle_anticlockwise_',
  88. smalltalk.method({
  89. selector: 'arcTo:radius:startAngle:endAngle:anticlockwise:',
  90. category: 'drawing arcs',
  91. fn: function (aPoint, aNumber, aNumber2, aNumber3, aBoolean) {
  92. var self = this;
  93. (function () {self.arc(aPoint._x(), aPoint._y(), aNumber, aNumber2, aNumber3, aBoolean);}());
  94. return self;
  95. },
  96. source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%20aNumber2%20endAngle%3A%20aNumber3%20anticlockwise%3A%20aBoolean%0A%09%7B%27self.arc%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20aNumber%2C%20aNumber2%2C%20aNumber3%2C%20aBoolean%29%27%7D%20')}),
  97. smalltalk.CanvasRenderingContext);
  98. smalltalk.addMethod(
  99. '_arcTo_radius_',
  100. smalltalk.method({
  101. selector: 'arcTo:radius:',
  102. category: 'drawing arcs',
  103. fn: function (aPoint, aNumber) {
  104. var self = this;
  105. self._arcTo_radius_startAngle_endAngle_anticlockwise_(aPoint, aNumber, 0, smalltalk.Number._pi().__star(2), false);
  106. return self;
  107. },
  108. source: unescape('arcTo%3A%20aPoint%20radius%3A%20aNumber%0A%09self%20arcTo%3A%20aPoint%20radius%3A%20aNumber%20startAngle%3A%200%20endAngle%3A%20Number%20pi%20*%202%20anticlockwise%3A%20false')}),
  109. smalltalk.CanvasRenderingContext);
  110. smalltalk.addMethod(
  111. '_fillRectFrom_to_',
  112. smalltalk.method({
  113. selector: 'fillRectFrom:to:',
  114. category: 'drawing rectangles',
  115. fn: function (aPoint, anotherPoint) {
  116. var self = this;
  117. (function () {self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  118. return self;
  119. },
  120. source: unescape('fillRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  121. smalltalk.CanvasRenderingContext);
  122. smalltalk.addMethod(
  123. '_strokeRectFrom_to_',
  124. smalltalk.method({
  125. selector: 'strokeRectFrom:to:',
  126. category: 'drawing rectangles',
  127. fn: function (aPoint, anotherPoint) {
  128. var self = this;
  129. (function () {self.strokeRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  130. return self;
  131. },
  132. source: unescape('strokeRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.strokeRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  133. smalltalk.CanvasRenderingContext);
  134. smalltalk.addMethod(
  135. '_clearRectFrom_to_',
  136. smalltalk.method({
  137. selector: 'clearRectFrom:to:',
  138. category: 'drawing rectangles',
  139. fn: function (aPoint, anotherPoint) {
  140. var self = this;
  141. (function () {self.fillRect(aPoint._x(), aPoint._y(), anotherPoint._x(), anotherPoint._y());}());
  142. return self;
  143. },
  144. source: unescape('clearRectFrom%3A%20aPoint%20to%3A%20anotherPoint%0A%09%7B%27self.fillRect%28aPoint._x%28%29%2C%20aPoint._y%28%29%2C%20anotherPoint._x%28%29%2C%20anotherPoint._y%28%29%29%27%7D')}),
  145. smalltalk.CanvasRenderingContext);
  146. smalltalk.addMethod(
  147. '_strokeStyle_',
  148. smalltalk.method({
  149. selector: 'strokeStyle:',
  150. category: 'drawing paths',
  151. fn: function (aString) {
  152. var self = this;
  153. (function () {self.strokeStyle = String(aString);}());
  154. return self;
  155. },
  156. source: unescape('strokeStyle%3A%20aString%0A%09%7B%27self.strokeStyle%20%3D%20String%28aString%29%27%7D')}),
  157. smalltalk.CanvasRenderingContext);
  158. smalltalk.addMethod(
  159. '_lineWidth_',
  160. smalltalk.method({
  161. selector: 'lineWidth:',
  162. category: 'drawing paths',
  163. fn: function (aNumber) {
  164. var self = this;
  165. (function () {self.lineWidth = aNumber;}());
  166. return self;
  167. },
  168. source: unescape('lineWidth%3A%20aNumber%0A%09%7B%27self.lineWidth%20%3D%20aNumber%27%7D')}),
  169. smalltalk.CanvasRenderingContext);
  170. smalltalk.addMethod(
  171. '_tagBrush_',
  172. smalltalk.method({
  173. selector: 'tagBrush:',
  174. category: 'instance creation',
  175. fn: function (aTagBrush) {
  176. var self = this;
  177. return function () {return aTagBrush._element().getContext("2d");}();
  178. return self;
  179. },
  180. source: unescape('tagBrush%3A%20aTagBrush%0A%09%5E%7B%27return%20aTagBrush._element%28%29.getContext%28%27%272d%27%27%29%27%7D')}),
  181. smalltalk.CanvasRenderingContext.klass);
  182. smalltalk.addClass('HTMLCanvas', smalltalk.Object, ['root'], 'Canvas');
  183. smalltalk.addMethod(
  184. '_root_',
  185. smalltalk.method({
  186. selector: 'root:',
  187. category: 'accessing',
  188. fn: function (aTagBrush) {
  189. var self = this;
  190. self['@root'] = aTagBrush;
  191. return self;
  192. },
  193. source: unescape('root%3A%20aTagBrush%0A%20%20%20%20root%20%3A%3D%20aTagBrush%0A')}),
  194. smalltalk.HTMLCanvas);
  195. smalltalk.addMethod(
  196. '_root',
  197. smalltalk.method({
  198. selector: 'root',
  199. category: 'accessing',
  200. fn: function () {
  201. var self = this;
  202. return self['@root'];
  203. return self;
  204. },
  205. source: unescape('root%0A%20%20%20%20%5Eroot%0A')}),
  206. smalltalk.HTMLCanvas);
  207. smalltalk.addMethod(
  208. '_initialize',
  209. smalltalk.method({
  210. selector: 'initialize',
  211. category: 'initialization',
  212. fn: function () {
  213. var self = this;
  214. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  215. self['@root'] = smalltalk.TagBrush._fromString_canvas_("div", self);
  216. return self;
  217. },
  218. source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20root%20%3A%3D%20TagBrush%20fromString%3A%20%27div%27%20canvas%3A%20self%0A')}),
  219. smalltalk.HTMLCanvas);
  220. smalltalk.addMethod(
  221. '_with_',
  222. smalltalk.method({
  223. selector: 'with:',
  224. category: 'adding',
  225. fn: function (anObject) {
  226. var self = this;
  227. return self._root()._with_(anObject);
  228. return self;
  229. },
  230. source: unescape('with%3A%20anObject%0A%20%20%20%20%5Eself%20root%20with%3A%20anObject%0A')}),
  231. smalltalk.HTMLCanvas);
  232. smalltalk.addMethod(
  233. '_newTag_',
  234. smalltalk.method({
  235. selector: 'newTag:',
  236. category: 'tags',
  237. fn: function (aString) {
  238. var self = this;
  239. return smalltalk.TagBrush._fromString_canvas_(aString, self);
  240. return self;
  241. },
  242. source: unescape('newTag%3A%20aString%0A%20%20%20%20%5ETagBrush%20fromString%3A%20aString%20canvas%3A%20self%0A')}),
  243. smalltalk.HTMLCanvas);
  244. smalltalk.addMethod(
  245. '_tag_',
  246. smalltalk.method({
  247. selector: 'tag:',
  248. category: 'tags',
  249. fn: function (aString) {
  250. var self = this;
  251. return self['@root']._addBrush_(self._newTag_(aString));
  252. return self;
  253. },
  254. source: unescape('tag%3A%20aString%0A%20%20%20%20%5Eroot%20addBrush%3A%20%28self%20newTag%3A%20aString%29%0A')}),
  255. smalltalk.HTMLCanvas);
  256. smalltalk.addMethod(
  257. '_h1',
  258. smalltalk.method({
  259. selector: 'h1',
  260. category: 'tags',
  261. fn: function () {
  262. var self = this;
  263. return self._tag_("h1");
  264. return self;
  265. },
  266. source: unescape('h1%0A%20%20%20%20%5Eself%20tag%3A%20%27h1%27%0A')}),
  267. smalltalk.HTMLCanvas);
  268. smalltalk.addMethod(
  269. '_h2',
  270. smalltalk.method({
  271. selector: 'h2',
  272. category: 'tags',
  273. fn: function () {
  274. var self = this;
  275. return self._tag_("h2");
  276. return self;
  277. },
  278. source: unescape('h2%0A%20%20%20%20%5Eself%20tag%3A%20%27h2%27%0A')}),
  279. smalltalk.HTMLCanvas);
  280. smalltalk.addMethod(
  281. '_h3',
  282. smalltalk.method({
  283. selector: 'h3',
  284. category: 'tags',
  285. fn: function () {
  286. var self = this;
  287. return self._tag_("h3");
  288. return self;
  289. },
  290. source: unescape('h3%0A%20%20%20%20%5Eself%20tag%3A%20%27h3%27%0A')}),
  291. smalltalk.HTMLCanvas);
  292. smalltalk.addMethod(
  293. '_h4',
  294. smalltalk.method({
  295. selector: 'h4',
  296. category: 'tags',
  297. fn: function () {
  298. var self = this;
  299. return self._tag_("h4");
  300. return self;
  301. },
  302. source: unescape('h4%0A%20%20%20%20%5Eself%20tag%3A%20%27h4%27%0A')}),
  303. smalltalk.HTMLCanvas);
  304. smalltalk.addMethod(
  305. '_h5',
  306. smalltalk.method({
  307. selector: 'h5',
  308. category: 'tags',
  309. fn: function () {
  310. var self = this;
  311. return self._tag_("h5");
  312. return self;
  313. },
  314. source: unescape('h5%0A%20%20%20%20%5Eself%20tag%3A%20%27h5%27%0A')}),
  315. smalltalk.HTMLCanvas);
  316. smalltalk.addMethod(
  317. '_h6',
  318. smalltalk.method({
  319. selector: 'h6',
  320. category: 'tags',
  321. fn: function () {
  322. var self = this;
  323. return self._tag_("h6");
  324. return self;
  325. },
  326. source: unescape('h6%0A%20%20%20%20%5Eself%20tag%3A%20%27h6%27%0A')}),
  327. smalltalk.HTMLCanvas);
  328. smalltalk.addMethod(
  329. '_p',
  330. smalltalk.method({
  331. selector: 'p',
  332. category: 'tags',
  333. fn: function () {
  334. var self = this;
  335. return self._tag_("p");
  336. return self;
  337. },
  338. source: unescape('p%0A%20%20%20%20%5Eself%20tag%3A%20%27p%27%0A')}),
  339. smalltalk.HTMLCanvas);
  340. smalltalk.addMethod(
  341. '_div',
  342. smalltalk.method({
  343. selector: 'div',
  344. category: 'tags',
  345. fn: function () {
  346. var self = this;
  347. return self._tag_("div");
  348. return self;
  349. },
  350. source: unescape('div%0A%20%20%20%20%5Eself%20tag%3A%20%27div%27%0A')}),
  351. smalltalk.HTMLCanvas);
  352. smalltalk.addMethod(
  353. '_span',
  354. smalltalk.method({
  355. selector: 'span',
  356. category: 'tags',
  357. fn: function () {
  358. var self = this;
  359. return self._tag_("span");
  360. return self;
  361. },
  362. source: unescape('span%0A%20%20%20%20%5Eself%20tag%3A%20%27span%27%0A')}),
  363. smalltalk.HTMLCanvas);
  364. smalltalk.addMethod(
  365. '_img',
  366. smalltalk.method({
  367. selector: 'img',
  368. category: 'tags',
  369. fn: function () {
  370. var self = this;
  371. return self._tag_("img");
  372. return self;
  373. },
  374. source: unescape('img%0A%20%20%20%20%5Eself%20tag%3A%20%27img%27%0A')}),
  375. smalltalk.HTMLCanvas);
  376. smalltalk.addMethod(
  377. '_ul',
  378. smalltalk.method({
  379. selector: 'ul',
  380. category: 'tags',
  381. fn: function () {
  382. var self = this;
  383. return self._tag_("ul");
  384. return self;
  385. },
  386. source: unescape('ul%0A%20%20%20%20%5Eself%20tag%3A%20%27ul%27%0A')}),
  387. smalltalk.HTMLCanvas);
  388. smalltalk.addMethod(
  389. '_ol',
  390. smalltalk.method({
  391. selector: 'ol',
  392. category: 'tags',
  393. fn: function () {
  394. var self = this;
  395. return self._tag_("ol");
  396. return self;
  397. },
  398. source: unescape('ol%0A%20%20%20%20%5Eself%20tag%3A%20%27ol%27%0A')}),
  399. smalltalk.HTMLCanvas);
  400. smalltalk.addMethod(
  401. '_li',
  402. smalltalk.method({
  403. selector: 'li',
  404. category: 'tags',
  405. fn: function () {
  406. var self = this;
  407. return self._tag_("li");
  408. return self;
  409. },
  410. source: unescape('li%0A%20%20%20%20%5Eself%20tag%3A%20%27li%27%0A')}),
  411. smalltalk.HTMLCanvas);
  412. smalltalk.addMethod(
  413. '_table',
  414. smalltalk.method({
  415. selector: 'table',
  416. category: 'tags',
  417. fn: function () {
  418. var self = this;
  419. return self._tag_("table");
  420. return self;
  421. },
  422. source: unescape('table%0A%20%20%20%20%5Eself%20tag%3A%20%27table%27%0A')}),
  423. smalltalk.HTMLCanvas);
  424. smalltalk.addMethod(
  425. '_tr',
  426. smalltalk.method({
  427. selector: 'tr',
  428. category: 'tags',
  429. fn: function () {
  430. var self = this;
  431. return self._tag_("tr");
  432. return self;
  433. },
  434. source: unescape('tr%0A%20%20%20%20%5Eself%20tag%3A%20%27tr%27%0A')}),
  435. smalltalk.HTMLCanvas);
  436. smalltalk.addMethod(
  437. '_td',
  438. smalltalk.method({
  439. selector: 'td',
  440. category: 'tags',
  441. fn: function () {
  442. var self = this;
  443. return self._tag_("td");
  444. return self;
  445. },
  446. source: unescape('td%20%0A%20%20%20%20%5Eself%20tag%3A%20%27td%27%0A')}),
  447. smalltalk.HTMLCanvas);
  448. smalltalk.addMethod(
  449. '_th',
  450. smalltalk.method({
  451. selector: 'th',
  452. category: 'tags',
  453. fn: function () {
  454. var self = this;
  455. return self._tag_("th");
  456. return self;
  457. },
  458. source: unescape('th%0A%20%20%20%20%5Eself%20tag%3A%20%27th%27%0A')}),
  459. smalltalk.HTMLCanvas);
  460. smalltalk.addMethod(
  461. '_form',
  462. smalltalk.method({
  463. selector: 'form',
  464. category: 'tags',
  465. fn: function () {
  466. var self = this;
  467. return self._tag_("form");
  468. return self;
  469. },
  470. source: unescape('form%0A%20%20%20%20%5Eself%20tag%3A%20%27form%27%0A')}),
  471. smalltalk.HTMLCanvas);
  472. smalltalk.addMethod(
  473. '_input',
  474. smalltalk.method({
  475. selector: 'input',
  476. category: 'tags',
  477. fn: function () {
  478. var self = this;
  479. return self._tag_("input");
  480. return self;
  481. },
  482. source: unescape('input%0A%20%20%20%20%5Eself%20tag%3A%20%27input%27%0A')}),
  483. smalltalk.HTMLCanvas);
  484. smalltalk.addMethod(
  485. '_button',
  486. smalltalk.method({
  487. selector: 'button',
  488. category: 'tags',
  489. fn: function () {
  490. var self = this;
  491. return self._tag_("button");
  492. return self;
  493. },
  494. source: unescape('button%0A%20%20%20%20%5Eself%20tag%3A%20%27button%27%0A')}),
  495. smalltalk.HTMLCanvas);
  496. smalltalk.addMethod(
  497. '_select',
  498. smalltalk.method({
  499. selector: 'select',
  500. category: 'tags',
  501. fn: function () {
  502. var self = this;
  503. return self._tag_("select");
  504. return self;
  505. },
  506. source: unescape('select%0A%20%20%20%20%5Eself%20tag%3A%20%27select%27%0A')}),
  507. smalltalk.HTMLCanvas);
  508. smalltalk.addMethod(
  509. '_option',
  510. smalltalk.method({
  511. selector: 'option',
  512. category: 'tags',
  513. fn: function () {
  514. var self = this;
  515. return self._tag_("option");
  516. return self;
  517. },
  518. source: unescape('option%0A%20%20%20%20%5Eself%20tag%3A%20%27option%27%0A')}),
  519. smalltalk.HTMLCanvas);
  520. smalltalk.addMethod(
  521. '_textarea',
  522. smalltalk.method({
  523. selector: 'textarea',
  524. category: 'tags',
  525. fn: function () {
  526. var self = this;
  527. return self._tag_("textarea");
  528. return self;
  529. },
  530. source: unescape('textarea%0A%20%20%20%20%5Eself%20tag%3A%20%27textarea%27%0A')}),
  531. smalltalk.HTMLCanvas);
  532. smalltalk.addMethod(
  533. '_a',
  534. smalltalk.method({
  535. selector: 'a',
  536. category: 'tags',
  537. fn: function () {
  538. var self = this;
  539. return self._tag_("a");
  540. return self;
  541. },
  542. source: unescape('a%0A%20%20%20%20%5Eself%20tag%3A%20%27a%27%0A')}),
  543. smalltalk.HTMLCanvas);
  544. smalltalk.addMethod(
  545. '_appendToJQuery_',
  546. smalltalk.method({
  547. selector: 'appendToJQuery:',
  548. category: '*JQuery',
  549. fn: function (aJQuery) {
  550. var self = this;
  551. aJQuery._appendElement_(self['@root']._element());
  552. return self;
  553. },
  554. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20aJQuery%20appendElement%3A%20root%20element%0A')}),
  555. smalltalk.HTMLCanvas);
  556. smalltalk.addMethod(
  557. '_canvas',
  558. smalltalk.method({
  559. selector: 'canvas',
  560. category: 'tags',
  561. fn: function () {
  562. var self = this;
  563. return self._tag_("canvas");
  564. return self;
  565. },
  566. source: unescape('canvas%0A%09%5Eself%20tag%3A%20%27canvas%27%0A')}),
  567. smalltalk.HTMLCanvas);
  568. smalltalk.addClass('TagBrush', smalltalk.Object, ['canvas', 'element'], 'Canvas');
  569. smalltalk.addMethod(
  570. '_contents_',
  571. smalltalk.method({
  572. selector: 'contents:',
  573. category: 'adding',
  574. fn: function (anObject) {
  575. var self = this;
  576. self._asJQuery()._empty();
  577. self._append_(anObject);
  578. return self;
  579. },
  580. source: unescape('contents%3A%20anObject%0A%20%20%20%20self%20asJQuery%20empty.%0A%20%20%20%20self%20append%3A%20anObject%0A')}),
  581. smalltalk.TagBrush);
  582. smalltalk.addMethod(
  583. '_addBrush_',
  584. smalltalk.method({
  585. selector: 'addBrush:',
  586. category: 'adding',
  587. fn: function (aTagBrush) {
  588. var self = this;
  589. self._appendChild_(aTagBrush._element());
  590. return aTagBrush;
  591. return self;
  592. },
  593. source: unescape('addBrush%3A%20aTagBrush%0A%20%20%20%20self%20appendChild%3A%20aTagBrush%20element.%0A%20%20%20%20%5EaTagBrush%0A')}),
  594. smalltalk.TagBrush);
  595. smalltalk.addMethod(
  596. '_with_',
  597. smalltalk.method({
  598. selector: 'with:',
  599. category: 'adding',
  600. fn: function (anObject) {
  601. var self = this;
  602. self._append_(anObject);
  603. return self;
  604. },
  605. source: unescape('with%3A%20anObject%0A%20%20%20%20self%20append%3A%20anObject%0A')}),
  606. smalltalk.TagBrush);
  607. smalltalk.addMethod(
  608. '_append_',
  609. smalltalk.method({
  610. selector: 'append:',
  611. category: 'adding',
  612. fn: function (anObject) {
  613. var self = this;
  614. anObject._appendToBrush_(self);
  615. return self;
  616. },
  617. source: unescape('append%3A%20anObject%0A%20%20%20%20anObject%20appendToBrush%3A%20self%0A')}),
  618. smalltalk.TagBrush);
  619. smalltalk.addMethod(
  620. '_appendToBrush_',
  621. smalltalk.method({
  622. selector: 'appendToBrush:',
  623. category: 'adding',
  624. fn: function (aTagBrush) {
  625. var self = this;
  626. aTagBrush._addBrush_(self);
  627. return self;
  628. },
  629. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20addBrush%3A%20self%0A')}),
  630. smalltalk.TagBrush);
  631. smalltalk.addMethod(
  632. '_appendBlock_',
  633. smalltalk.method({
  634. selector: 'appendBlock:',
  635. category: 'adding',
  636. fn: function (aBlock) {
  637. var self = this;
  638. var root = nil;
  639. root = canvas._root();
  640. canvas._root_(self);
  641. aBlock._value_(canvas);
  642. canvas._root_(root);
  643. return self;
  644. },
  645. source: unescape('appendBlock%3A%20aBlock%0A%20%20%20%20%7C%20root%20%7C%0A%20%20%20%20root%20%3A%3D%20canvas%20root.%0A%20%20%20%20canvas%20root%3A%20self.%0A%20%20%20%20aBlock%20value%3A%20canvas.%0A%20%20%20%20canvas%20root%3A%20root%0A')}),
  646. smalltalk.TagBrush);
  647. smalltalk.addMethod(
  648. '_appendChild_',
  649. smalltalk.method({
  650. selector: 'appendChild:',
  651. category: 'adding',
  652. fn: function (anElement) {
  653. var self = this;
  654. (function () {self['@element'].appendChild(anElement);}());
  655. return self;
  656. },
  657. source: unescape('appendChild%3A%20anElement%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.appendChild%28anElement%29%27%7D%0A')}),
  658. smalltalk.TagBrush);
  659. smalltalk.addMethod(
  660. '_appendString_',
  661. smalltalk.method({
  662. selector: 'appendString:',
  663. category: 'adding',
  664. fn: function (aString) {
  665. var self = this;
  666. self._appendChild_(self._createTextNodeFor_(aString));
  667. return self;
  668. },
  669. source: unescape('appendString%3A%20aString%0A%20%20%20%20self%20appendChild%3A%20%28self%20createTextNodeFor%3A%20aString%29%0A')}),
  670. smalltalk.TagBrush);
  671. smalltalk.addMethod(
  672. '_at_put_',
  673. smalltalk.method({
  674. selector: 'at:put:',
  675. category: 'attributes',
  676. fn: function (aString, aValue) {
  677. var self = this;
  678. (function () {self['@element'].setAttribute(aString, aValue);}());
  679. return self;
  680. },
  681. source: unescape('at%3A%20aString%20put%3A%20aValue%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.setAttribute%28aString%2C%20aValue%29%27%7D%0A')}),
  682. smalltalk.TagBrush);
  683. smalltalk.addMethod(
  684. '_removeAt_',
  685. smalltalk.method({
  686. selector: 'removeAt:',
  687. category: 'attributes',
  688. fn: function (aString) {
  689. var self = this;
  690. (function () {self['@element'].removeAttribute(aString);}());
  691. return self;
  692. },
  693. source: unescape('removeAt%3A%20aString%0A%20%20%20%20%7B%27self%5B%27%27@element%27%27%5D.removeAttribute%28aString%29%27%7D%0A')}),
  694. smalltalk.TagBrush);
  695. smalltalk.addMethod(
  696. '_class_',
  697. smalltalk.method({
  698. selector: 'class:',
  699. category: 'attributes',
  700. fn: function (aString) {
  701. var self = this;
  702. self._at_put_("class", aString);
  703. return self;
  704. },
  705. source: unescape('class%3A%20aString%0A%20%20%20%20self%20at%3A%20%27class%27%20put%3A%20aString%0A')}),
  706. smalltalk.TagBrush);
  707. smalltalk.addMethod(
  708. '_id_',
  709. smalltalk.method({
  710. selector: 'id:',
  711. category: 'attributes',
  712. fn: function (aString) {
  713. var self = this;
  714. self._at_put_("id", aString);
  715. return self;
  716. },
  717. source: unescape('id%3A%20aString%0A%20%20%20%20self%20at%3A%20%27id%27%20put%3A%20aString%0A')}),
  718. smalltalk.TagBrush);
  719. smalltalk.addMethod(
  720. '_src_',
  721. smalltalk.method({
  722. selector: 'src:',
  723. category: 'attributes',
  724. fn: function (aString) {
  725. var self = this;
  726. self._at_put_("src", aString);
  727. return self;
  728. },
  729. source: unescape('src%3A%20aString%0A%20%20%20%20self%20%20at%3A%20%27src%27%20put%3A%20aString%0A')}),
  730. smalltalk.TagBrush);
  731. smalltalk.addMethod(
  732. '_href_',
  733. smalltalk.method({
  734. selector: 'href:',
  735. category: 'attributes',
  736. fn: function (aString) {
  737. var self = this;
  738. self._at_put_("href", aString);
  739. return self;
  740. },
  741. source: unescape('href%3A%20aString%0A%20%20%20%20self%20at%3A%20%27href%27%20put%3A%20aString%0A')}),
  742. smalltalk.TagBrush);
  743. smalltalk.addMethod(
  744. '_title_',
  745. smalltalk.method({
  746. selector: 'title:',
  747. category: 'attributes',
  748. fn: function (aString) {
  749. var self = this;
  750. self._at_put_("title", aString);
  751. return self;
  752. },
  753. source: unescape('title%3A%20aString%0A%20%20%20%20self%20at%3A%20%27title%27%20put%3A%20aString%0A')}),
  754. smalltalk.TagBrush);
  755. smalltalk.addMethod(
  756. '_style_',
  757. smalltalk.method({
  758. selector: 'style:',
  759. category: 'attributes',
  760. fn: function (aString) {
  761. var self = this;
  762. self._at_put_("style", aString);
  763. return self;
  764. },
  765. source: unescape('style%3A%20aString%0A%20%20%20%20self%20at%3A%20%27style%27%20put%3A%20aString%0A')}),
  766. smalltalk.TagBrush);
  767. smalltalk.addMethod(
  768. '_initializeFromString_canvas_',
  769. smalltalk.method({
  770. selector: 'initializeFromString:canvas:',
  771. category: 'initialization',
  772. fn: function (aString, aCanvas) {
  773. var self = this;
  774. self['@element'] = self._createElementFor_(aString);
  775. canvas = aCanvas;
  776. return self;
  777. },
  778. source: unescape('initializeFromString%3A%20aString%20canvas%3A%20aCanvas%0A%20%20%20%20element%20%3A%3D%20self%20createElementFor%3A%20aString.%0A%20%20%20%20canvas%20%3A%3D%20aCanvas%0A')}),
  779. smalltalk.TagBrush);
  780. smalltalk.addMethod(
  781. '_element',
  782. smalltalk.method({
  783. selector: 'element',
  784. category: 'accessing',
  785. fn: function () {
  786. var self = this;
  787. return self['@element'];
  788. return self;
  789. },
  790. source: unescape('element%0A%20%20%20%20%5Eelement%0A')}),
  791. smalltalk.TagBrush);
  792. smalltalk.addMethod(
  793. '_asJQuery',
  794. smalltalk.method({
  795. selector: 'asJQuery',
  796. category: 'converting',
  797. fn: function () {
  798. var self = this;
  799. return function () {return smalltalk.JQuery._from_(jQuery(self['@element']));}();
  800. return self;
  801. },
  802. source: unescape('asJQuery%0A%20%20%20%20%5E%7B%27return%20smalltalk.JQuery._from_%28jQuery%28self%5B%27%27@element%27%27%5D%29%29%27%7D%0A')}),
  803. smalltalk.TagBrush);
  804. smalltalk.addMethod(
  805. '_asJQueryDo_',
  806. smalltalk.method({
  807. selector: 'asJQueryDo:',
  808. category: 'converting',
  809. fn: function (aBlock) {
  810. var self = this;
  811. aBlock._value_(self._asJQuery());
  812. return self;
  813. },
  814. source: unescape('asJQueryDo%3A%20aBlock%0A%20%20%20%20aBlock%20value%3A%20self%20asJQuery%0A')}),
  815. smalltalk.TagBrush);
  816. smalltalk.addMethod(
  817. '_onKeyDown_',
  818. smalltalk.method({
  819. selector: 'onKeyDown:',
  820. category: 'events',
  821. fn: function (aBlock) {
  822. var self = this;
  823. self._asJQuery()._on_do_("keydown", aBlock);
  824. return self;
  825. },
  826. source: unescape('onKeyDown%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keydown%27%20do%3A%20aBlock%0A')}),
  827. smalltalk.TagBrush);
  828. smalltalk.addMethod(
  829. '_onKeyPress_',
  830. smalltalk.method({
  831. selector: 'onKeyPress:',
  832. category: 'events',
  833. fn: function (aBlock) {
  834. var self = this;
  835. self._asJQuery()._on_do_("keypress", aBlock);
  836. return self;
  837. },
  838. source: unescape('onKeyPress%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keypress%27%20do%3A%20aBlock%0A')}),
  839. smalltalk.TagBrush);
  840. smalltalk.addMethod(
  841. '_onKeyUp_',
  842. smalltalk.method({
  843. selector: 'onKeyUp:',
  844. category: 'events',
  845. fn: function (aBlock) {
  846. var self = this;
  847. self._asJQuery()._on_do_("keyup", aBlock);
  848. return self;
  849. },
  850. source: unescape('onKeyUp%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27keyup%27%20do%3A%20aBlock%0A')}),
  851. smalltalk.TagBrush);
  852. smalltalk.addMethod(
  853. '_onFocus_',
  854. smalltalk.method({
  855. selector: 'onFocus:',
  856. category: 'events',
  857. fn: function (aBlock) {
  858. var self = this;
  859. self._asJQuery()._on_do_("focus", aBlock);
  860. return self;
  861. },
  862. source: unescape('onFocus%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27focus%27%20do%3A%20aBlock%0A')}),
  863. smalltalk.TagBrush);
  864. smalltalk.addMethod(
  865. '_onBlur_',
  866. smalltalk.method({
  867. selector: 'onBlur:',
  868. category: 'events',
  869. fn: function (aBlock) {
  870. var self = this;
  871. self._asJQuery()._on_do_("blur", aBlock);
  872. return self;
  873. },
  874. source: unescape('onBlur%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27blur%27%20do%3A%20aBlock%0A')}),
  875. smalltalk.TagBrush);
  876. smalltalk.addMethod(
  877. '_onChange_',
  878. smalltalk.method({
  879. selector: 'onChange:',
  880. category: 'events',
  881. fn: function (aBlock) {
  882. var self = this;
  883. self._asJQuery()._on_do_("change", aBlock);
  884. return self;
  885. },
  886. source: unescape('onChange%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27change%27%20do%3A%20aBlock%0A')}),
  887. smalltalk.TagBrush);
  888. smalltalk.addMethod(
  889. '_onClick_',
  890. smalltalk.method({
  891. selector: 'onClick:',
  892. category: 'events',
  893. fn: function (aBlock) {
  894. var self = this;
  895. self._asJQuery()._on_do_("click", aBlock);
  896. return self;
  897. },
  898. source: unescape('onClick%3A%20aBlock%0A%20%20%20%20self%20asJQuery%20on%3A%20%27click%27%20do%3A%20aBlock%0A')}),
  899. smalltalk.TagBrush);
  900. smalltalk.addMethod(
  901. '_createElementFor_',
  902. smalltalk.method({
  903. selector: 'createElementFor:',
  904. category: 'private',
  905. fn: function (aString) {
  906. var self = this;
  907. return function () {return document.createElement(String(aString));}();
  908. return self;
  909. },
  910. source: unescape('createElementFor%3A%20aString%0A%20%20%20%20%5E%7B%27return%20document.createElement%28String%28aString%29%29%27%7D%0A')}),
  911. smalltalk.TagBrush);
  912. smalltalk.addMethod(
  913. '_createTextNodeFor_',
  914. smalltalk.method({
  915. selector: 'createTextNodeFor:',
  916. category: 'private',
  917. fn: function (aString) {
  918. var self = this;
  919. return function () {return document.createTextNode(String(aString));}();
  920. return self;
  921. },
  922. source: unescape('createTextNodeFor%3A%20aString%0A%20%20%20%20%5E%7B%27return%20document.createTextNode%28String%28aString%29%29%27%7D%0A')}),
  923. smalltalk.TagBrush);
  924. smalltalk.addMethod(
  925. '_fromString_canvas_',
  926. smalltalk.method({
  927. selector: 'fromString:canvas:',
  928. category: 'instance creation',
  929. fn: function (aString, aCanvas) {
  930. var self = this;
  931. return function ($rec) {$rec._initializeFromString_canvas_(aString, aCanvas);return $rec._yourself();}(self._new());
  932. return self;
  933. },
  934. source: unescape('fromString%3A%20aString%20canvas%3A%20aCanvas%0A%20%20%20%20%5Eself%20new%0A%09initializeFromString%3A%20aString%20canvas%3A%20aCanvas%3B%0A%09yourself%0A')}),
  935. smalltalk.TagBrush.klass);
  936. smalltalk.addClass('Widget', smalltalk.Object, ['root'], 'Canvas');
  937. smalltalk.addMethod(
  938. '_root',
  939. smalltalk.method({
  940. selector: 'root',
  941. category: 'accessing',
  942. fn: function () {
  943. var self = this;
  944. return self['@root'];
  945. return self;
  946. },
  947. source: unescape('root%0A%20%20%20%20%5Eroot%0A')}),
  948. smalltalk.Widget);
  949. smalltalk.addMethod(
  950. '_appendToBrush_',
  951. smalltalk.method({
  952. selector: 'appendToBrush:',
  953. category: 'adding',
  954. fn: function (aTagBrush) {
  955. var self = this;
  956. self._appendToJQuery_(aTagBrush._asJQuery());
  957. return self;
  958. },
  959. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20self%20appendToJQuery%3A%20aTagBrush%20asJQuery%0A')}),
  960. smalltalk.Widget);
  961. smalltalk.addMethod(
  962. '_appendToJQuery_',
  963. smalltalk.method({
  964. selector: 'appendToJQuery:',
  965. category: 'adding',
  966. fn: function (aJQuery) {
  967. var self = this;
  968. self._render();
  969. aJQuery._append_(self._root()._asJQuery());
  970. return self;
  971. },
  972. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20self%20render.%0A%20%20%20%20aJQuery%20append%3A%20self%20root%20asJQuery%0A')}),
  973. smalltalk.Widget);
  974. smalltalk.addMethod(
  975. '_alert_',
  976. smalltalk.method({
  977. selector: 'alert:',
  978. category: 'actions',
  979. fn: function (aString) {
  980. var self = this;
  981. (function () {alert(aString);}());
  982. return self;
  983. },
  984. source: unescape('alert%3A%20aString%0A%20%20%20%20%7B%27alert%28aString%29%27%7D%0A')}),
  985. smalltalk.Widget);
  986. smalltalk.addMethod(
  987. '_confirm_',
  988. smalltalk.method({
  989. selector: 'confirm:',
  990. category: 'actions',
  991. fn: function (aString) {
  992. var self = this;
  993. return function () {return window.confirm(aString);}();
  994. return self;
  995. },
  996. source: unescape('confirm%3A%20aString%0A%20%20%20%20%5E%7B%27return%20window.confirm%28aString%29%27%7D%0A')}),
  997. smalltalk.Widget);
  998. smalltalk.addMethod(
  999. '_prompt_',
  1000. smalltalk.method({
  1001. selector: 'prompt:',
  1002. category: 'actions',
  1003. fn: function (aString) {
  1004. var self = this;
  1005. return self._prompt_default_(aString, "");
  1006. return self;
  1007. },
  1008. source: unescape('prompt%3A%20aString%0A%20%20%20%20%5Eself%20prompt%3A%20aString%20default%3A%20%27%27%0A')}),
  1009. smalltalk.Widget);
  1010. smalltalk.addMethod(
  1011. '_prompt_default_',
  1012. smalltalk.method({
  1013. selector: 'prompt:default:',
  1014. category: 'actions',
  1015. fn: function (aString, anotherString) {
  1016. var self = this;
  1017. return function () {return window.prompt(aString, anotherString);}();
  1018. return self;
  1019. },
  1020. source: unescape('prompt%3A%20aString%20default%3A%20anotherString%0A%20%20%20%20%5E%7B%27return%20window.prompt%28aString%2C%20anotherString%29%27%7D%0A')}),
  1021. smalltalk.Widget);
  1022. smalltalk.addMethod(
  1023. '_update',
  1024. smalltalk.method({
  1025. selector: 'update',
  1026. category: 'actions',
  1027. fn: function () {
  1028. var self = this;
  1029. var canvas = nil;
  1030. canvas = smalltalk.HTMLCanvas._new();
  1031. canvas._root_(self._root());
  1032. self._root()._asJQuery()._empty();
  1033. self._renderOn_(canvas);
  1034. return self;
  1035. },
  1036. source: unescape('update%0A%20%20%20%20%7C%20canvas%20%7C%0A%20%20%20%20canvas%20%3A%3D%20HTMLCanvas%20new.%0A%20%20%20%20canvas%20root%3A%20self%20root.%0A%20%20%20%20self%20root%20asJQuery%20empty.%0A%20%20%20%20self%20renderOn%3A%20canvas%0A')}),
  1037. smalltalk.Widget);
  1038. smalltalk.addMethod(
  1039. '_render',
  1040. smalltalk.method({
  1041. selector: 'render',
  1042. category: 'rendering',
  1043. fn: function () {
  1044. var self = this;
  1045. var canvas = nil;
  1046. canvas = smalltalk.HTMLCanvas._new();
  1047. self['@root'] = canvas._root();
  1048. self._renderOn_(canvas);
  1049. return self;
  1050. },
  1051. source: unescape('render%0A%20%20%20%20%7C%20canvas%20%7C%0A%20%20%20%20canvas%20%3A%3D%20HTMLCanvas%20new.%0A%20%20%20%20root%20%3A%3D%20canvas%20root.%0A%20%20%20%20self%20renderOn%3A%20canvas%0A')}),
  1052. smalltalk.Widget);
  1053. smalltalk.addMethod(
  1054. '_renderOn_',
  1055. smalltalk.method({
  1056. selector: 'renderOn:',
  1057. category: 'rendering',
  1058. fn: function (html) {
  1059. var self = this;
  1060. return self;
  1061. },
  1062. source: unescape('renderOn%3A%20html%0A%20%20%20%20self%0A')}),
  1063. smalltalk.Widget);
  1064. smalltalk.addClass('CanvasBrush', smalltalk.TagBrush, [], 'Canvas');
  1065. smalltalk.addMethod(
  1066. '_createElement',
  1067. smalltalk.method({
  1068. selector: 'createElement',
  1069. category: 'private',
  1070. fn: function () {
  1071. var self = this;
  1072. return function () {return document.createElement("canvas");}();
  1073. return self;
  1074. },
  1075. source: unescape('createElement%0A%20%20%20%20%5E%7B%27return%20document.createElement%28%27%27canvas%27%27%29%27%7D%0A')}),
  1076. smalltalk.CanvasBrush);
  1077. smalltalk.addMethod(
  1078. '_initializeWithCanvas_',
  1079. smalltalk.method({
  1080. selector: 'initializeWithCanvas:',
  1081. category: 'initialization',
  1082. fn: function (aCanvas) {
  1083. var self = this;
  1084. canvas = aCanvas;
  1085. return self;
  1086. },
  1087. source: unescape('initializeWithCanvas%3A%20aCanvas%0A%09canvas%20%3A%3D%20aCanvas')}),
  1088. smalltalk.CanvasBrush);
  1089. smalltalk.addMethod(
  1090. '_canvas_',
  1091. smalltalk.method({
  1092. selector: 'canvas:',
  1093. category: 'instance creation',
  1094. fn: function (aCanvas) {
  1095. var self = this;
  1096. return function ($rec) {$rec._initializeWithCanvas_(aCanvas);return $rec._yourself();}(self._new());
  1097. return self;
  1098. },
  1099. source: unescape('canvas%3A%20aCanvas%0A%09%5Eself%20new%0A%09%09initializeWithCanvas%3A%20aCanvas%3B%0A%09%09yourself')}),
  1100. smalltalk.CanvasBrush.klass);