home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / baku100.zip / baku100 / Kernel / Util / TextEditor.tonyu < prev    next >
Text File  |  2005-09-09  |  1KB  |  57 lines

  1. extends Object;
  2.  
  3. function setTextListener(l) {
  4.   flushTextListener();
  5.   textListener=l;
  6.   subProcess(l);
  7. }
  8.  
  9. function onSubProcess(l) {
  10.   print ("SBP :"+textListener);
  11.   while(!isEditing()) suspend();
  12.   while(isEditing()) suspend();
  13.   flushTextListener();
  14. }
  15. function flushTextListener() {
  16.   print ("FTL :"+textListener);
  17.   if (textListener) {
  18.     textListener.onTextEditComplete(getText());
  19.     textListener=null;
  20.   }
  21. }
  22. constructor TextEditor () {
  23.   x=50;y=50;w=200;h=200;
  24.   fontName="élér âSâVâbâN";
  25.   fontSize=11;
  26.   lines=0;
  27. }
  28. function setPosition(x,y,w,h) {
  29.   if (h==0) lines=1; else lines=0;
  30.   this.x=x;this.y=y;
  31.   this.w=w;this.h=h;
  32. }
  33. function setFont(size,name) {
  34.   if (name) fontName=name;
  35.   fontSize=size;
  36. }
  37.  
  38. native _n_edit;
  39. function edit() {
  40.   _n_edit(x,y,w,h,fontName,fontSize,lines);
  41. }
  42. native _n_isEditing;
  43. function isEditing() {
  44.   return _n_isEditing();
  45. }
  46. native _n_getText;
  47.  
  48. function getText() {
  49.   return _n_getText();
  50. }
  51.  
  52. native _n_setText;
  53. function setText(s) {
  54.   return _n_setText(s);
  55. }
  56.  
  57.