BB2 C port
API reference: Blitz libraries in C and the shared code
Loading...
Searching...
No Matches
gadgetslib.c File Reference
#include "blitzlib.h"
#include "blitzobj.h"
#include <intuition/intuition.h>
#include <proto/intuition.h>
#include <stddef.h>

Data Structures

struct  gborder
struct  gborders
struct  gtext

Macros

#define __NOLIBBASE__
#define INTUITION_BASE_NAME   intbase
#define BORDERSIZ   36
#define BORDERMEM   (BORDERSIZ * 2)
#define GADGETSIZE   44
#define GFLAGS_HI(gad)
#define GFLAGS_LO(gad)
#define GACT_HI(gad)
#define GACT_LO(gad)
#define GTYPE_HI(gad)
#define GTYPE_LO(gad)
#define GUSER_BL(gad)
#define GUSER_GROUP(gad)
#define UW(p, o)

Functions

void dotextgadget (WORD x, WORD y, ULONG flags, UWORD id, const UBYTE *text, struct TextAttr **font, const ULONG *lens, struct Library *intbase)
 TextGadget GadgetList#,X,Y,Flags,Id,Text$: add a text (boolean) gadget to the list.
void dostringgadget (WORD x, WORD y, ULONG flags, UWORD id, UWORD maxlen, const UWORD *args)
 StringGadget GadgetList#,X,Y,Flags,Id,Maxlen,Width: add a string gadget to the list.
void dopropgadget (WORD x, WORD y, ULONG flags, UWORD id, UWORD w, const UWORD *args)
 PropGadget GadgetList#,X,Y,Flags,Id,Width,Height: add a proportional gadget to the list.
void doshapegadget (WORD x, WORD y, ULONG flags, UWORD id, const struct bb_shape *shape)
 ShapeGadget GadgetList#,X,Y,Flags,Id,Shape#: add an image gadget made from a shape.
void doshapegadget2 (WORD x, WORD y, ULONG flags, UWORD id, const struct bb_shape *alt, const struct bb_shape *shape)
 ShapeGadget GadgetList#,X,Y,Flags,Id,Shape#,Shape#: an image gadget with an alternative image for the selected state (GADGHIMAGE).
void dosethprop (void)
void dosetvprop (void)
void dohproppot (void)
void dohpropbody (void)
void dovproppot (void)
void dovpropbody (void)
void doredraw (UWORD id, struct Window **win, struct Library *intbase)
 Redraw Window#,Id: redraw a gadget of the window.
void gadgetslib_doselect (void)
void gadgetslib_doselect2 (void)
void dogborder (WORD x, WORD y, WORD w, WORD h, struct Window **win, struct Library *intbase)
 GadgetBorder X,Y,Width,Height: draw a gadget style border into the used window.
void dogb2 (void)
void dogb (void)
ULONG dostringactivate (UWORD id, struct Window **win, struct Library *intbase)
 ActivateString Window#,Id: activate a string gadget of the window.
void dostringreset (void)
void dostringtext (void)
void dostringclear (void)
void dogpens2 (void)
void dogpens (void)
void dobpens (void)
void dogjam (void)
void doselectmode (void)
void dosetstring (void)
void dobgroup (void)
void dogstatus (void)
void dobuttonid (void)
void gadgetslib_doenable (void)
void gadgetslib_dodisable (void)
void setdogstatus (void)
void settextgadget (void)
void gadgetslib_codeinit (void)
void freegadget (void)
 _free of a GadgetList object: free its gadgets.
void gadgetslib_sgchk (void)
void gadgetslib_sgchk2 (void)
void propchk (void)
void redrawchk (void)
void gchk (void)
void gadgetslib_wchk (void)
void actchk (void)
void reschk (void)
void settest (void)
void bgroupchk (void)
void stringchk (void)
static UBYTE * allocst (const UBYTE *s, ULONG len)
static void freest (ULONG str)
static UBYTE * globalloc (ULONG size, ULONG flags)
static void globfree (void *mem, ULONG size)
static struct Gadget * findgadget (struct Gadget **list, UWORD id)
static void codeinit_c (void)
static void dobgroup_c (UWORD grp)
 ButtonGroup Group: the button group of the following gadgets.
 BLITZ_ALIAS (dobgroup, dobgroup_c)
static void doselectmode_c (UWORD on)
 SelectMode 1=Box, 0=Inverse: the highlight mode of new gadgets.
 BLITZ_ALIAS (doselectmode, doselectmode_c)
static void dogjam_c (UBYTE mode)
 GadgetJam Jammode: the draw mode of the gadget texts.
 BLITZ_ALIAS (dogjam, dogjam_c)
static void dogpens_c (UBYTE fg, UBYTE bg)
 GadgetPens Foreground Colour,Background Colour: the pens of the gadget texts.
 BLITZ_ALIAS (dogpens, dogpens_c)
