Contents page

DragGadget()


    USAGE

        void DragGadget(Window, DragInfo)

    FUNCTION

        This lets you take a normal Intuition BOOLGADGET style Gadget and drag it to
        a new location. The Gadget must be rendered with Intuition Image structure,
        because it is the Image that will be dragged.
        There are several options to dragging the Gadget:
          * You can specify a bounding box to move within. Bounding boxes may overlap
            since the hit box is only the Gadget itself.
          * You can specify that Gadget only be displayed in one window, or that it
            can move across windows. This allows the user to select an item in one
            window and move it to another. Ofcourse, the Gadget is not suddenly
            transferred to the other window's Gadget list, nor is the other window
            notified, but the illusion has been created, so now software can back it
            up. An example of Gadgets that move from window to window would be the
            disk and file icons that Workbench uses.
          * You can specify wether the Gadget has a transparent or solid backround.
            If transparent, all pen 0 parts of the image are transparent.
          * you can specify wether you want the Gadget to move to the new location
            once the user lets up the mouse, or that it bounce back to its original
            locaiton.
        Before calling DragGadget the first time, you must initialise a DragInfo
        structure .
        The fields that need to be set in the DragInfo structure are:

           Gadget   This is a pointer to the Gadget you wish to drag:

         LeftEdge   This is the left edge of the bounding box that describes the
                    region this Gadget can move within.

          TopEdge   This is the top edge of the bounding box that describes the
                    region this Gadget can move within.

        RightEdge   This is the right edge of the bounding box that describes the
                    region this Gadget can move within.

       BottomEdge   This is the bottom edge of the bounding box that describes the
                    region this Gadget can move within.

            Flags   There are several flags you can set to influence the behavior of
                    the Drag Gadget.

                    DRAG_INWINDOW   indicates you wish to have the Gadget displayed
                                    only within the rastport of your window.

                    DRAG_OUTLINE    indicates you'd the pen 0 color in the Gadget
                                    Image to be transparent.

                    DRAG_MOVEGADGET indicates that you'd like the Gadget to stay
                                    where the user moves it. Be careful. If the
                                    bounding box is outside the window, the user can
                                    move the Gadget out of the window, too.
                                    And then it's somewhat hard to get back.

       XPos, YPos   These coordinates indicate where the Gadget is now in the window.
                    You need not set these, but you may need to read them at some
                    point.

    UpdateRoutine   You can supply a function that is called every time the Gadget
                    moves. This function is passed two parameters: The window and the
                    DragInfo structure (which, in turn, points to the Gadget). If you
                    don't need to supply a routine, set this to NULL. Such a routine
                    is particulary useful if you need to provide some sort of real
                    time update while the Gadget moves.

    INPUTS

        Window   = Pointer to the window this Gadget belongs to.
        DragInfo = Initialised DragInfo structure.

    RESULT

        none (void)