MCPcopy Create free account
hub / github.com/NetHack/NetHack / SetBorder

Function SetBorder

sys/amiga/winami.c:1199–1337  ·  view source on GitHub ↗

Put a 3-D motif border around the gadget. String gadgets or those * which do not have highlighting are rendered down. Boolean gadgets * are rendered in the up position by default. */

Source from the content-addressed store, hash-verified

1197 * are rendered in the up position by default.
1198 */
1199void
1200SetBorder(struct Gadget *gd)
1201{
1202 struct Border *bp;
1203 short *sp;
1204 int i, inc = -1, dec = -1;
1205 int borders = 6;
1206 int hipen = sysflags.amii_dripens[SHINEPEN],
1207 shadowpen = sysflags.amii_dripens[SHADOWPEN];
1208#ifdef INTUI_NEW_LOOK
1209 struct DrawInfo *dip;
1210#endif
1211
1212#ifdef INTUI_NEW_LOOK
1213 if (IntuitionBase->LibNode.lib_Version >= 37) {
1214 if ((dip = GetScreenDrawInfo(HackScreen)) != 0) {
1215 hipen = dip->dri_Pens[SHINEPEN];
1216 shadowpen = dip->dri_Pens[SHADOWPEN];
1217 FreeScreenDrawInfo(HackScreen, dip);
1218 }
1219 }
1220#endif
1221 /* Allocate two border structures one for up image and one for down
1222 * image, plus vector arrays for the border lines.
1223 */
1224 if (gd->GadgetType == STRGADGET)
1225 borders = 12;
1226 if ((bp = (struct Border *) alloc(((sizeof (struct Border) * 2)
1227 + (sizeof (short) * borders)) * 2))
1228 == NULL) {
1229 return;
1230 }
1231
1232 /* For a string gadget, we expand the border beyond the area where
1233 * the text will be entered.
1234 */
1235
1236 /* Remove any special rendering flags to avoid confusing intuition */
1237 gd->Flags &= ~(GADGHIGHBITS | GADGIMAGE);
1238
1239 sp = (short *) (bp + 4);
1240 if (gd->GadgetType == STRGADGET
1241 || (gd->GadgetType == BOOLGADGET
1242 && (gd->Flags & GADGHIGHBITS) == GADGHNONE)) {
1243 sp[0] = -1;
1244 sp[1] = gd->Height - 1;
1245 sp[2] = -1;
1246 sp[3] = -1;
1247 sp[4] = gd->Width - 1;
1248 sp[5] = -1;
1249
1250 sp[6] = gd->Width + 1;
1251 sp[7] = -2;
1252 sp[8] = gd->Width + 1;
1253 sp[9] = gd->Height + 1;
1254 sp[10] = -2;
1255 sp[11] = gd->Height + 1;
1256

Callers 5

EditColorFunction · 0.85
EditClippingFunction · 0.85
getlindFunction · 0.85
amii_player_selectionFunction · 0.85
RandomWindowFunction · 0.85

Calls 1

allocFunction · 0.70

Tested by

no test coverage detected