home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include "IntegerGadget.h"
- #include "IntegerGadgetClass.h"
- #include "StringGadgetClass.h"
- #include "minmax.h"
- #ifndef __GNUC__
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #endif
- #ifdef __GNUC__
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #endif
- #ifdef __SASC
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #endif
- #include "amigamem.h"
-
-
-
- LONG IntegerGadget_Value( IntegerGadget *self )
- {
- LONG selection;
- struct StringInfo *stringinfo;
-
- stringinfo = (StringInfo *) self->g.SpecialInfo;
-
- Forbid();
- sscanf( stringinfo->Buffer, "%d", &selection );
- Permit();
-
- return selection;
- }
-
- LONG IntegerGadget_SetValue( IntegerGadget *self, LONG selection )
- {
- struct StringInfo *stringinfo;
-
- stringinfo = (StringInfo *) self->g.SpecialInfo;
- Forbid();
- sprintf( stringinfo->Buffer, "%d", selection );
- Permit();
-
- return selection;
- }
-
-
- BOOL IntegerGadget_elaborated = FALSE;
-
- struct ValuatorClass IntegerGadget_Class;
-
- void IntegerGadgetClass_Init( struct ValuatorClass *class )
- {
- StringGadgetClass_Init( class );
- class->isa = StringGadgetClass();
- class->ClassName = "IntegerGadget";
-
- class->Value = (LONG(*)(Valuator *))IntegerGadget_Value;
- class->SetValue = (LONG(*)(Valuator *, LONG))IntegerGadget_SetValue;
-
- }
-
-
- struct ValuatorClass *IntegerGadgetClass( void )
- {
- if( ! IntegerGadget_elaborated )
- {
- IntegerGadgetClass_Init( &IntegerGadget_Class );
- IntegerGadget_elaborated = TRUE;
- }
-
- return &IntegerGadget_Class;
- }
-
-
-
- void IntegerGadget_Init( IntegerGadget *self,
- PIXELS LeftEdge,
- PIXELS TopEdge,
- PIXELS Width,
- USHORT nChars,
- pcg_3DPens Pens,
- char *label )
- {
- struct StringInfo *stringinfo;
-
- StringGadget_Init( self, LeftEdge, TopEdge, Width, nChars,
- Pens, label );
-
- self->isa = IntegerGadgetClass();
-
- stringinfo = (struct StringInfo *)self->g.SpecialInfo;
-
- self->g.Activation |= LONGINT;
- SetValue( (Valuator *)self, 0 );
- }
-
-