home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
bbs
/
cbm
/
nduk-v37.lha
/
V37
/
include
/
libraries
/
gadtools.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-27
|
12KB
|
304 lines
#ifndef LIBRARIES_GADTOOLS_H
#define LIBRARIES_GADTOOLS_H
/*
** $Filename: libraries/gadtools.h $
** $Release: 2.04 Includes, V37.4 $
** $Revision: 36.18 $
** $Date: 91/10/09 $
**
** gadtools.library definitions
**
** (C) Copyright 1989-1991 Commodore-Amiga, Inc.
** All Rights Reserved
*/
/*------------------------------------------------------------------------*/
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif
#ifndef UTILITY_TAGITEM_H
#include <utility/tagitem.h>
#endif
#ifndef INTUITION_INTUITION_H
#include <intuition/intuition.h>
#endif
/*------------------------------------------------------------------------*/
/* The kinds (almost classes) of gadgets in the toolkit. Use these
identifiers when calling CreateGadgetA() */
#define GENERIC_KIND 0
#define BUTTON_KIND 1
#define CHECKBOX_KIND 2
#define INTEGER_KIND 3
#define LISTVIEW_KIND 4
#define MX_KIND 5
#define NUMBER_KIND 6
#define CYCLE_KIND 7
#define PALETTE_KIND 8
#define SCROLLER_KIND 9
/* Kind number 10 is reserved */
#define SLIDER_KIND 11
#define STRING_KIND 12
#define TEXT_KIND 13
#define NUM_KINDS 14
/*------------------------------------------------------------------------*/
/* These two definitions are obsolete, but are here for backwards
compatibility. You never need to worry about these: */
#define GADTOOLBIT (0x8000)
/* Use this mask to isolate the user part: */
#define GADTOOLMASK (~GADTOOLBIT)
/*------------------------------------------------------------------------*/
/* 'Or' the appropriate set together for your Window IDCMPFlags: */
#define ARROWIDCMP (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
IDCMP_INTUITICKS | IDCMP_MOUSEBUTTONS)
#define BUTTONIDCMP (IDCMP_GADGETUP)
#define CHECKBOXIDCMP (IDCMP_GADGETUP)
#define INTEGERIDCMP (IDCMP_GADGETUP)
#define LISTVIEWIDCMP (IDCMP_GADGETUP | IDCMP_GADGETDOWN |\
IDCMP_MOUSEMOVE | ARROWIDCMP)
#define MXIDCMP (IDCMP_GADGETDOWN)
#define NUMBERIDCMP (NULL)
#define CYCLEIDCMP (IDCMP_GADGETUP)
#define PALETTEIDCMP (IDCMP_GADGETUP)
/* Use ARROWIDCMP|SCROLLERIDCMP if your scrollers have arrows: */
#define SCROLLERIDCMP (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
#define SLIDERIDCMP (IDCMP_GADGETUP | IDCMP_GADGETDOWN | IDCMP_MOUSEMOVE)
#define STRINGIDCMP (IDCMP_GADGETUP)
#define TEXTIDCMP (NULL)
/*------------------------------------------------------------------------*/
/* Typical suggested spacing between "elements": */
#define INTERWIDTH 8
#define INTERHEIGHT 4
/*------------------------------------------------------------------------*/
/* Generic NewGadget used by several of the gadget classes: */
struct NewGadget
{
WORD ng_LeftEdge, ng_TopEdge; /* gadget position */
WORD ng_Width, ng_Height; /* gadget size */
UBYTE *ng_GadgetText; /* gadget label */
struct TextAttr *ng_TextAttr; /* desired font for gadget label */
UWORD ng_GadgetID; /* gadget ID */
ULONG ng_Flags; /* see below */
APTR ng_VisualInfo; /* Set to retval of GetVisualInfo() */
APTR ng_UserData; /* gadget UserData */
};
/* ng_Flags control certain aspects of the gadget. The first five control
the placement of the descriptive text. All larger groups supply a
default: */
#define PLACETEXT_LEFT 0x0001 /* Right-align text on left side */
#define PLACETEXT_RIGHT 0x0002 /* Left-align text on right side */
#define PLACETEXT_ABOVE 0x0004 /* Center text above */
#define PLACETEXT_BELOW 0x0008 /* Center text below */
#define PLACETEXT_IN 0x0010 /* Center text on */
#define NG_HIGHLABEL 0x0020 /* Highlight the label */
/*------------------------------------------------------------------------*/
/* Fill out an array of these and pass that to CreateMenus(): */
struct NewMenu
{
UBYTE nm_Type; /* See below */
/* Compiler inserts a PAD byte here */
STRPTR nm_Label; /* Menu's label */
STRPTR nm_CommKey; /* MenuItem Command Key Equiv */
UWORD nm_Flags; /* Menu or MenuItem flags (see note) */
LONG nm_MutualExclude; /* MenuItem MutualExclude word */
APTR nm_UserData; /* For your own use, see note */
};
/* Each nm_Type should be one of these: */
#define NM_TITLE 1
#define NM_ITEM 2
#define NM_SUB 3
#define NM_END 0
#define MENU_IMAGE 128
/* For an image menu-item or sub-item, use one of these. Set
* nm_Label to point at the Image structure you wish to use.
* NOTE: At present, you may only use conventional images.
* Custom images created from Intuition image-classes do not work.
*/
#define IM_ITEM (NM_ITEM | MENU_IMAGE)
#define IM_SUB (NM_SUB | MENU_IMAGE)
/* If you set your label to NM_BARLABEL, you'll get a separator bar. */
#define NM_BARLABEL ((STRPTR)-1)
/* The nm_Flags field is used to fill out either the Menu->Flags or
MenuItem->Flags field. Note that the sense of the MENUENABLED or
ITEMENABLED bit is inverted between this use and Intuition's use,
in other words, NewMenus are enabled by default. The following
labels are provided to disable them: */
#define NM_MENUDISABLED MENUENABLED
#define NM_ITEMDISABLED ITEMENABLED
/* The following are pre-cleared (COMMSEQ, ITEMTEXT, and HIGHxxx are set
later as appropriate): */
#define NM_FLAGMASK (~(COMMSEQ | ITEMTEXT | HIGHFLAGS))
/* You may choose among CHECKIT, MENUTOGGLE, and CHECKED.
Toggle-select menuitems are of type CHECKIT|MENUTOGGLE, along
with CHECKED if currently selected. Mutually exclusive ones
are of type CHECKIT, and possibly CHECKED too. The nm_MutualExclude
is a bit-wise representation of the items excluded by this one,
so in the simplest case (choose 1 among n), these flags would be
~1, ~2, ~4, ~8, ~16, etc. See the Intuition Menus chapter. */
/* A UserData pointer can be associated with each Menu and MenuItem structure.
The CreateMenus() call allocates space for a UserData after each
Menu or MenuItem (header, item or sub-item). You should use the
GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it. */
#define GTMENU_USERDATA(menu) (* ( (APTR *)(((struct Menu *)menu)+1) ) )
#define GTMENUITEM_USERDATA(menuitem) (* ( (APTR *)(((struct MenuItem *)menuitem)+1) ) )
/* Here is an old one for compatibility. Do not use in new code! */
#define MENU_USERDATA(menuitem) (* ( (APTR *)(menuitem+1) ) )
/* These return codes can be obtained through the GTMN_SecondaryError tag */
#define GTMENU_TRIMMED 0x00000001 /* Too many menus, items, or subitems,
menu has been trimmed down */
#define GTMENU_INVALID 0x00000002 /* Invalid NewMenu array */
#define GTMENU_NOMEM 0x00000003 /* Out of memory */
/*------------------------------------------------------------------------*/
/* Tags for toolkit functions: */
#define GT_TagBase TAG_USER + 0x80000
#define GTVI_NewWindow GT_TagBase+1 /* Unused */
#define GTVI_NWTags GT_TagBase+2 /* Unused */
#define GT_Private0 GT_TagBase+3 /* (private) */
#define GTCB_Checked GT_TagBase+4 /* State of checkbox */
#define GTLV_Top GT_TagBase+5 /* Top visible one in listview */
#define GTLV_Labels GT_TagBase+6 /* List to display in listview */
#define GTLV_ReadOnly GT_TagBase+7 /* TRUE if listview is to be
read-only */
#define GTLV_ScrollWidth GT_TagBase+8 /* Width of scrollbar */
#define GTMX_Labels GT_TagBase+9 /* NULL-terminated array of labels */
#define GTMX_Active GT_TagBase+10 /* Active one in mx gadget */
#define GTTX_Text GT_TagBase+11 /* Text to display */
#define GTTX_CopyText GT_TagBase+12 /* Copy text label instead of
referencing it */
#define GTNM_Number GT_TagBase+13 /* Number to display */
#define GTCY_Labels GT_TagBase+14 /* NULL-terminated array of labels */
#define GTCY_Active GT_TagBase+15 /* The active one in the cycle gad */
#define GTPA_Depth GT_TagBase+16 /* Number of bitplanes in palette */
#define GTPA_Color GT_TagBase+17 /* Palette color */
#define GTPA_ColorOffset GT_TagBase+18 /* First color to use in palette */
#define GTPA_IndicatorWidth GT_TagBase+19 /* Width of current-color indicator */
#define GTPA_IndicatorHeight GT_TagBase+20 /* Height of current-color indicator */