home *** CD-ROM | disk | FTP | other *** search
/ Dream 57 / Amiga_Dream_57.iso / Amiga / Programmation / c / Extensions / APPSource.lha / APlusPlus / libsource / StdGadget.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-29  |  2.9 KB  |  98 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:RCS/libsource/StdGadget.cxx,v $
  9.  **   $Revision: 1.6 $
  10.  **   $Date: 1994/07/27 11:52:03 $
  11.  **   $Author: Armin_Vogt $
  12.  **
  13.  ******************************************************************************/
  14.  
  15.  
  16. extern "C" {
  17. #ifdef __GNUG__
  18. #include <inline/intuition.h>
  19. #endif
  20.  
  21. #ifdef __SASC
  22. #include <proto/intuition.h>
  23. #endif
  24.  
  25. #include <intuition/intuition.h>
  26. }
  27. #include <APlusPlus/intuition/StdGadget.h>
  28.  
  29.  
  30. static const char rcs_id[] = "$Id: StdGadget.cxx,v 1.6 1994/07/27 11:52:03 Armin_Vogt Exp Armin_Vogt $";
  31.  
  32. //runtime type inquiry support
  33. intui_typeinfo(StdGadget, derived(from(GadgetCV)), rcs_id)
  34.  
  35.  
  36. StdGadget::StdGadget(GOB_OWNER, UWORD flags,UWORD activation,UWORD gadgetType,
  37.                         APTR gadgetRender,APTR selectRender,struct IntuiText *gadgetText,
  38.                         LONG mutualExclude,APTR specialInfo,UWORD gadgetID,AttrList& attrs)
  39.    : GadgetCV(gob_owner,attrs)
  40. {
  41.    gadget.Flags      = flags;
  42.    gadget.Activation = activation;
  43.    gadget.GadgetType = gadgetType;
  44.    gadget.GadgetRender  = gadgetRender;
  45.    gadget.SelectRender  = selectRender;
  46.    gadget.GadgetText    = gadgetText;
  47.    gadget.MutualExclude = mutualExclude;
  48.    gadget.SpecialInfo   = specialInfo;
  49.    gadget.GadgetID      = gadgetID;
  50.  
  51.    storeGadget(&gadget);
  52.  
  53.    setIOType(IOTYPE_STDGADGET);
  54. }
  55.  
  56. StdGadget::StdGadget(GOB_OWNER, AttrList& attrs) : GadgetCV(gob_owner,attrs)
  57. {
  58.    gadget.Flags      = (UWORD)attrs.getTagData( SGA_Flags, GFLG_GADGHNONE);
  59.    gadget.Activation = (UWORD)attrs.getTagData( SGA_Activation, GACT_IMMEDIATE|GACT_RELVERIFY);
  60.    gadget.GadgetType = (UWORD)attrs.getTagData( SGA_GadgetType, GTYP_BOOLGADGET);
  61.    gadget.GadgetRender  = (APTR)attrs.getTagData( SGA_GadgetRender, NULL);
  62.    gadget.SelectRender  = (APTR)attrs.getTagData( SGA_SelectRender, NULL);
  63.    gadget.GadgetText    = (struct IntuiText*)attrs.getTagData( GA_Text, NULL);
  64.    gadget.MutualExclude = attrs.getTagData( SGA_MutualExclude, 0);
  65.    gadget.SpecialInfo   = (APTR)attrs.getTagData( SGA_SpecialInfo, NULL);
  66.    gadget.GadgetID      = (UWORD)attrs.getTagData( GA_ID, 0);
  67.  
  68.    storeGadget(&gadget);
  69.  
  70.    setIOType(IOTYPE_STDGADGET);
  71. }
  72.  
  73.  
  74. APTR StdGadget::redrawSelf(GWindow *homeWindow,ULONG& returnType)
  75. {
  76.    gadget.LeftEdge   = (WORD)iLeft();
  77.    gadget.TopEdge    = (WORD)iTop();
  78.    gadget.Width      = (WORD) iWidth();
  79.    gadget.Height     = (WORD)iHeight();
  80.  
  81.    gadget.NextGadget = NULL;     // clear the link
  82.  
  83.    GadgetCV::redrawSelf(homeWindow,returnType);
  84.  
  85.    returnType = IOTYPE_STDGADGET;
  86.    return gadgetPtr();
  87. }
  88.  
  89. ULONG StdGadget::setAttributes(AttrList& attrs)
  90. {
  91.    return GadgetCV::setAttributes(attrs);
  92. }
  93.  
  94. ULONG StdGadget::getAttribute(Tag tag,ULONG& dataStore)
  95. {
  96.    return GadgetCV::getAttribute(tag,dataStore);
  97. }
  98.