home *** CD-ROM | disk | FTP | other *** search
- #ifndef LIBRARIES_GADUTIL_H
- #define LIBRARIES_GADUTIL_H
- /*------------------------------------------------------------------------**
- **
- ** $VER: gadutil.h 36.56 (11.10.95)
- **
- ** Filename: libraries/gadutil.h
- ** Version: 36.56
- ** Date: 29-Sep-95
- **
- ** GadUtil definitions, a dynamic gadget layout system.
- **
- ** © Copyright 1994, 1995 by P-O Yliniemi and Staffan Hämälä.
- **
- ** All Rights Reserved.
- **
- **------------------------------------------------------------------------*/
-
- #ifndef EXEC_TYPES_H
- #include <exec/types.h>
- #endif
-
- #ifndef EXEC_LIBRARIES_H
- #include <exec/libraries.h>
- #endif
-
- #ifndef UTILITY_TAGITEM_H
- #include <utility/tagitem.h>
- #endif
-
- #ifndef INTUITION_INTUITION_H
- #include <intuition/intuition.h>
- #endif
-
- /*------------------------------------------------------------------------**
- **
- ** Extended gadget types available in GadUtil.library.
- **
- */
-
- #define IMAGE_KIND 50
- #define LABEL_KIND 51 /* Not implemented */
- #define DRAWER_KIND 52
- #define FILE_KIND 53
- #define BEVELBOX_KIND 54
- #define PROGRESS_KIND 55
-
- /*-------------------------- Bevel box frame types -----------------------*/
- #define BFT_BUTTON 0 /* Normal button bevel box border */
- #define BFT_RIDGE 1 /* STRING_KIND bevel box border */
- #define BFT_DROPBOX 2 /* Icon dropbox type border */
-
- #define BFT_HORIZBAR 10 /* Horizontal shadowed line */
- #define BFT_VERTBAR 11 /* Vertical shadowed line */
-
- /*------------------------- Text placement flags -------------------------*/
- #define BB_TEXT_ABOVE 0 /* Place bevel box text above the
- * upper border ___ Example ___ */
-
- #define BB_TEXT_IN 1 /* Place bevel box text centered at
- * the upper border --- Example --- */
-
- #define BB_TEXT_BELOW 2 /* Place bevel box text below the
- * upper border ___ ___
- * Example */
-
- #define BB_TEXT_CENTER 0 /* Place the text centered at the
- * upper border (default) */
-
- #define BB_TEXT_LEFT 4 /* Place the text left adjusted */
-
- #define BB_TEXT_RIGHT 8 /* Place the text right adjusted */
-
- /*--------------- Alternatives to text placement flags -------------------*/
- #define BB_TEXT_ABOVE_CENTER BB_TEXT_ABOVE|BB_TEXT_CENTER
- #define BB_TEXT_ABOVE_LEFT BB_TEXT_ABOVE|BB_TEXT_LEFT
- #define BB_TEXT_ABOVE_RIGHT BB_TEXT_ABOVE|BB_TEXT_RIGHT
-
- #define BB_TEXT_IN_CENTER BB_TEXT_IN|BB_TEXT_CENTER
- #define BB_TEXT_IN_LEFT BB_TEXT_IN|BB_TEXT_LEFT
- #define BB_TEXT_IN_RIGHT BB_TEXT_IN|BB_TEXT_RIGHT
-
- #define BB_TEXT_BELOW_CENTER BB_TEXT_BELOW|BB_TEXT_CENTER
- #define BB_TEXT_BELOW_LEFT BB_TEXT_BELOW|BB_TEXT_LEFT
- #define BB_TEXT_BELOW_RIGHT BB_TEXT_BELOW|BB_TEXT_RIGHT
-
- /*-----------------------Text Shadow placement ---------------------------*/
- #define BB_SHADOW_DR 0 /* Place the shadow at x+1, y+1 */
- #define BB_SHADOW_UR 16 /* Place the shadow at x+1, y-1 */
- #define BB_SHADOW_DL 32 /* Place the shadow at x-1, y+1 */
- #define BB_SHADOW_UL 48 /* Place the shadow at x-1, y-1 */
-
- /*------------------ Alternatives for shadow placement -------------------*/
- #define BB_SUNAT_UL 0 /* Place the shadow at x+1, y+1 */
- #define BB_SUNAT_DL 16 /* Place the shadow at x+1, y-1 */
- #define BB_SUNAT_UR 32 /* Place the shadow at x-1, y+1 */
- #define BB_SUNAT_DR 48 /* Place the shadow at x-1, y-1 */
-
- /*------------------------------------------------------------------------**
- **
- ** This is the structure that actually holds the definition of a single
- ** gadget. It contains the new layout tags defined below, as well as the
- ** normal GadTools tags. You setup all the gadgets in a window by
- ** making an array of this structure and passing it to GU_LayoutGadgetsA().
- **
- */
- struct LayoutGadget
- {
- WORD lg_GadgetID;
- struct TagItem *lg_LayoutTags;
- struct TagItem *lg_GadToolsTags;
- struct Gadget *lg_Gadget;
- };
-
- /*------------------------------------------------------------------------**
- **
- ** Structure used to hold the built in strings of a localized program. These
- ** strings will be used if we couldn't get a string from the catalog.
- **
- */
- struct AppString
- {
- LONG as_ID; /* String ID */
- LONG as_Str; /* String pointer */
- };
-
- /*------------------------------------------------------------------------**
- **
- ** GadUtil.library is basically an extension to Gadtools.library. It adds
- ** to GadTools the ability to dynamically layout gadgets according to the
- ** positions of other gadgets, font size, locale, etc. The goal in designing
- ** this was to create a system so that programmers could easily create a GUI
- ** that automatically adjusted to a user's environment.
- **
- ** Every gadget is now defined as a TagList, there is no more need to make
- ** use of the NewGadget structure as this taglist allows you to access all
- ** fields used in that structure. An array of the TagLists for all your
- ** window's gadgets is then passed to GU_LayoutGadgetsA() and your gadget
- ** list is created.
- */
-
- #define GU_TagBase TAG_USER + 0x60000
-
- /*********** Define which kind of gadget we are going to have. ************/
-
- #define GU_GadgetKind GU_TagBase+1 /* Which kind of gadget to make. */
-
-
- /************************ Gadget width control. ***************************/
-
- #define GU_Width GU_TagBase+20 /* Absolute gadget width. */
-
- #define GU_DupeWidth GU_TagBase+21 /* Duplicate the width of another
- * gadget. */
-
- #define GU_AutoWidth GU_TagBase+22 /* Set width according to length
- * of text label + ti_Data. */
-
- #define GU_Columns GU_TagBase+23 /* Set width so that approximately
- * ti_Data columns will fit. */
-
- #define GU_AddWidth GU_TagBase+24 /* Add some value to the total
- * width calculation. */
-
- #define GU_MinWidth GU_TagBase+25 /* Make sure width is at least this */
-
- #define GU_MaxWidth GU_TagBase+26 /* Make sure width is at most this */
-
- #define GU_AddWidChar GU_TagBase+27 /* Add the width of ti_Data chars
- * to the gadget width */
-
- /************************* Gadget height control. *************************/
-
- #define GU_Height GU_TagBase+40 /* Absolute gadget height. */
-
- #define GU_DupeHeight GU_TagBase+41 /* Duplicate the height of another
- * gadget. */
-
- #define GU_AutoHeight GU_TagBase+42 /* Set height according to height
- * of text font + ti_Data. */
-
- #define GU_HeightFactor GU_TagBase+43 /* Make the gadget height a
- * multiple of the font height. */
-
- #define GU_AddHeight GU_TagBase+44 /* Add some value to the total
- * height calculation. */
-
- #define GU_MinHeight GU_TagBase+45 /* Make sure height is at least this */
-
- #define GU_MaxHeight GU_TagBase+46 /* Make sure height is at most this */
-
- #define GU_AddHeiLines GU_TagBase+47 /* Add the height of ti_Data lines
- * to the gadget height */
-
- /************************* Gadget top edge control. ***********************/
-
- #define GU_Top GU_TagBase+60 /* Absolute top edge. */
-
- #define GU_TopRel GU_TagBase+61 /* Top edge relative to bottom
- * edge of another gadget. */
-
- #define GU_AddTop GU_TagBase+62 /* Add some value to the final
- * top edge calculation. */
-
- #define GU_AlignTop GU_TagBase+63 /* Align top edge of gadget with
- * top edge of another gadget. */
-
- #define GU_AdjustTop GU_TagBase+64 /* Add the height of the text font
- * + ti_Data to the top edge. */
-
- #define GU_AddTopLines GU_TagBase+65 /* Add the height of ti_Data lines
- * to the top edge
-
- /*********************** Gadget bottom edge control. **********************/
-
- #define GU_Bottom GU_TagBase+80 /* Absolute bottom edge. */
-
- #define GU_BottomRel GU_TagBase+81 /* Bottom edge relative to top
- * edge of another gadget. */
-
- #define GU_AddBottom GU_TagBase+82 /* Add some value to the final
- * bottom edge calculation. */
-
- #define GU_AlignBottom GU_TagBase+83 /* Align bottom edge of gadget with
- * bottom edge of another gadget. */
-
- #define GU_AdjustBottom GU_TagBase+84 /* Subtract the height of the text
- * font + ti_Data from the top edge */
-
- /********************** Gadget left edge control. *************************/
-
- #define GU_Left GU_TagBase+100 /* Absolute left edge. */
-
- #define GU_LeftRel GU_TagBase+101 /* Left edge relative to right
- * edge of another gadget. */
-
- #define GU_AddLeft GU_TagBase+102 /* Add some value to the final
- * left edge calculation. */
-
- #define GU_AlignLeft GU_TagBase+103 /* Align left edge of gadget with
- * left edge of another gadget. */
-
- #define GU_AdjustLeft GU_TagBase+104 /* Add the width of the text label
- * + ti_Data to the left edge. */
-
- #define GU_AddLeftChar GU_TagBase+105 /* Add length of ti_Data characters
- * to the left edge. */
-
- /********************** Gadget right edge control. ************************/
-
- #define GU_Right GU_TagBase+120 /* Absolute right edge. */
-
- #define GU_RightRel GU_TagBase+121 /* Right edge relative to left
- * edge of another gadget. */
-
- #define GU_AddRight GU_TagBase+122 /* Add some value to the final
- * right edge calculation. */
-
- #define GU_AlignRight GU_TagBase+123 /* Align right edge of gadget with
- * right edge of another gadget. */
-
- #define GU_AdjustRight GU_TagBase+124 /* Subtract the width of the text
- * label + ti_Data from the left edge */
-
- /******************************* Other tags *******************************/
-
- #define GU_ToggleSelect GU_TagBase+150 /* Create a toggle-select gadget -
- * only BUTTON_KIND & IMAGE_KIND
-
- #define GU_Selected GU_TagBase+151 /* Set default state of toggle-
- * select gadget
-
- /********* Access to the other fields of the NewGadget structure **********/
-
- #define GU_GadgetText GU_TagBase+160 /* Gadget label. */
-
- #define GU_TextAttr GU_TagBase+161 /* Desired font for gadget label. */
-
- #define GU_Flags GU_TagBase+162 /* Gadget flags. */
-
- #define GU_UserData GU_TagBase+163 /* Gadget UserData. */
-
- #define GU_LocaleText GU_TagBase+164 /* Gadget label taken from a locale. */
-
- /*************** Tags for GadUtil's extended gadget kinds. *****************
-
- #define GUIM_Image GU_TagBase+200 /* Image structure for an image
- * gadget. */
-
- #define GUIM_ReadOnly GU_TagBase+201 /* TRUE if read-only. */
-
- #define GUIM_SelectImg GU_TagBase+202 /* Selected image for IMAGE_KIND
- * gadgets */
-
- #define GUIM_BOOPSILook GU_TagBase+203 /* Render selected image background
- * with the fillpen (default = TRUE) */
-
- #define GUBD_Border GU_TagBase+200 /* Border structure for an border
- * gadget. */
-
- #define GUBD_ReadOnly GU_TagBase+201 /* TRUE if read-only. */
-
- #define GUBB_Recessed GU_TagBase+220 /* TRUE for a recessed bevel box */
-
- #define GUBB_FrameType GU_TagBase+221 /* Frame type for bevel box */
-
- #define GUBB_TextColor GU_TagBase+222 /* Color of the title text */
-
- #define GUBB_TextPen GU_TagBase+223 /* Pen to print title text with -
- * overrides GUBB_TextColor */
-
- #define GUBB_Flags GU_TagBase+224 /* Text placement flags */
-
- #define GUBB_3DText: GU_TagBase+225 /* Tag to enable 3D text (shadow)
- * Not needed if GU_ShadowColor or
- * GU_ShadowPen is used */
-
- #define GUBB_ShadowColor GU_TagBase+226 /* Color of the title text's shadow */
-
- #define GUBB_ShadowPen GU_TagBase+227 /* Pen to print the text's shadow
- * with - overrides GUBB_ShadowColor */
-
- #define GUPR_FillColor GU_TagBase+240 /* Color of filled part of indicator */
-
- #define GUPR_FillPen GU_TagBase+241 /* Pen to fill the indicator with
- * - overrides GUPR_FillColor */
-
- #define GUPR_BackColor GU_TagBase+242 /* Color of the background of the
- * indicator */
-
- #define GUPR_BackPen GU_TagBase+243 /* Pen to use for the indocator's
- * background - overrides
- * GUPR_BackColor */
-
- #define GUPR_Current GU_TagBase+244 /* Current value of the indicator */
-
- #define GUPR_Total GU_TagBase+245 /* Total value for the indicator */
-
- /************** Tags passed directly to GU_LayoutGadgetsA(). **************/
-
- #define GU_RightExtreme GU_TagBase+500 /* ti_Data is a pointer to a LONG
- * that is used to store the right-
- * most point that a gadget
- * will exist in. */
-
- #define GU_LowerExtreme GU_TagBase+501 /* ti_Data is a pointer to a LONG
- * that is used to store the lower-
- * most point that a gadget will
- * exist in. */
-
- #define GU_Catalog GU_TagBase+502 /* Indicates locale for the gadgets. */
-
-
- #define GU_DefTextAttr GU_TagBase+503 /* Specifies a default font for use
- * with all gadgets, can still be
- * over-ridden with GU_TextAttr. */
-
- #define GU_AppStrings GU_TagBase+504 /* Application string table w/IDs. */
-
- #define GU_BorderLeft GU_TagBase+505 /* Size of window left border. */
-
- #define GU_BorderTop GU_TagBase+506 /* Size of window top border. */
-
- #define GU_NoCreate GU_TagBase+507 /* Don't actually create the gadgets. */
-
- #define GU_MimimumIDCMP GU_TagBase+508 /* Minimum required IDCMP, so that
- * all gadgets will work */
-
- /***************************** Hotkey tags ********************************/
-
- #define GU_Hotkey GU_TagBase+300 /* Hotkey for gadget (VANILLAKEY) */
-
- /********************* Boolean flags for hotkey code **********************/
-
- #define GU_HotkeyCase GU_TagBase+301 /* TRUE for a case-sensitive hotkey */
- #define GU_LabelHotkey GU_TagBase+302 /* TRUE = get hotkey code from label */
- #define GU_RawKet GU_TagBase+303 /* TRUE if hotkey is a RAWKEY code */
-
- /*********************** Constants for hotkey support *********************/
-
- #define GADUSERMAGIC 0x1122 /* Identification for structure that
- * the gadgets UserData points to */
-
- /******************* Public bit numbers for gu_Flags **********************/
-
- #define GU_HOTKEYCASE 0 /* Hoykey is case-sensitive */
- #define GU_RAWKEY 2 /* gu_Code is a RAWKEY code */
-
- #define GU_HOTKEYCASEMASK 1<<GU_HOTKEYCASE /* Mask for GU_HOTKEYCASE bit */
- #define GU_RAWKEYMASK 1<<GU_RAWKEY /* Mask for GU_RAWKEY bit */
-
- /************** Structure the gadget's UserData points to ******************
- *
- * This structure is the public part of the allocated data structure for
- * hotkeys and IMAGE_KIND gadgets (including FILE_KIND and DRAWER_KIND).
- *
- * This structure should be considered READ ONLY. The only fields you may
- * change is the gu_Code and gu_Flags fields.
- *
- * DO NOT WRITE ANYTHING BEYOND THIS STRUCTURE WITHOUT ALLOCATING MEMORY FIRST
- *
- */
-
- struct GU_Public
- {
- UWORD gu_Magic; /* Identification word for structure */
- ULONG gu_GadFlags; /* Flags for GENERIC kind GadUtil gadgets */
- UBYTE gu_Flags; /* Flags for the hotkey type */
- UBYTE gu_Code; /* VANILLA or RAWKEY code to react on */
- WORD gu_Active; /* Active entry for some gadget kinds */
- WORD gu_MaxVal; /* Maximum value for some gadgets */
- WORD gu_MinVal; /* Minimum value for some gadgets */
- ULONG gu_GadgetType; /* Gadget type that was created */
- };
-
- /*------------------------------------------------------------------------**
- ** Library base **
- **------------------------------------------------------------------------*/
-
- struct GadUtilBase
- {
- struct Library LibNode;
- UBYTE gub_Flags; /* Private! */
- UBYTE gub_Pad; /* Private! */
-
- struct Library *GadToolsBase; /* The following library bases */
- struct GfxBase *GfxBase; /* may be read and used by your */
- struct IntuitionBase *IntuitionBase; /* program */
- struct Library *LocaleBase; /* LocaleBase may be NULL! */
- struct Library *UtilityBase;
- struct Library *DiskFontBase; /* DiskFontBase may be NULL! */
- LONG gub_SegList; /* Private! */
- };
-
- #define GADUTILNAME "gadutil.library"
-
- /*------------------------------------------------------------------------**
- ** BevelBox structure **
- **------------------------------------------------------------------------*/
- struct BBoxData
- {
- UWORD bbd_XPos; /* X position of box */
- UWORD bbd_YPos; /* Y position of box */
- UWORD bbd_Width; /* Width of box */
- UWORD bbd_Height; /* Height of box */
-
- UWORD bbd_LeftEdge; /* Left edge of text */
- UWORD bbd_TopEdge; /* Top edge of text */
- UWORD bbd_TextWidth; /* Pixel width of text */
-
- struct TextAttr *bbd_TextFont; /* Font to print text with */
- STRPTR bbd_Text; /* Text to display */
-
- UBYTE bbd_FrontPen; /* Text color */
- UBYTE bbd_Flags; /* Text placement flags */
- UBYTE bbd_Recessed; /* Recessed frame */
- UBYTE bbd_FrameType; /* Type of box frame */
- UBYTE bbd_ShadowPen /* Shadow color */
- UBYTE bbd_Reserved1 /* No use in v36.53 - reserved! */
- };
-
- /*------------------------------------------------------------------------**
- ** ProgressIndicator structure **
- **------------------------------------------------------------------------*/
-
- struct ProgressGad
- {
- UWORD pg_XPos /* X pos of box around gadget */
- UWORD pg_YPos /* Y pos of box around gadget */
- UWORD pg_Width /* Width of box around gadget */
- UWORD pg_Height /* Height of box around gadget */
- ULONG pg_Current /* Current value of indicator */
- ULONG pg_Total /* Total value of indicator */
- UBYTE pg_FillColor /* Color of upto current value */
- UBYTE pg_BackColor /* Color from current to end */
- UBYTE pg_Flags /* Flags */
- UBYTE pg_reserved1
- UWORD pg_XFilledTo /* Initialized to pg_XPos + 4 */
- };
-
- #endif /* LIBRARIES_GADUTIL_H */
-