home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dokpr1.zip / posys / sampcont.cpp < prev    next >
Text File  |  1995-11-09  |  4KB  |  166 lines

  1. /**************************************************************************
  2.  *                                                                        *
  3.  *                                                                        *
  4.  *          This code is copyright (c) 1994                               *
  5.  *                     Athena Design, Inc.                                *
  6.  *                     and David Pollak                                   *
  7.  *                                                                        *
  8.  *                ALL RIGHTS RESERVED                                     *
  9.  *                                                                        *
  10.  *                                                                        *
  11.  *                                                                        *
  12.  *                                                                        *
  13.  *                                                                        *
  14.  **************************************************************************/
  15.  
  16. #include "posys.h"
  17. #include "sampcont.h"
  18. #include "editstr.h"
  19. #include "rect.h"
  20. #include "mesaview.h"
  21. #include <stdio.h>
  22.  
  23. MSampleController :: MSampleController(const char *lic,int &enable,HAB hab,int USERGB)
  24.     : MGController(lic,enable,hab,USERGB)
  25. {
  26.     hitPoint.set(0,0);
  27.     evptr=NULL;
  28.     activeWnd=NULL;
  29. }
  30.  
  31. MSampleController :: ~MSampleController()
  32. {
  33.     if (evptr) {
  34.        evptr->cleanUp();
  35.        delete evptr;
  36.     } // endif
  37. }
  38.  
  39. void MSampleController :: addToDestroyList(HWND)
  40. {
  41. }
  42.  
  43. int MSampleController :: beAlive()
  44. {
  45.     return 1;
  46. }
  47.  
  48. int MSampleController :: getInBeAlive()
  49. {
  50.     return 0;
  51. }
  52.  
  53. MPoint MSampleController :: getHitPoint()
  54. {
  55.     return hitPoint;
  56. }
  57.  
  58. void MSampleController :: setHitPoint(int x,int y)
  59. {
  60.     hitPoint.set(x,y);
  61. }
  62.  
  63.  
  64. HWND MSampleController :: getApplicationFrameWindow()
  65. {
  66.     return 0;
  67. }
  68.  
  69. HWND MSampleController :: getApplicationClientWindow()
  70. {
  71.     return 0;
  72. }
  73.  
  74.  
  75. int MSampleController :: handleKey(int,int)
  76. {
  77.     return 0;
  78. }
  79.  
  80. void MSampleController :: runScript(const char *,MException *)
  81. {
  82. }
  83.  
  84. const char * MSampleController :: getCurrencyChars(int page,int chr)
  85. {
  86.     static char *cur[] = {
  87.         // dollars
  88.         ".",",","$","",
  89.         // yen
  90.         ".",",","\xBE","",
  91.         // pounds
  92.         ".",",","\x9C","",
  93.         // ??
  94.         ",",".","",""};
  95.  
  96.     return cur[page * 4 + chr];
  97. }
  98.  
  99. // invokes an edit view
  100. void MSampleController :: invokeEdit( MEditString * edstr)
  101. {
  102.     if (activeWnd) {
  103.         WinSendMsg(activeWnd,WM_CREATEEDIT,(MPARAM)edstr,NULL);
  104.     } // endif
  105. }
  106.  
  107. // set the formula in the formula bar
  108. void MSampleController :: setFormulaView( const char * txt)
  109. {
  110.     if (activeWnd) {
  111.         WinSendMsg(activeWnd,WM_SETFORMULATXT,(MPARAM)txt,NULL);
  112.     } // endif
  113. }
  114.  
  115. void MSampleController :: removeEdit()
  116. {
  117.     if (activeWnd) {
  118.         WinSendMsg(activeWnd,WM_REMOVEEDIT,NULL,NULL);
  119.     } // endif
  120. }
  121.  
  122. int MSampleController :: getInCellEditing()
  123. {
  124.     if (activeWnd) {
  125.         return (int)WinSendMsg(activeWnd,WM_INCELLEDIT,NULL,NULL);
  126.     } // endif
  127.     return 0;
  128. }
  129.  
  130. void MSampleController :: updateFormulaView()
  131. {
  132.     if (activeWnd) {
  133.         WinSendMsg(activeWnd,WM_UPDATEFORMULA,NULL,NULL);
  134.     } // endif
  135. }
  136.  
  137. MEditView *MSampleController :: getEditView()
  138. {
  139.     if (activeWnd) {
  140.         return (MEditView *)WinSendMsg(activeWnd,WM_GETEDITVIEW,NULL,NULL);
  141.     } // endif
  142.     return NULL;
  143. }
  144.  
  145. // these two methods are here for the moment.  In future versions these methods
  146. // might be eliminated because they aren't needed.
  147. int MSampleController :: isEditingFormula()
  148. {
  149.  return 0;
  150. }
  151.  
  152. int MSampleController :: isEditing()
  153. {
  154.  return 0;
  155. }
  156.  
  157. void MSampleController :: setHandleForEditViewOwner(HWND hwnd)
  158. {
  159.     if (evptr) {
  160.        evptr->cleanUp();
  161.        delete evptr;
  162.        evptr=NULL;
  163.     } // endif
  164.     activeWnd=hwnd;
  165. }
  166.