home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / aplusplus-1.01-src.lha / GNU / src / amiga / APlusPlus-1.01 / libsource / GT_String.cxx < prev    next >
C/C++ Source or Header  |  1994-05-08  |  2KB  |  72 lines

  1. /******************************************************************************
  2.  **
  3.  **    C++ Class Library for the Amiga© system software.
  4.  **
  5.  **    Copyright (C) 1994 by Armin Vogt  **  EMail: armin@uni-paderborn.de
  6.  **    All Rights Reserved.
  7.  **
  8.  **    $Source: apphome:APlusPlus/RCS/libsource/GT_String.cxx,v $
  9.  **    $Revision: 1.6 $
  10.  **    $Date: 1994/05/08 13:47:26 $
  11.  **    $Author: Armin_Vogt $
  12.  **
  13.  ******************************************************************************/
  14.  
  15.  
  16. extern "C" {
  17. #ifdef __GNUG__
  18. #endif
  19.  
  20. #ifdef __SASC
  21. #endif
  22. }
  23. #include <APlusPlus/intuition/GT_Gadgets/GT_String.h>
  24.  
  25.  
  26. volatile static char rcs_id[] = "$Id: GT_String.cxx,v 1.6 1994/05/08 13:47:26 Armin_Vogt Exp Armin_Vogt $";
  27.  
  28.  
  29. GT_String::GT_String(GOB_OWNER,AttrList& attrs) : GT_Gadget(gob_owner,STRING_KIND,attrs) 
  30. }
  31.  
  32.  
  33. void GT_String::callback(const IntuiMessageC *imsg)
  34.    /* String gadgets will send GADGETUP for each RETURN,HELP and TAB.
  35.    */
  36. {
  37.    switch (imsg->getClass())
  38.    {
  39.       default:
  40.          setAttrs( AttrList(GTST_String,((struct StringInfo*)gadgetPtr()->SpecialInfo)->Buffer,TAG_END) );
  41.          break;
  42.    }
  43. }
  44.  
  45. ULONG GT_String::getAttribute(Tag tag,ULONG& dataStore)
  46. {
  47.    if (gadgetPtr())
  48.    {
  49.       switch (tag)
  50.        {
  51.            case GTST_String : return (dataStore=(ULONG)((struct StringInfo*)gadgetPtr()->SpecialInfo)->Buffer);
  52.            default : return GT_Gadget::getAttribute(tag,dataStore);
  53.        }
  54.    }
  55.    else return GT_Gadget::getAttribute(tag,dataStore);
  56. }
  57.  
  58. APTR GT_String::redrawSelf(GWindow *homeWindow,ULONG& returnType)
  59. {
  60.    if (gadgetPtr())
  61.    {
  62.        ULONG dummy;
  63.        intuiAttrs().updateAttrs( AttrList(GTST_String,getAttribute(GTST_String,dummy),TAG_END) );
  64.        // before the GT-string gadget is being deleted the edit buffer address needs to be copied
  65.        // to gadget that will be created in GT_Gadget::redrawSelf(). There, a new edit buffer is
  66.        // allocated and the old one's contents are copied to it.
  67.        // The old gadget will be deleted after this method has returned.
  68.         // AttrList::update() is used since no notification shall be triggered.
  69.    }
  70.     return GT_Gadget::redrawSelf(homeWindow,returnType);
  71. }