[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

Intuition drives a Boopsi gadget by sending it Boopsi messages. Intuition
uses a series of five Boopsi methods:

gm_render       this method tells the gadget to render itself.

gm_hittest      this method asks a gadget whether it has been "hit" by a
                mouse click.

gm_goactive     this method asks a gadget if it wants to be the active
                gadget.

gm_handleinput  this method passes a gadget an input event.

gm_goinactive   this method tells a gadget that it is no longer active.

The formats of each of these Boopsi messages differ, but they all have two
things in common.  Like all Boopsi messages, each starts with their
respective method ID.  For each of these methods, the method ID field is
followed by a pointer to a GadgetInfo structure (defined in
<intuition/cghooks.h>).  the gadgetinfo structure contains information
about the display on which the gadget needs to render itself:


struct GadgetInfo {
    struct Screen          *gi_Screen;
    struct Window          *gi_Window;     /* null for screen gadgets */
    struct Requester       *gi_Requester;  /* null if not GTYP_REQGADGET */

    /* rendering information: don't use these without cloning/locking.
     * Official way is to call ObtainGIRPort()
     */
    struct RastPort        *gi_RastPort;
    struct Layer           *gi_Layer;

    /* copy of dimensions of screen/window/g00/req(/group)
     * that gadget resides in.  Left/Top of this box is
     * offset from window mouse coordinates to gadget coordinates
     *  screen gadgets:                 0,0 (from screen coords)
     *  window gadgets (no g00):        0,0
     *  GTYP_GZZGADGETs (borderlayer):  0,0
     *  GZZ innerlayer gadget:          borderleft, bordertop
     *  Requester gadgets:              reqleft, reqtop
     */
    struct IBox            gi_Domain;

    /* these are the pens for the window or screen */
    struct {
        UBYTE   DetailPen;
        UBYTE   BlockPen;
    }                      gi_Pens;

    /* the Detail and Block pens in gi_DrInfo->dri_Pens[] are
     * for the screen.  Use the above for window-sensitive colors.
     */
    struct DrawInfo        *gi_DrInfo;

    /* reserved space: this structure is extensible
     * anyway, but using these saves some recompilation
     */
    ULONG                  gi_Reserved[6];
};


All the fields in this structure are read only.

Although this structure contains a pointer to the gadget's rastport
structure, applications should not use it for rendering.  Instead, use the
intuition.library function obtaingirport() to obtain a copy of the
GadgetInfo's RastPort.  When the gadget is finished with this RastPort, it
should call releasegirport() to relinquish the rastport.

 gm_render     gm_goactive/gm_handleinput 
 gm_hittest    gm_goinactive