home *** CD-ROM | disk | FTP | other *** search
- /*
- * ImageFX Development Header File
- * Copyright © 1991-1995 Nova Design, Inc.
- * Written by Thomas Krehbiel
- *
- * The ImageFX "GED" gadget system.
- *
- */
-
- #ifndef SCAN_GED_H
-
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
-
- #ifndef INTUITION_INTUITION_H
- #include <intuition/intuition.h>
- #endif
-
-
- #define INTERNATIONAL
-
- /*
- * ID's for gadget Styles:
- */
-
- #define Button_ID 0 /* Standard button */
- #define Toggle_ID 1 /* Toggling button - not recommended */
- #define String_ID 2 /* String gadget */
- #define Integer_ID 3 /* Integer gadget */
- #define HSlider_ID 4 /* Horizontal slider */
- #define VSlider_ID 5 /* Vertical slider */
- #define Cycle_ID 6 /* 2.0-style cycler */
- #define Check_ID 7 /* 2.0-style checkbox */
- #define MX_ID 8 /* 2.0-style MX */
-
- #define Border_ID 10 /* Bevel box border */
- #define Text_ID 11 /* Text */
- #define Image_ID 12 /* struct Image */
-
- #define Up_ID 13 /* Up button */
- #define Down_ID 14 /* Down button */
-
- #define QButton_ID 20 /* Button with no image */
- #define QToggle_ID 21 /* Toggler with no image */
- #define QString_ID 22 /* String with no image */
- #define QInteger_ID 23 /* Integer with no image */
- #define QHSlider_ID 24 /* HSlider with no image */
- #define QVSlider_ID 25 /* VSlider with no image */
- #define QCycle_ID 26 /* Cycler with no image */
- #define QCheck_ID 27 /* Checkbox with no image */
- #define QMX_ID 28 /* MX with no image */
-
- #define List_ID 43 /* a listview-style gadget */
-
- #define Ignore_ID 100 /* Ignore this item - not implemented */
-
- #define Font_ID 252 /* internal use only */
- #define Offset_ID 253 /* internal use only */
- #define Scale_ID 254 /* internal use only */
-
- #define End_ID 255
-
-
- /*
- * These are used as gadget ID's for internal stuff. Avoid
- * using these ID values for your own gadgets.
- */
- #define ELIST_LIST (0xFFF0)
- #define ELIST_UP (0xFFF1)
- #define ELIST_DOWN (0xFFF2)
- #define ELIST_PROP (0xFFF3)
-
-
- /*
- * GedGadget - Internal use by the gadget maintenance routines.
- * All fields should be considered READ ONLY and
- * are subject to change without notice.
- *
- * About the only thing you might be interested in
- * is the "CycleArray" field; it allows you to
- * change the list of labels for a cycle gadget
- * at will by simply changing pointers. You get
- * a pointer to the GedGadget structure by
- * casting the Gadget pointers returned by Ged_Create().
- * Eg:
- * gedgad = (struct GedGadget *)gad;
- *
- */
-
- struct GedGadget
- {
- struct Gadget Gadget; /* Regular Gadget */
- struct Border *PropBorder; /* Prop border */
- long Lowest, Highest; /* Range of slider or integer */
- int (*Code)(struct Window *, struct Gadget *, ULONG, ...);
- /* User code */
- ULONG UserData; /* User data */
- short Style; /* Gadget style */
- char Shortcut; /* Keyboard shortcut (no qualifier) */
- char Selected; /* Checkbox selected? */
- char **CycleText; /* Complete language text array */
- long *CycleArray; /* Array of text indexes... */
- short CycleIndex; /* Index into cycle array */
- ULONG *Pointer; /* Gadget state storage */
- struct NewGad *NewGad; /* NewGad from which we came */
- short NextActive; /* GadgetID to activate next */
- short ReturnCode; /* Button return code */
- short *MXArray; /* Mutual exclusion array - unused for now */
- char RightAmiga; /* RightAmiga key shortcut */
- UBYTE GedFlags; /* Private */
- struct EListView *LV;
- short LE, TE, W, H;
- struct IntuiText *CycleLabel; /* Private */
- struct Image *ButtonImage; /* Private too */
- char **GTCycleArray; /* Private too */
- struct Gadget *BoopsiGadget; /* Private too */
- struct Image *BoopsiFrame; /* Private too */
- char CurLvlStr[80]; /* Private too */
- WORD CurLvlX,
- CurLvlY;
- WORD CurLvlN;
- WORD SkipTicks; /* Private */
- LONG reserved[32];
- };
-
- #define GGF_RENDERED 0x01 /* slider level has been rendered */
-
-
- /*
- * NewGad - You fill in an array of these to define what gadgets,
- * text, borders, and images that you want for your window.
- * End the list with an element of style End_ID.
- *
- * THIS STRUCTURE MUST REMAIN INTACT THROUGHOUT THE LIFE OF THE GADGET!!
- *
- */
-
- struct NewGad
- {
- short Style; /* Style - What this array element
- * actually is. Can be a gadget,
- * text, border, or image. See
- * style defines above. */
- short ID; /* ID - For gadget styles, this is
- * used to reference the gadget
- * in most of the maintenance
- * functions. */
- short LE, TE, W, H; /* Position - This defines the
- * absolute location of the item.
- * For text and images, only the
- * LE and TE fields are actually
- * used. */
- long Label; /* Indicates the index into a char **
- * array to use as the text label
- * for this item. The text array
- * is passed to the Ged_Create()
- * function. Used this way to
- * make internationalizing easier.
- * Alternately, if the text array
- * passed to Ged_Create() is NULL,
- * then this field is taken to be
- * a simple pointer to a string.
- */
- int (*Code)(); /* Code - for gadgets, this defines
- * the function to call whenever
- * this gadget is "played" with.
- * The function will be passed
- * the current value of the gadget
- * (for string, integer, props, etc.)
- * See below for the function
- * prototypes for each of the styles
- * of gadgets. Use NULL if no
- * function is needed.
- */
- ULONG UserData; /* UserData - passed to the function
- * above unchanged; you can use
- * this for whatever you want.
- */
- ULONG *Pointer; /* Points to a place to store the
- * current "value" of this gadget
- * (if the item *is* a gadget).
- * For example, the current value
- * of a slider could be stored here
- * so you only need to reference a
- * single global variable instead
- * of retreiving the value from
- * the gadget all the time.
- */
- /* Following entries vary from style to style: */
- long Data1; /* These represent various parameters */
- long Data2; /* for the various styles. */
- long Data3; /* They are detailed below. */
- long Data4;
- long Data5;
- long Data6;
- long Data7;
- long Data8;
- };
-
- /*
- * Data#? Descriptions:
- *
- *
- * Button_ID/Up_ID/Down_ID:
- *
- * Data1 (long) Value to return to caller of GedWindow. Use
- * non-zero to exit a GedWindow.
- * Data2 (char) Keyboard shortcut character, NUL for none.
- * Data3 (struct Image *) Image to use for this gadget instead
- * of the standard bevel button imagery.
- * Data4 (struct Image *) Image to use in addition to the
- * standard bevel button imagery. The image is centered
- * inside the button.
- *
- * Toggle_ID:
- *
- * Data1 (long) Select state; non-zero to initially select.
- * Data2 (char) Keyboard shortcut character, NUL for none.
- * Data3 (struct Image *) Image to use for this gadget instead
- * of the standard bevel button imagery.
- *
- * Integer_ID:
- *
- * Data1 (long) Highest value for gadget (currently ignored).
- * Data2 (long) Initial value.
- * Data3 (long) Lowest value for gadget (current ignored).
- * Data4 (long) ID of next gadget to activate.
- * Data5 (long) 0 == left, 1 == right, 2 == center
- *
- * String_ID:
- *
- * Data1 (long) Maximum characters in string buffer.
- * Data2 (char *) Initial string for the gadget.
- * Data4 (long) ID of next gadget to activate.
- * Data5 (long) 0 == left, 1 == right, 2 == center
- *
- * Slider_ID:
- *
- * Data1 (long) Highest value of slider.
- * Data2 (long) Initial value of the slider.
- * Data3 (long) Lowest value of slider.
- * Data5 (long) Level positioning (see LEVEL_#? flags) (2.0)
- * Data6 (struct Image *) Image to use for slider knob.
- * Data7 (char *) Level format (sprintf-style string) or (2.0)
- * callback if (Data5 & LEVELF_CALLBACK).
- * Callback is used to fill in a string buffer
- * that Ged renders.
- * Data8 (long) If non-zero, specifies the maximum length (2.0)
- * of the level indication, in characters. Only
- * this many characters are rendered, in other
- * words. If zero, all characters are rendered.
- *
- * Cycle_ID:
- *
- * Data1 (long *) Array of gadget labels, each entry is an
- * index into the char ** text array given to
- * Ged_Create().
- * Data2 (char) Keyboard shortcut character, NUL for none.
- * Data4 (long) Initial element of cycle array to be shown.
- * Data6 (int (*)()) Function to call when cycler is double-clicked.
- * Data7 (char **) Text array to override the array passed
- * to the Ged_Create() function.
- *
- * Check_ID:
- *
- * Data1 (long) Select state; non-zero to initially select.
- * Data2 (char) Keyboard shortcut character, NUL for none.
- *
- * MX_ID:
- *
- * Data1 (long) Select state; non-zero to initially select.
- * Data2 (char) Keyboard shortcut character, NUL for none.
- *
- * Border_ID:
- *
- * Data1 (long) Non-zero for recessed border, otherwise raised.
- * Data2 (long) Non-zero for double-thick border.
- *
- * Text_ID:
- *
- * Data1 (long) Pen number to draw text with.
- * Data3 (long) 0 = newgad->LE is the left edge of text;
- * 1 = newgad->LE indicates the RIGHT edge of the text;
- * 2 = newgad->LE indicates the CENTER of the text.
- *
- * List_ID (2.0):
- *
- * Data1 (struct EListView *) EListView structure, which must
- * be initialized with the following:
- *
- * Spacing - spacing between elements
- * Active - initially active element
- * List - the list of items
- * Top - initial top element
- * Count - total elements in the list
- * cb_* - callbacks for drawing the list (optional)
- *
- * Data2 (long) Return code when listview is double-clicked.
- *
- */
-
- #define LEVEL_RIGHT (0x0001) /* Level placed to right of slider */
- #define LEVEL_ABOVE (0x0002) /* Level centered above slider */
- #define LEVEL_BELOW (0x0003) /* Level centered below slider */
-
- #define LEVEL_CALLBACK (0x8000) /* Data7 is really a callback function */
-
- /*
- * EListView (2.0):
- *
- * Controls List_ID gadget styles. Caller fills in appropriate
- * fields when creating the gadget, Ged maintains the structure
- * throughout its life.
- *
- */
-
- struct EListView
- {
-
- void *List; /* Pointer to the list of "things"
- * to maintain in the listview.
- * This need not be an Exec List,
- * but by default it is assumed
- * to be. You can use other kinds
- * of lists by supplying your own
- * callbacks for GetNode, NextNode,
- * and PrevNode (see below).
- */
- unsigned short Flags; /* Various flag bits (see below) */
- short Count; /* Total number of elements in the
- * list. Max 32K
- */
- short Top; /* Index of topmost element in the
- * the list
- */
- short Spacing; /* Number of vertical pixels required
- * for each element of the list. Ie.
- * Each element is this many pixels
- * tall. (Generally this would be
- * the height of the font you're
- * using.)
- */
- short Active; /* The element number that is "active".
- * -1 means no element is active.
- * The active element is the last one
- * that was selected. For a SHOWSELECTED
- * list, it will be the one shown below
- * the list.
- */
- short Visible; /* The number of elements that are
- * visible per "page". The GED
- * system will figure this for you
- * based on the height of your gadget.
- */
-
- /* If not provided (ie. left NULL), the
- * following callbacks default to
- * assuming an Exec List style list.
- */
-
- void *(*cb_GetNode)(void *, short);
- /* Callback function to retreive an
- * element from the list
- */
- void *(*cb_NextNode)(void *);
- /* Callback function to advance to
- * the next element in the list
- */
- void *(*cb_PrevNode)(void *);
- /* Callback function to back up to
- * the previous element in the list
- */
-
- /*
- * One of cb_DrawNode or cb_NodeLabel must be provided, depending
- * on how much control you want to have over the element drawing.
- *
- */
- void (*cb_DrawNode)(APTR, APTR, void *, short, short, short, short);
- /*
- * Callback to draw an element in
- * the position indicated. You are
- * given a pointer to the element
- * node and are required to do all
- * the work of drawing yourself.
- *
- * Prototype:
- *
- * DrawNode(window,
- * rastport,
- * node,
- * leftedge,
- * topedge,
- * width,
- * height);
- *
- * If not provided, cb_NodeName is
- * used instead.
- *
- */
- void (*cb_NodeName)(void *, char *, short);
- /* Callback to get the "name" of
- * of a node. This name is then
- * rendered onscreen by GED.
- *
- * Prototype:
- *
- * NodeName(node,
- * buffer,
- * maxlen);
- *
- * If not provided (ie. NULL), then
- * it defaults to a callback that
- * would work for an Exec List
- * where each Node->ln_Name is
- * used as the element label.
- */
-
- long reserved0[8];
-
- /* BEYOND THIS POINT IS PRIVATE! */
-
- APTR Window;
- APTR RPort;
- short LeftEdge, TopEdge, Width, Height;
- void *TopNode;
- short SliderID, UpID, DownID, pad1;
- ULONG Secs, Micros;
-
- struct Gadget *LVGad0, *LVGad1, *LVGad2, *LVGad3;
-
- long reserved1[2];
-
- };
-
- /* EListView Flags: */
- #define ELVF_SHOWSELECTED 0x01 /* show selected item in area below
- the list */
- #define ELVF_HIGHLIGHT 0x02 /* leave selected items highlighted */
-
-
- /*
- * These are to allow easy creation of gadget function prototypes:
- *
- * For example:
- *
- * int SaveCode (GedButtonProto)
- * {
- * return(0);
- * }
- */
-
- #define GedButtonProto struct Window *w, struct Gadget *g, ULONG ud
- #define GedToggleProto struct Window *w, struct Gadget *g, ULONG ud, long val
- #define GedStringProto struct Window *w, struct Gadget *g, ULONG ud, char *text
- #define GedIntegerProto struct Window *w, struct Gadget *g, ULONG ud, long val
- #define GedSliderProto struct Window *w, struct Gadget *g, ULONG ud, long val, BOOL moving
- #define GedCycleProto struct Window *w, struct Gadget *g, ULONG ud, long idx
- #define GedCheckProto struct Window *w, struct Gadget *g, ULONG ud, long val
- #define GedMXProto struct Window *w, struct Gadget *g, ULONG ud, long val
- #define GedListProto struct Window *w, struct Gadget *g, ULONG ud, long idx, struct EListView *lv
-
- /* proto for callback for slider level: */
- #define GedSliderCBProto struct Window *w, struct Gadget *g, ULONG ud, long val, char *stringbuf, int maxlen
-
- /* Ancient compatibility - do not use: */
- #define Reserved1 Data5
- #define Reserved2 Data6
- #define Reserved3 Data7
- #define Reserved4 Data8
-
- /* So we don't have to refer to `Data1', etc. */
- #define ng_RC Data1
- #define ng_Key Data2
- #define ng_Image Data3
- #define ng_Select Data1
- #define ng_Highest Data1
- #define ng_Integer Data2
- #define ng_Lowest Data3
- #define ng_Next Data4
- #define ng_MaxChars Data1
- #define ng_String Data2
- #define ng_Initial Data2
- #define ng_Labels Data1
- #define ng_Index Data4
- #define ng_Exclude Data3
-
- /*
- * GedContext - used to keep context information about a list of
- * NewGad's after they're created. Should be considered
- * PRIVATE, and is subject to change without notice.
- */
-
- struct GedContext
- {
- struct Gadget *GadList; /* Gadget List */
- struct IntuiText *ITextList; /* IntuiText List */
- struct Border *BorderList; /* Border List */
- struct Image *ImageList; /* Image List */
- char **TextArray; /* Text array */
- short NumGads; /* Number of gadgets */
- short NumGTGads;
- struct Gadget *GTList; /* private */
- long Reserved2[7];
- };
-
-
- #define SCAN_GED_H
- #endif
-