home *** CD-ROM | disk | FTP | other *** search
- #include "parms.h"
- #include "BuilderMethods.h"
- #include "ToolButton.h"
- #include "ValuatorClass.h"
- #include "BoolGadget.h" /* added for boolgadget prototypes -- EDB */
- #ifndef __GNUC__
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/graphics_protos.h>
- #endif
- #ifdef __GNUC__
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #endif
- #ifdef __SASC
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/graphics.h>
- #endif
-
- #include "amigamem.h"
-
- USHORT ToolButton_Respond( ToolButton *self,
- IntuiMessage *Event )
- {
- USHORT response = 0;
-
- switch( Event->Class )
- {
- case REFRESHWINDOW:
- Refresh( (struct Interactor *)self );
- response = RESPONDED;
- break;
-
- case GADGETDOWN:
- if( Event->IAddress == (void *)&self->g )
- {
- response = RESPONDED | CONSUMED_EVENT | CHANGED_STATE;
- }
- break;
-
- case GADGETUP:
- if( Event->IAddress == (void *)&self->g )
- {
- response = RESPONDED | CONSUMED_EVENT | CHANGED_STATE;
- }
- break;
-
- }
- return response;
- }
-
- BOOL ToolButton_elaborated = FALSE;
-
- struct ValuatorClass ToolButton_Class;
-
- struct ValuatorClass *ToolButtonClass( void )
- {
- if( ! ToolButton_elaborated )
- ToolButtonClass_Init( &ToolButton_Class );
-
- return &ToolButton_Class;
- }
-
- void ToolButtonClass_Init( struct ValuatorClass *class )
- {
- BoolGadgetClass_Init( class );
- class->isa = BoolGadgetClass();
- class->ClassName = "ToolButton";
- class->Respond = (USHORT(*)(Interactor *, IntuiMessage *))ToolButton_Respond;
- }
-
- void ToolButton_Init( ToolButton *self,
- WORD leftedge,
- WORD topedge,
- WORD width,
- pcg_3DPens pens,
- GraphicObject *archetype )
- {
- BoolGadget_Init( self, leftedge, topedge, width, 14, pens, ClassName( (struct PObject *)archetype ) );
- self->isa = ToolButtonClass();
- self->g.Activation = TOGGLESELECT | GADGIMMEDIATE; /* | RELVERIFY | FOLLOWMOUSE; */
- self->g.UserData = archetype;
- }
-
- GraphicObject *Archetype( ToolButton *self )
- {
- return (GraphicObject *)self->g.UserData;
- }
-