palette.gadget Reference

Comprehensive function reference for palette.gadget, synthesised from the AmigaOS NDK 3.2 Release 4 (Autodocs/palette).

This page documents 2 functions of palette.gadget. Each function entry follows the canonical autodoc format. struct Name, union Name, enum Name are clickable links to the type definition in the types reference.

Function index


palette_gc()

**palette_gc -- A colour selection gadget.

SUPERCLASS
    gadgetclass

REQUIRES
    bevel.image

DESCRIPTION
    This gadget is equivalent to the GadTools PALETTE_KIND gadget, but
    implemented as a BOOPSI gadget class.  It displays a palette of
    colours, allowing the user to select one.

    Advantages that this class provides:

     > Right mouse button cancels gadget action.

     > Supports window relativity.

     > Supports gadget interconnections.

     > Supports OS 3.0 BOOPSI Gadget HelpTest.

METHODS
    OM_NEW -- Create the palette gadget, calls OM_SET.  Passed to
        superclass.

    OM_SET -- Set object attributes.  Passed to superclass first.

    OM_GET -- Get object attributes.  Passed to superclass first.

    OM_NOTIFY -- Notify connections of attribute changes.

    OM_DISPOSE -- Frees resources and calls superclass.

    OM_UPDATE -- Calls OM_SET.

    GM_DOMAIN -- Return the maximum and minimum size of the gadget.

    GM_RENDER -- Renders the gadget imagry.  Overrides the superclass.

    GM_KEYACTIVE -- Handles keyboard activation.

    GM_KEYINACTIVE -- Handles keyboard de-activation.

    GM_GOACTIVE -- Activates the gadget on mouse click only.  Overrides
        the superclass.

    GM_HANDLEINPUT -- Handles input events once active.  Overrides the
        superclass.

    GM_GOINACTIVE -- Deactivates the gadget.  Passed to the superclass.

    All other methods are passed to the superclass.

ATTRIBUTES
    GA_Disabled (BOOL)
        Set to TRUE to disable gadget, FALSE otherwise.

        Defaults to FALSE.

        Applicability is (OM_NEW, OM_SET, OM_GET)

    PALETTE_Colour (UBYTE)
        Initially selected color of the palette. This number is a pen
        number, and not the ordinal color number within the palette
        gadget itself.  The exception is when PALETTE_ColourTable is
        used, in which case you will get an index into your table.

        Defaults to 0.

        Applicability is (OM_NEW, OM_SET, OM_GET)

    PALETTE_ColourOffset (UBYTE)
        First colour in screen palette to display.

        Defaults to 0.

        Applicability is (OM_NEW, OM_SET, OM_GET)

    PALETTE_ColourTable (UWORD *)
        Pointer to a table of pen numbers indicating which colors
        should be used and edited by the palette gadget.  The array
        provided with this tag must remain valid for the life of the
        gadget or until a new table is provided.

        This array  must contain as many entries as there are colours
        displayed in the palette gadget PLUS the colour offset.
        The first PALETTE_ColourOffset entries in your table are
        skipped (ignored). Eg. If PALETTE_ColourOffset is 8, and
        PALETTE_NumColours is 4, you must provide an array of 12
        UWORDs but only the last 4 will be used.

        Note: in earlier versions of this document, this attribute
        has been incorrectly described as being of type UBYTE *; the
        correct type is (and has always been) UWORD *, as stated in
        the <gadgets/palette.h> header file.

        Default is NULL, which causes a 1-to-1 mapping of pen numbers.

        Applicability is (OM_NEW, OM_SET, OM_GET)

    PALETTE_NumColours (UWORD)
        Number of colors to display in the palette gadget.  Currently
        this must be a power of 2.

        Defaults to 2.

        Applicability is (OM_NEW, OM_SET, OM_GET)

    PALETTE_RenderHook (struct Hook *) (V47)
        Custom rendering hook for palette boxes. This allows you to
        extend the palette gadget functionality by using it to show
        a "palette" of arbitrary items rather than just colours.

        Your hook will be called with the following arguments:

        hook    - pointer to your own hook structure
        object  - currently NULL, reserved for future use
        message - pointer to a PBoxDrawMsg structure

        The rendering hook will have to fill the bounds provided in
        the PBoxDrawMsg structure if the received message is of type
        PB_DRAW (check the value of pbdm_MethodID to find out the
        message type) and return PBCB_OK. If the message type is not
        PB_DRAW, or another known type, the hook should immediately
        return PBCB_UNKNOWN without performing any processing.

        See <gadgets/palette.h> for more information on the palette
        rendering hook and the PBoxDrawMsg message structure.

        Defaults to NULL, which means no custom rendering hook is used.

        Applicability is (OM_NEW, OM_SET, OM_GET)**

PALETTE_GetClass()

PALETTE_GetClass -- Gets the pointer to the palette class.

Synopsis

palette_class = PALETTE_GetClass();
D0

Class * PALETTE_GetClass(VOID);

Function

    Obtains the pointer to the Palette gadget class for use with
    NewObject().  This function always returns a valid pointer so
    you do not need to check it.  The reason is that if the library
    opens fine, then the pointer returned is already setup.  (Of course
    this implies that if opening the library fails, you shouldn't be
    calling this.)

    Note that this function does not create the class, that is done
    when the class library is opened.

Inputs

    Nothing.

RESULT
    palette_class - Pointer to the Palette gadget class.