home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CScrollList 1.0 / Demo Classes / CEditString.c next >
Encoding:
C/C++ Source or Header  |  1994-11-30  |  2.6 KB  |  102 lines  |  [TEXT/KAHL]

  1. /*************************************************************************************
  2.  
  3.  CEditString.c
  4.     
  5.         Class for editing strings stored in the CStringArray class.
  6.     
  7.     SUPERCLASS = CDialogText
  8.     
  9.         © 1992 Dave Harkness
  10.  
  11. *************************************************************************************/
  12.  
  13.  
  14. #include "CEditString.h"
  15. #include "CStringEditList.h"
  16. #include <Global.h>
  17. #include <Constants.h>
  18.  
  19.  
  20. extern CBureaucrat        *gGopher;
  21.  
  22.  
  23. /*************************************************************************************
  24.  IEditString
  25.  
  26.     Initialize the CDialogText and then do our own.
  27. *************************************************************************************/
  28.  
  29. void
  30. CEditString::IEditString( CView *anEnclosure, CView *aSupervisor,
  31.                           short aWidth, short aHeight,
  32.                           short aHEncl, short aVEncl,
  33.                           SizingOption aHSizing, SizingOption aVSizing,
  34.                           short aLineWidth)
  35.  
  36. {
  37.     CDialogText::IDialogText( anEnclosure, aSupervisor, aWidth, aHeight,
  38.                               aHEncl, aVEncl, aHSizing, aVSizing, aLineWidth);
  39.     
  40.     SetFontNumber( geneva);
  41.     SetFontSize( 9);
  42.     SetConstraints( FALSE, 255);
  43.     validateOnResign = FALSE;                            // no validation
  44.  
  45. }  /* CEditString::IEditString */
  46.  
  47.  
  48. /*************************************************************************************
  49.  MakeBorder  {OVERRIDE}
  50.  
  51.     We want our border to only have a one pixel margin.
  52. *************************************************************************************/
  53.  
  54. void
  55. CEditString::MakeBorder( void)
  56.  
  57. {
  58.     SetBorder( NULL);
  59.  
  60. }  /* CEditString::MakeBorder */
  61.  
  62.  
  63. /*************************************************************************************
  64.  DoKeyDown  {OVERRIDE}
  65.  
  66.     Traps the clear key (for deleting the cell.
  67. *************************************************************************************/
  68.  
  69. void
  70. CEditString::DoKeyDown( char theChar, Byte keyCode, EventRecord *macEvent)
  71. {
  72.     if ( theChar == kEscapeOrClear )
  73.         itsSupervisor->DoKeyDown( theChar, keyCode, macEvent);
  74.     else
  75.         inherited::DoKeyDown( theChar, keyCode, macEvent);
  76.  
  77. }  /* CEditString::DoKeyDown */
  78.  
  79.  
  80. /*************************************************************************************
  81.  BecomeGopher  {OVERRIDE}
  82.  
  83.     If we are resigning as gopher, broadcast that we are done editing.
  84. *************************************************************************************/
  85.  
  86. Boolean
  87. CEditString::BecomeGopher( Boolean fBecoming)
  88.  
  89. {
  90.     if ( fBecoming && !visible )
  91.         return itsSupervisor->BecomeGopher( TRUE);
  92.     
  93.     if ( !inherited::BecomeGopher( fBecoming) )
  94.         return FALSE;
  95.     
  96.     if ( !fBecoming )
  97.         BroadcastChange( editStringDoneEditing, NULL);
  98.     
  99.     return TRUE;
  100.  
  101. }  /* CEditString::BecomeGopher */
  102.