home *** CD-ROM | disk | FTP | other *** search
- #include "BoolGadget.h"
- #include "BoolGadgetClass.h"
- #include "EmbossedGadgetClass.h"
- #include "pcgWindow.h"
- #ifndef __GNUC__
- #include <clib/exec_protos.h>
- #endif
- #ifdef __GNUC__
- #include <proto/exec.h>
- #endif
- #ifdef __SASC
- #include <proto/exec.h>
- #endif
- #include "amigamem.h"
-
- LONG BoolGadget_Value( BoolGadget *self )
- {
- return ( self->g.Flags & SELECTED );
- }
-
-
- LONG BoolGadget_SetValue( BoolGadget *self, LONG selection )
- {
- struct pcgWindow *window;
-
- window = InteractorWindow( (Interactor *)self );
- if( window->Window ) /* window is open */
- {
- /* NOTE: This may not be KOSHER. The PROPER way is to remove
- * the gadget from the window list, twiddle its bits, and
- * then add it back to the list. (It does work, though.)
- */
- Forbid();
-
- if( selection )
- self->g.Flags |= SELECTED;
- else
- self->g.Flags &= ( ~SELECTED );
-
- Permit();
- }
- else /* Window is not open, can just do it the easy way */
- {
- if( selection )
- self->g.Flags |= SELECTED;
- else
- self->g.Flags &= ( ~SELECTED );
- }
-
- return selection;
- }
-
-
- BOOL BoolGadget_elaborated = FALSE;
-
- struct ValuatorClass BoolGadget_Class;
-
- void BoolGadgetClass_Init( struct ValuatorClass *class )
- {
- ValuatorClass_Init( class );
- EmbossedGadgetClass_Init( (struct InteractorClass *)class );
- class->isa = ValuatorClass();
- class->ClassName = "BoolGadget";
- class->Value = (LONG(*)(Valuator *))BoolGadget_Value;
- class->SetValue = (LONG(*)(Valuator *, LONG))BoolGadget_SetValue;
-
- }
-
-
- struct ValuatorClass *BoolGadgetClass( void )
- {
- if( ! BoolGadget_elaborated )
- {
- BoolGadgetClass_Init( &BoolGadget_Class );
- BoolGadget_elaborated = TRUE;
- }
-
- return &BoolGadget_Class;
- }
-
-
-
- void BoolGadget_Init( BoolGadget *self,
- PIXELS LeftEdge,
- PIXELS TopEdge,
- PIXELS Width,
- PIXELS Height,
- pcg_3DPens Pens,
- char *Label )
- {
- /* REMOVE GADGHCOMP -- EDB */
- EmbossedGadget_Init( self, LeftEdge, TopEdge, Width, Height,
- GADGHCOMP /* GFLG_GADGHNONE */, RELVERIFY, BOOLGADGET,
- Pens, Label );
-
- self->isa = BoolGadgetClass();
- }
-
-