static void dogpens2_c (UBYTE fg)
 GadgetPens Foreground Colour: the front pen only.
 BLITZ_ALIAS (dogpens2, dogpens2_c)
static void dobpens_c (UBYTE light, UBYTE shadow)
 BorderPens Highlight Colour,Shadow Colour: the pens of the gadget borders.
 BLITZ_ALIAS (dobpens, dobpens_c)
static void dogb_c (UWORD w, UWORD h)
 Borders Width,Height: the space between a gadget's text and its border.
 BLITZ_ALIAS (dogb, dogb_c)
static void dogb2_c (WORD on)
 Borders On|Off: give new gadgets borders or not.
 BLITZ_ALIAS (dogb2, dogb2_c)
static struct gborders * allocborder2 (WORD w, WORD h)
static struct gborders * allocborder (WORD w, WORD h)
static struct Gadget * allocgadget (WORD x, WORD y, UWORD id, WORD w, WORD h)
static struct gtext * allocintui (const UBYTE *s, ULONG len)
static void handleflags (struct Gadget *gad, ULONG flags)
static WORD findmaxlen (struct gtext *it, struct Library *intbase)
static struct Image * makeintuishape (const struct bb_shape *shape)
static void shapegadget (WORD x, WORD y, ULONG flags, UWORD id, const struct bb_shape *shape, struct Image *alt)
static void setprop (UWORD id, ULONG pot, ULONG body, struct Gadget **list, int off)
static void dosethprop_c (UWORD id, ULONG pot, ULONG body, struct Gadget **list)
 SetHProp GadgetList#,Id,Pot,Body: the horizontal pot and body of a prop gadget.
 BLITZ_ALIAS (dosethprop, dosethprop_c)
static void dosetvprop_c (UWORD id, ULONG pot, ULONG body, struct Gadget **list)
 SetVProp GadgetList#,Id,Pot,Body: the vertical pot and body of a prop gadget.
 BLITZ_ALIAS (dosetvprop, dosetvprop_c)
