home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
oberon-a-1.4ß.lha
/
Oberon-A
/
source
/
amiga
/
GadTools.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
25KB
|
736 lines
(***************************************************************************
$RCSfile: GadTools.mod $
Description: Interface to gadtools.library
Created by: fjc (Frank Copeland)
$Revision: 3.2 $
$Author: fjc $
$Date: 1994/08/08 01:11:04 $
Includes Release 40.15
(C) Copyright 1989-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A interface Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
***************************************************************************)
MODULE GadTools;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT
E := Exec, U := Utility, G := Graphics, I := Intuition, SYS := SYSTEM;
(*
** $VER: gadtools.h 39.9 (19.8.92)
**
** gadtools.library definitions
*)
(* -----------------------------------------------------------------------*)
(* The kinds (almost classes) of gadgets in the toolkit. Use these
identifiers when calling CreateGadgetA() *)
CONST
genericKind * = 0;
buttonKind * = 1;
checkBoxKind * = 2;
integerKind * = 3;
listViewKind * = 4;
mxKind * = 5;
numberKind * = 6;
cycleKind * = 7;
paletteKind * = 8;
scrollerKind * = 9;
(* Kind number 10 is reserved *)
sliderKind * = 11;
stringKind * = 12;
textKind * = 13;
numKinds * = 14;
(* -----------------------------------------------------------------------*)
CONST
(* 'Or' the appropriate set together for your Window IDCMPFlags: *)
arrowIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpIntuiTicks, I.idcmpMouseButtons };
buttonIdcmp * = { I.idcmpGadgetUp };
checkBoxIdcmp * = { I.idcmpGadgetUp };
integerIdcmp * = { I.idcmpGadgetUp };
listViewIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove } + arrowIdcmp;
mxIdcmp * = { I.idcmpGadgetDown };
numberIdcmp * = {};
cycleIdcmp * = { I.idcmpGadgetUp };
paletteIdcmp * = { I.idcmpGadgetUp };
(* Use ArrowIdcmp + ScrollerIdcmp if your scrollers have arrows: *)
scrollerIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove };
sliderIdcmp * =
{ I.idcmpGadgetUp, I.idcmpGadgetDown, I.idcmpMouseMove };
stringIdcmp * = { I.idcmpGadgetUp };
textIdcmp * = {};
(* -----------------------------------------------------------------------*)
TYPE
VisualInfo * = CPOINTER TO RECORD END;
(* Generic NewGadget used by several of the gadget classes: *)
NewGadgetPtr * = CPOINTER TO NewGadget;
NewGadget * = RECORD
leftEdge *,
topEdge * : INTEGER; (* gadget position *)
width *,
height * : INTEGER; (* gadget size *)
gadgetText * : E.STRPTR; (* gadget label *)
textAttr * : G.TextAttrPtr; (* desired font for gadget label *)
gadgetID * : E.UWORD; (* gadget ID *)
flags * : SET; (* see below *)
visualInfo * : VisualInfo; (* Set to retval of GetVisualInfo() *)
userData * : E.APTR; (* gadget UserData *)
END; (* NewGadget *)
CONST
(* flags control certain aspects of the gadget. The first five control
* the placement of the descriptive text. Each gadget kind has its default,
* which is usually placeTextLeft. Consult the autodocs for details.
*)
placeTextLeft * = 0; (* Right-align text on left side *)
placeTextRight * = 1; (* Left-align text on right side *)
placeTextAbove * = 2; (* Center text above *)
placeTextBelow * = 3; (* Center text below *)
placeTextIn * = 4; (* Center text on *)
ngHighLabel * = 5; (* Highlight the label *)
(* -----------------------------------------------------------------------*)
TYPE
(* Fill out an array of these and pass that to CreateMenus(): *)
NewMenuPtr * = CPOINTER TO NewMenu;
NewMenu * = RECORD
type * : SHORTINT; (* See below *)
(* Compiler inserts a PAD byte here *)
label * : E.STRPTR; (* Menu's label *)
commKey * : E.STRPTR; (* MenuItem Command Key Equiv *)
flags * : E.WSET; (* Menu or MenuItem flags (see note) *)
mutualExclude * : SET; (* MenuItem MutualExclude word *)
userData * : E.APTR; (* For your own use, see note *)
END; (* NewMenu *)
CONST
(* Needed only by inside im* definitions below *)
menuImage * = -128;
(* type determines what each NewMenu structure corresponds to.
* for the nmTitle, nmItem, and nmSub values, label should
* be a text string to use for that menu title, item, or sub-item.
* For imItem or imSub, set label to point at the Image structure
* you wish to use for this item or sub-item.
* NOTE: At present, you may only use conventional images.
* Custom images created from Intuition image-classes do not work.
*)
nmTitle * = 1;
nmItem * = 2;
nmSub * = 3;
imItem * = nmItem + menuImage;
imSub * = nmSub + menuImage;
(* The NewMenu array should be terminated with a NewMenu whose
* type equals nmEnd.
*)
nmEnd * = 0; (* End of NewMenu array *)
(* Starting with V39, GadTools will skip any NewMenu entries whose
* ype field has the nmIgnore bit set.
*)
nmIgnore * = 64;
(* nm_Label should be a text string for textual items, a pointer
* to an Image structure for graphical menu items, or the special
* constant nmBarlabel, to get a separator bar.
*)
nmBarLabel * = SYS.VAL(E.STRPTR, -1);
(* The nmFlags 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: *)
nmMenuDisabled * = I.menuEnabled;
nmItemDisabled * = I.itemEnabled;
(* New for V39: nmCommandString. For a textual MenuItem or SubItem,
* point commKey at an arbitrary string, and set the nmCommandString
* flag.
*)
nmCommandString * = I.commSeq;
(* The following are pre-cleared (commSeq, itemText, and highxxx are set
* later as appropriate):
* Under V39, the commSeq flag bit is not cleared, since it now has
* meaning.
*)
nmFlagMask * = -({ I.commSeq, I.itemText } + I.highFlags);
nmFlagMaskV39 * = -({I.itemText} + I.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 nmMutualExclude
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 gtmnSecondaryError tag *)
menuTrimmed * = 00000001H; (* Too many menus, items, or subitems,
menu has been trimmed down *)
menuInvalid * = 00000002H; (* Invalid NewMenu array *)
menuNoMem * = 00000003H; (* Out of memory *)
(*------------------------------------------------------------------------*)
(* Starting with V39, checkboxes and mx gadgets can be scaled to your
* specified gadget width/height. Use the new cbScaled or mxScaled
* tags, respectively. Under V37, and by def