static ULONG readprop (UWORD id, struct Gadget **list, int off)
static ULONG dohproppot_c (UWORD id, struct Gadget **list)
 HPropPot(GadgetList#,Id): the HorizPot of a prop gadget.
 BLITZ_ALIAS (dohproppot, dohproppot_c)
static ULONG dohpropbody_c (UWORD id, struct Gadget **list)
 HPropBody(GadgetList#,Id): the HorizBody of a prop gadget.
 BLITZ_ALIAS (dohpropbody, dohpropbody_c)
static ULONG dovproppot_c (UWORD id, struct Gadget **list)
 VPropPot(GadgetList#,Id): the VertPot of a prop gadget.
 BLITZ_ALIAS (dovproppot, dovproppot_c)
static ULONG dovpropbody_c (UWORD id, struct Gadget **list)
 VPropBody(GadgetList#,Id): the VertBody of a prop gadget.
 BLITZ_ALIAS (dovpropbody, dovpropbody_c)
static void doselect_c (UWORD id, UWORD on, struct Gadget **list)
 Toggle GadgetList#,Id,On|Off: select or deselect a gadget.
 BLITZ_ALIAS (gadgetslib_doselect, doselect_c)
static void doselect2_c (UWORD id, struct Gadget **list)
 Toggle GadgetList#,Id: flip the SELECTED state of a gadget.
 BLITZ_ALIAS (gadgetslib_doselect2, doselect2_c)
static void doenable_c (UWORD id, struct Gadget **list)
 Enable GadgetList#,Id: clear DISABLED of a gadget.
 BLITZ_ALIAS (gadgetslib_doenable, doenable_c)
static void dodisable_c (UWORD id, struct Gadget **list)
 Disable GadgetList#,Id: set DISABLED of a gadget.
 BLITZ_ALIAS (gadgetslib_dodisable, dodisable_c)
static void setdogstatus_c (UWORD id, UWORD v, struct Gadget **list)
 SetGadgetStatus GadgetList#,Id,Value: show text part Value of a cycling text gadget.
 BLITZ_ALIAS (setdogstatus, setdogstatus_c)
static ULONG dogstatus_c (UWORD id, struct Gadget **list)
 GadgetStatus(GadgetList#,Id): the shown text part, or whether the gadget is selected.
 BLITZ_ALIAS (dogstatus, dogstatus_c)
static ULONG dobuttonid_c (UWORD grp, struct Gadget **list)
 ButtonId(GadgetList#,ButtonGroup): the selected gadget of a button group.
 BLITZ_ALIAS (dobuttonid, dobuttonid_c)
static void settextgadget_c (UWORD id, const UBYTE *src, struct Gadget **list)
 SetTextGadget GadgetList#,Id,Text$: overwrite the text of a gadget.
 BLITZ_ALIAS (settextgadget, settextgadget_c)
static void dosetstring_c (UWORD id, const UBYTE *s, struct Gadget **list)
 SetString GadgetList#,Id,String$: set the contents of a string gadget.
 BLITZ_ALIAS (dosetstring, dosetstring_c)
static void dostringclear_c (UWORD id, struct Gadget **list)
 ClearString GadgetList#,Id: empty a string gadget.
 BLITZ_ALIAS (dostringclear, dostringclear_c)
static void dostringreset_c (UWORD id, struct Gadget **list)
 ResetString GadgetList#,Id: the cursor of a string gadget to the start.
 BLITZ_ALIAS (dostringreset, dostringreset_c)
static ULONG dostringtext_c (UWORD id, struct Gadget **list)
 StringText$(GadgetList#,Id): the contents of a string gadget.
 BLITZ_ALIAS (dostringtext, dostringtext_c)
static void freerend (struct Gadget *gad, APTR r)
static struct Gadget * gchk1 (struct Gadget **list, UWORD id)
static void gchk_c (UWORD id, struct Gadget **list)
static void propchk_c (UWORD id, struct Gadget **list)
static struct Gadget * redrawchk1 (UWORD id, struct Window **win)
static void redrawchk_c (UWORD id, struct Window **win)
static void actchk_c (UWORD id, struct Window **win)
static struct Gadget * reschk1 (UWORD id, struct Gadget **list)
static void reschk_c (UWORD id, struct Gadget **list)
static void settest_c (UWORD id, struct Gadget **list, const ULONG *lens)
static void wchk_c (struct Window **win)
static void sgchk2_c (const struct bb_shape *alt, const struct bb_shape *shape)
static void sgchk_c (const struct bb_shape *shape)
static void bgroupchk_c (WORD grp)
static void stringchk_c (UWORD maxlen)

Variables

struct { 
   UBYTE   fpen 
   UBYTE   bpen 
   UBYTE   bco1 
   UBYTE   bco2 
   UBYTE   mode 
   UBYTE   pad 
   WORD   bxxs 
   WORD   byxs 
   WORD   fhit 
   WORD   bordersok 
   WORD   bxxs2 
   WORD   byxs2 
   ULONG   fontattr 
   WORD   selmode 
   WORD   defflags 
   WORD   bgroup 
} g = { 1, 0, 1, 2, 0, 0, 4, 2, 8, -1, 4, 2, 0, 0, 0, 0 }

Macro Definition Documentation

◆ __NOLIBBASE__

#define __NOLIBBASE__

◆ BORDERMEM

#define BORDERMEM   (BORDERSIZ * 2)

◆ BORDERSIZ

#define BORDERSIZ   36

◆ GACT_HI

#define GACT_HI ( gad)
Value:
(((UBYTE *)&(gad)->Activation)[0]) /* 14: bit 0 TOGGLESELECT */

◆ GACT_LO

#define GACT_LO ( gad)
Value:
(((UBYTE *)&(gad)->Activation)[1]) /* 15: the border flags */

◆ GADGETSIZE

#define GADGETSIZE   44

◆ GFLAGS_HI

#define GFLAGS_HI ( gad)
Value:
(((UBYTE *)&(gad)->Flags)[0]) /* 12: bit 0 DISABLED */

◆ GFLAGS_LO

#define GFLAGS_LO ( gad)
Value:
(((UBYTE *)&(gad)->Flags)[1]) /* 13: SELECTED, GADGIMAGE ... */

◆ GTYPE_HI

#define GTYPE_HI ( gad)
Value:
(((UBYTE *)&(gad)->GadgetType)[0]) /* 16: GZZGADGET */

◆ GTYPE_LO

#define GTYPE_LO ( gad)
Value:
(((UBYTE *)&(gad)->GadgetType)[1]) /* 17: the gadget type */

◆ GUSER_BL

#define GUSER_BL ( gad)
Value:
(((UWORD *)&(gad)->UserData)[0]) /* 40 */

◆ GUSER_GROUP

#define GUSER_GROUP ( gad)
Value:
(((UWORD *)&(gad)->UserData)[1]) /* 42 */

◆ INTUITION_BASE_NAME

#define INTUITION_BASE_NAME   intbase

◆ UW

#define UW ( p,
o )
Value:
(*(UWORD *)((UBYTE *)(p) + (o)))

Function Documentation

◆ actchk()

void actchk ( void )

◆ actchk_c()

void actchk_c ( UWORD id,
struct Window ** win )
static

◆ allocborder()

struct gborders * allocborder ( WORD w,
WORD h )
static

◆ allocborder2()

struct gborders * allocborder2 ( WORD w,
WORD h )
static

◆ allocgadget()

struct Gadget * allocgadget ( WORD x,
WORD y,
UWORD id,
WORD w,
WORD h )
static

◆ allocintui()

struct gtext * allocintui ( const UBYTE * s,
ULONG len )
static

◆ allocst()

UBYTE * allocst ( const UBYTE * s,
ULONG len )
static

◆ bgroupchk()

void bgroupchk ( void )

◆ bgroupchk_c()

void bgroupchk_c ( WORD grp)
static

◆ BLITZ_ALIAS() [1/26]

BLITZ_ALIAS ( dobgroup ,
dobgroup_c  )

◆ BLITZ_ALIAS() [2/26]

BLITZ_ALIAS ( dobpens ,
dobpens_c  )

◆ BLITZ_ALIAS() [3/26]

BLITZ_ALIAS ( dobuttonid ,
dobuttonid_c  )

◆ BLITZ_ALIAS() [4/26]

BLITZ_ALIAS ( dogb ,
dogb_c  )

◆ BLITZ_ALIAS() [5/26]

BLITZ_ALIAS ( dogb2 ,
dogb2_c  )

◆ BLITZ_ALIAS() [6/26]

BLITZ_ALIAS ( dogjam ,
dogjam_c  )

◆ BLITZ_ALIAS() [7/26]

BLITZ_ALIAS ( dogpens ,
dogpens_c  )

◆ BLITZ_ALIAS() [8/26]

BLITZ_ALIAS ( dogpens2 ,
dogpens2_c  )

◆ BLITZ_ALIAS() [9/26]

BLITZ_ALIAS ( dogstatus ,
dogstatus_c  )

◆ BLITZ_ALIAS() [10/26]

BLITZ_ALIAS ( dohpropbody ,
dohpropbody_c  )

◆ BLITZ_ALIAS() [11/26]

BLITZ_ALIAS ( dohproppot ,
dohproppot_c  )

◆ BLITZ_ALIAS() [12/26]

BLITZ_ALIAS ( doselectmode ,
doselectmode_c  )

◆ BLITZ_ALIAS() [13/26]

BLITZ_ALIAS ( dosethprop ,
dosethprop_c  )

◆ BLITZ_ALIAS() [14/26]

BLITZ_ALIAS ( dosetstring ,
dosetstring_c  )

◆ BLITZ_ALIAS() [15/26]

BLITZ_ALIAS ( dosetvprop ,
dosetvprop_c  )

◆ BLITZ_ALIAS() [16/26]

BLITZ_ALIAS ( dostringclear ,
dostringclear_c  )

◆ BLITZ_ALIAS() [17/26]

BLITZ_ALIAS ( dostringreset ,
dostringreset_c  )

◆ BLITZ_ALIAS() [18/26]

BLITZ_ALIAS ( dostringtext ,
dostringtext_c  )

◆ BLITZ_ALIAS() [19/26]

BLITZ_ALIAS ( dovpropbody ,
dovpropbody_c  )

◆ BLITZ_ALIAS() [20/26]

BLITZ_ALIAS ( dovproppot ,
dovproppot_c  )

◆ BLITZ_ALIAS() [21/26]

BLITZ_ALIAS ( gadgetslib_dodisable ,
dodisable_c  )

◆ BLITZ_ALIAS() [22/26]

BLITZ_ALIAS ( gadgetslib_doenable ,
doenable_c  )

◆ BLITZ_ALIAS() [23/26]

BLITZ_ALIAS ( gadgetslib_doselect ,
doselect_c  )

◆ BLITZ_ALIAS() [24/26]

BLITZ_ALIAS ( gadgetslib_doselect2 ,
doselect2_c  )

◆ BLITZ_ALIAS() [25/26]

BLITZ_ALIAS ( setdogstatus ,
setdogstatus_c  )

◆ BLITZ_ALIAS() [26/26]

BLITZ_ALIAS ( settextgadget ,
settextgadget_c  )

◆ codeinit_c()

void codeinit_c ( void )
static

◆ dobgroup()

void dobgroup ( void )

◆ dobgroup_c()

void dobgroup_c ( UWORD grp)
static

ButtonGroup Group: the button group of the following gadgets.

Gadgets made with flag bit 9 get it in the low word of UserData (ButtonId). Errors (debugger, bgroupchk): "Button Group MUST be greater than zero".

Parameters
grpd0: the group

◆ dobpens()

void dobpens ( void )

◆ dobpens_c()

void dobpens_c ( UBYTE light,
UBYTE shadow )
static

BorderPens Highlight Colour,Shadow Colour: the pens of the gadget borders.

Parameters
lightd0: the pen of the left/top border
shadowd1: the pen of the right/bottom border

◆ dobuttonid()

void dobuttonid ( void )

◆ dobuttonid_c()

ULONG dobuttonid_c ( UWORD grp,
struct Gadget ** list )
static

ButtonId(GadgetList#,ButtonGroup): the selected gadget of a button group.

The first gadget of the list with the group in UserData and SELECTED set. Not a bug (word function): the upper word of d0 is that of the gadget pointer.

Parameters
grpd1: the button group
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0.w: the gadget id, -1 if none is selected

◆ dodisable_c()

void dodisable_c ( UWORD id,
struct Gadget ** list )
static

Disable GadgetList#,Id: set DISABLED of a gadget.

Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)

◆ doenable_c()

void doenable_c ( UWORD id,
struct Gadget ** list )
static

Enable GadgetList#,Id: clear DISABLED of a gadget.

Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)

◆ dogb()

void dogb ( void )

◆ dogb2()

void dogb2 ( void )

◆ dogb2_c()

void dogb2_c ( WORD on)
static

Borders On|Off: give new gadgets borders or not.

Off saves the border excess and sets it to 0, On restores it; nothing happens if the state does not change.

Parameters
ond0: 0 = off, anything else = on

◆ dogb_c()

void dogb_c ( UWORD w,
UWORD h )
static

Borders Width,Height: the space between a gadget's text and its border.

Sets the border excess and its saved copy (the value Borders On restores).

Parameters
wd0: the horizontal excess
hd1: the vertical excess

◆ dogborder()

void dogborder ( WORD x,
WORD y,
WORD w,
WORD h,
struct Window ** win,
struct Library * intbase )

GadgetBorder X,Y,Width,Height: draw a gadget style border into the used window.

The border goes around the box with the saved border excess (also with Borders off); its memory is freed again. Amiga mode only. Errors (debugger, wchk): "Uninitialized Window".

Parameters
xd0: the left edge of the box
yd1: the top edge
wd2: the width
hd3: the height
wina1: the used window (!libs windowslib,$1102)
intbasea6: intuition.library

◆ dogjam()

void dogjam ( void )

◆ dogjam_c()

void dogjam_c ( UBYTE mode)
static

GadgetJam Jammode: the draw mode of the gadget texts.

Parameters
moded0: the IntuiText DrawMode of new text gadgets

◆ dogpens()

void dogpens ( void )

◆ dogpens2()

void dogpens2 ( void )

◆ dogpens2_c()

void dogpens2_c ( UBYTE fg)
static

GadgetPens Foreground Colour: the front pen only.

Parameters
fgd0: the FrontPen of new text gadgets

◆ dogpens_c()

void dogpens_c ( UBYTE fg,
UBYTE bg )
static

GadgetPens Foreground Colour,Background Colour: the pens of the gadget texts.

Parameters
fgd0: the FrontPen of new text gadgets
bgd1: the BackPen

◆ dogstatus()

void dogstatus ( void )

◆ dogstatus_c()

ULONG dogstatus_c ( UWORD id,
struct Gadget ** list )
static

GadgetStatus(GadgetList#,Id): the shown text part, or whether the gadget is selected.

For a text gadget that is no toggle gadget: the number of the shown part (1 = first). For toggle gadgets and gadgets without text: -1 if SELECTED, else 0 (SNE/EXT.w: not a bug, the upper word of d0 is that of the GadgetText pointer). Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0.w: the part number, or -1/0

◆ dohpropbody()

void dohpropbody ( void )

◆ dohpropbody_c()

ULONG dohpropbody_c ( UWORD id,
struct Gadget ** list )
static

HPropBody(GadgetList#,Id): the HorizBody of a prop gadget.

Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0: the HorizBody as a Quick ($FFFF = almost 1.0)

◆ dohproppot()

void dohproppot ( void )

◆ dohproppot_c()

ULONG dohproppot_c ( UWORD id,
struct Gadget ** list )
static

HPropPot(GadgetList#,Id): the HorizPot of a prop gadget.

Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0: the HorizPot as a Quick ($FFFF = almost 1.0)

◆ dopropgadget()

void dopropgadget ( WORD x,
WORD y,
ULONG flags,
UWORD id,
UWORD w,
const UWORD * args )

PropGadget GadgetList#,X,Y,Flags,Id,Width,Height: add a proportional gadget to the list.

a3 = the list. A PropInfo with AUTOKNOB and PROPNEWLOOK, pots and bodies $8000, and an empty knob Image. Flags as TextGadget, plus bit 6 FREEHORIZ, 7 FREEVERT, 8 PROPBORDERLESS.

Parameters
xd1: the left edge
yd2: the top edge
flagsd3: the flags
idd4: the gadget id
wd5: the width
argsa2: the argument stack, Height at -4(a2) (its low word)

◆ doredraw()

void doredraw ( UWORD id,
struct Window ** win,
struct Library * intbase )

Redraw Window#,Id: redraw a gadget of the window.

RefreshGList(gadget, window, 0, 1). Amiga mode only. Errors (debugger, redrawchk): "Uninitialized Window", "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the window's gadget list.

Parameters
idd1: the gadget id
wina1: the window (!libs windowslib,$1180)
intbasea6: intuition.library

◆ doselect2_c()

void doselect2_c ( UWORD id,
struct Gadget ** list )
static

Toggle GadgetList#,Id: flip the SELECTED state of a gadget.

Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)

◆ doselect_c()

void doselect_c ( UWORD id,
UWORD on,
struct Gadget ** list )
static

Toggle GadgetList#,Id,On|Off: select or deselect a gadget.

Sets or clears SELECTED; the gadget is not redrawn. Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
ond2: 0 = deselect, anything else = select
lista1: the gadget list (!libs gadgetslib,$1180)

◆ doselectmode()

void doselectmode ( void )

◆ doselectmode_c()

void doselectmode_c ( UWORD on)
static

SelectMode 1=Box, 0=Inverse: the highlight mode of new gadgets.

Stores 1 for any non-zero value, 0 otherwise (g.selmode), and the same as the highlight bits of the Flags of new gadgets (g.defflags: 1 = GADGHBOX, 0 = GADGHCOMP). Fixed (#952): the original stored only selmode, which nothing reads - the command had no effect.

Parameters
ond0: the mode

◆ dosethprop()

void dosethprop ( void )

◆ dosethprop_c()

void dosethprop_c ( UWORD id,
ULONG pot,
ULONG body,
struct Gadget ** list )
static

SetHProp GadgetList#,Id,Pot,Body: the horizontal pot and body of a prop gadget.

Quick values, 1.0 ($10000) or more becomes $FFFF. The gadget is not redrawn. Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
potd2: the pot (Quick)
bodyd3: the body (Quick)
lista1: the gadget list (!libs gadgetslib,$1180)

◆ dosetstring()

void dosetstring ( void )

◆ dosetstring_c()

void dosetstring_c ( UWORD id,
const UBYTE * s,
struct Gadget ** list )
static

SetString GadgetList#,Id,String$: set the contents of a string gadget.

Copies the string (with its 0) into the buffer; the positions stay and the gadget is not redrawn. Errors (debugger, settest): as ResetString, and "String to long for Gadget" if the string is not shorter than MaxChars.

Parameters
idd1: the gadget id
sd2: String$
lista1: the gadget list (!libs gadgetslib,$1180)

◆ dosetvprop()

void dosetvprop ( void )

◆ dosetvprop_c()

void dosetvprop_c ( UWORD id,
ULONG pot,
ULONG body,
struct Gadget ** list )
static

SetVProp GadgetList#,Id,Pot,Body: the vertical pot and body of a prop gadget.

As SetHProp. Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
potd2: the pot (Quick)
bodyd3: the body (Quick)
lista1: the gadget list (!libs gadgetslib,$1180)

◆ doshapegadget()

void doshapegadget ( WORD x,
WORD y,
ULONG flags,
UWORD id,
const struct bb_shape * shape )

ShapeGadget GadgetList#,X,Y,Flags,Id,Shape#: add an image gadget made from a shape.

a3 = the list. The position is moved by the shape's handle, the Image (makeintuishape) uses the shape's data. Flags as TextGadget. Fixed (#167): a shape of depth 0 (PlanePick $FF) is refused at its creation by the error check of InitShape (#243). Errors (debugger, sgchk): "Uninitialized Shape".

Parameters
xd1: the left edge
yd2: the top edge
flagsd3: the flags
idd4: the gadget id
shapea2: the shape (!libs shapeslib,$1285)

◆ doshapegadget2()

void doshapegadget2 ( WORD x,
WORD y,
ULONG flags,
UWORD id,
const struct bb_shape * alt,
const struct bb_shape * shape )

ShapeGadget GadgetList#,X,Y,Flags,Id,Shape#,Shape#: an image gadget with an alternative image for the selected state (GADGHIMAGE).

As ShapeGadget. Errors (debugger, sgchk2): "Uninitialized Shape" for either shape.

Parameters
xd1: the left edge
yd2: the top edge
flagsd3: the flags
idd4: the gadget id
alta1: the alternative shape (!libs shapeslib,$1186)
shapea2: the shape (!libs shapeslib,$1285)

◆ dostringactivate()

ULONG dostringactivate ( UWORD id,
struct Window ** win,
struct Library * intbase )

ActivateString Window#,Id: activate a string gadget of the window.

ActivateGadget(gadget, window, 0). Amiga mode only. Errors (debugger, actchk): "Uninitialized Window", "Can't Find Gadget", "Not a String Gadget". By design (#166) as Redraw.

Parameters
idd1: the gadget id
wina1: the window (!libs windowslib,$1180)
intbasea6: intuition.library
Returns
d0: ActivateGadget's result (a statement: not used)

◆ dostringclear()

void dostringclear ( void )

◆ dostringclear_c()

void dostringclear_c ( UWORD id,
struct Gadget ** list )
static

ClearString GadgetList#,Id: empty a string gadget.

BufferPos and DispPos 0, an empty buffer. Errors (debugger, reschk): "Can't Find Gadget", "Not a String Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)

◆ dostringgadget()

void dostringgadget ( WORD x,
WORD y,
ULONG flags,
UWORD id,
UWORD maxlen,
const UWORD * args )

StringGadget GadgetList#,X,Y,Flags,Id,Maxlen,Width: add a string gadget to the list.

a3 = the list. The gadget is the font height high, its border (if Borders are on) goes around it; the StringInfo gets a buffer of Maxlen bytes (cleared). Flags as TextGadget. Fixed (#164): with Borders off (no border) the original wrote the border offsets to the addresses 0, 2, 36 and 38. Fixed (#165): Maxlen 0 clears 65536 bytes behind the 0 byte buffer, as in the original; runtime error checking catches it (stringchk, which the original does not have). Errors (debugger, stringchk): "Maxlen MUST be greater than zero".

Parameters
xd1: the left edge
yd2: the top edge
flagsd3: the flags
idd4: the gadget id
maxlend5: the size of the buffer
argsa2: the argument stack, Width at -4(a2) (its low word)

◆ dostringreset()

void dostringreset ( void )

◆ dostringreset_c()

void dostringreset_c ( UWORD id,
struct Gadget ** list )
static

ResetString GadgetList#,Id: the cursor of a string gadget to the start.

BufferPos and DispPos 0, the contents stay. Errors (debugger, reschk): "Can't Find Gadget", "Not a String Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)

◆ dostringtext()

void dostringtext ( void )

◆ dostringtext_c()

ULONG dostringtext_c ( UWORD id,
struct Gadget ** list )
static

StringText$(GadgetList#,Id): the contents of a string gadget.

Copies the buffer to a3 (a3 is left on the terminating 0). Errors (debugger, reschk): "Can't Find Gadget", "Not a String Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0: the length

◆ dotextgadget()

void dotextgadget ( WORD x,
WORD y,
ULONG flags,
UWORD id,
const UBYTE * text,
struct TextAttr ** font,
const ULONG * lens,
struct Library * intbase )

TextGadget GadgetList#,X,Y,Flags,Id,Text$: add a text (boolean) gadget to the list.

a3 = the list. The IntuiText (struct gtext) gets a copy of the text, the gadget pens, the jam mode and the current font; a text with "|" cycles through its parts (SetGadgetStatus/GadgetStatus), the gadget is as wide as the widest part plus the border excess, with a border if Borders are on. Flags: bit 0 toggle, 1-4 relative right/bottom/width/ height, 5 box select, 9 button group, 12-15 right/left/top/bottom border, 16 GZZ gadget. TextGadget with an empty text has IText 0 (not a bug).

Parameters
xd1: the left edge
yd2: the top edge
flagsd3: the flags
idd4: the gadget id
textd5: Text$
fonta1: intuifontlib's current font (a TextAttr)
lensa2: the argument stack, the text's length at -4
intbasea6: intuition.library

◆ dovpropbody()

void dovpropbody ( void )

◆ dovpropbody_c()

ULONG dovpropbody_c ( UWORD id,
struct Gadget ** list )
static

VPropBody(GadgetList#,Id): the VertBody of a prop gadget.

Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0: the VertBody as a Quick ($FFFF = almost 1.0)

◆ dovproppot()

void dovproppot ( void )

◆ dovproppot_c()

ULONG dovproppot_c ( UWORD id,
struct Gadget ** list )
static

VPropPot(GadgetList#,Id): the VertPot of a prop gadget.

Errors (debugger, propchk): "Can't Find Gadget" (also if it is no prop gadget). By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
lista1: the gadget list (!libs gadgetslib,$1180)
Returns
d0: the VertPot as a Quick ($FFFF = almost 1.0)

◆ findgadget()

struct Gadget * findgadget ( struct Gadget ** list,
UWORD id )
static

◆ findmaxlen()

WORD findmaxlen ( struct gtext * it,
struct Library * intbase )
static

◆ freegadget()

void freegadget ( void )

_free of a GadgetList object: free its gadgets.

a3 = the list; the list is cleared, every "bL" gadget is freed with its IntuiText and text, its render and select Border or Image and its SpecialInfo (StringInfo and buffer, PropInfo). Fixed (#163): the original never freed the SpecialInfo.

◆ freerend()

void freerend ( struct Gadget * gad,
APTR r )
static

◆ freest()

void freest ( ULONG str)
static

◆ gadgetslib_codeinit()

void gadgetslib_codeinit ( void )

◆ gadgetslib_dodisable()

void gadgetslib_dodisable ( void )

◆ gadgetslib_doenable()

void gadgetslib_doenable ( void )

◆ gadgetslib_doselect()

void gadgetslib_doselect ( void )

◆ gadgetslib_doselect2()

void gadgetslib_doselect2 ( void )

◆ gadgetslib_sgchk()

void gadgetslib_sgchk ( void )

◆ gadgetslib_sgchk2()

void gadgetslib_sgchk2 ( void )

◆ gadgetslib_wchk()

void gadgetslib_wchk ( void )

◆ gchk()

void gchk ( void )

◆ gchk1()

struct Gadget * gchk1 ( struct Gadget ** list,
UWORD id )
static

◆ gchk_c()

void gchk_c ( UWORD id,
struct Gadget ** list )
static

◆ globalloc()

UBYTE * globalloc ( ULONG size,
ULONG flags )
static

◆ globfree()

void globfree ( void * mem,
ULONG size )
static

◆ handleflags()

void handleflags ( struct Gadget * gad,
ULONG flags )
static

◆ makeintuishape()

struct Image * makeintuishape ( const struct bb_shape * shape)
static

◆ propchk()

void propchk ( void )

◆ propchk_c()

void propchk_c ( UWORD id,
struct Gadget ** list )
static

◆ readprop()

ULONG readprop ( UWORD id,
struct Gadget ** list,
int off )
static

◆ redrawchk()

void redrawchk ( void )

◆ redrawchk1()

struct Gadget * redrawchk1 ( UWORD id,
struct Window ** win )
static

◆ redrawchk_c()

void redrawchk_c ( UWORD id,
struct Window ** win )
static

◆ reschk()

void reschk ( void )

◆ reschk1()

struct Gadget * reschk1 ( UWORD id,
struct Gadget ** list )
static

◆ reschk_c()

void reschk_c ( UWORD id,
struct Gadget ** list )
static

◆ setdogstatus()

void setdogstatus ( void )

◆ setdogstatus_c()

void setdogstatus_c ( UWORD id,
UWORD v,
struct Gadget ** list )
static

SetGadgetStatus GadgetList#,Id,Value: show text part Value of a cycling text gadget.

Value 1 = the first part; ignored for toggle gadgets, gadgets without text and Value 0. The gadget is not redrawn. Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
vd2: the part
lista1: the gadget list (!libs gadgetslib,$1180)

◆ setprop()

void setprop ( UWORD id,
ULONG pot,
ULONG body,
struct Gadget ** list,
int off )
static

◆ settest()

void settest ( void )

◆ settest_c()

void settest_c ( UWORD id,
struct Gadget ** list,
const ULONG * lens )
static

◆ settextgadget()

void settextgadget ( void )

◆ settextgadget_c()

void settextgadget_c ( UWORD id,
const UBYTE * src,
struct Gadget ** list )
static

SetTextGadget GadgetList#,Id,Text$: overwrite the text of a gadget.

In place: the new text is padded with spaces and never longer than the old one; nothing for a gadget without text. The gadget is not redrawn. Errors (debugger, gchk): "Can't Find Gadget". By design (#166): without the debugger the search does not stop at the end of the list.

Parameters
idd1: the gadget id
srcd2: Text$
lista1: the gadget list (!libs gadgetslib,$1180)

◆ sgchk2_c()

void sgchk2_c ( const struct bb_shape * alt,
const struct bb_shape * shape )
static

◆ sgchk_c()

void sgchk_c ( const struct bb_shape * shape)
static

◆ shapegadget()

void shapegadget ( WORD x,
WORD y,
ULONG flags,
UWORD id,
const struct bb_shape * shape,
struct Image * alt )
static

◆ stringchk()

void stringchk ( void )

◆ stringchk_c()

void stringchk_c ( UWORD maxlen)
static

◆ wchk_c()

void wchk_c ( struct Window ** win)
static

Variable Documentation

◆ bco1

UBYTE bco1

◆ bco2

UBYTE bco2

◆ bgroup

WORD bgroup

◆ bordersok

WORD bordersok

◆ bpen

UBYTE bpen

◆ bxxs

WORD bxxs

◆ bxxs2

WORD bxxs2

◆ byxs

WORD byxs

◆ byxs2

WORD byxs2

◆ defflags

WORD defflags

◆ fhit

WORD fhit

◆ fontattr

ULONG fontattr

◆ fpen

UBYTE fpen

◆ [struct]

struct { ... } g

◆ mode

UBYTE mode

◆ pad

UBYTE pad

◆ selmode

WORD selmode