File: mactextldef.c

package info (click to toggle)
xconq 7.1.0-7
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,056 kB
  • ctags: 7,960
  • sloc: ansic: 88,493; perl: 2,057; sh: 1,766; makefile: 1,110; csh: 81; awk: 47; lisp: 39
file content (60 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Minimal text LDEF, no fancy features, stripped down from a version by Adam Winer (?).
   Copyright (C) 1993, 1994 Stanley T. Shebs.

Xconq is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.  See the file COPYING.  */

/* Spacing parameters. */

#define kLeftOffset	2
#define kTopOffset	0

pascal void
main(short listmsg, Boolean selected, Rect *listrectptr, Cell listcell,
	 short listdataoffset, short listdatalength, ListHandle listhandle)
{
	FontInfo fontInfo;
	ListPtr listptr;
	SignedByte hStateList, hStateCells;
	Ptr celldata;
	short leftdraw, topdraw, wayleft;
	
	/* Lock and dereference the list and cell data handles. */	
	hStateList = HGetState((Handle) listhandle);
	HLock((Handle) listhandle);
	listptr = *listhandle;
	hStateCells = HGetState(listptr->cells);
	HLock(listptr->cells);
	celldata = *(listptr->cells);
	/* Decipher the desired action on the list. */
	switch (listmsg) {
	  case lInitMsg:
	  	/* We don't need any initialization. */
	  	break;
	  case lDrawMsg:
		EraseRect(listrectptr);
	  	if (listdatalength > 0) {
	  		/* Determine starting point for drawing. */
	  		wayleft = listcell.h * listptr->cellSize.h + listptr->rView.left;
	  		leftdraw = wayleft + listptr->indent.h + kLeftOffset;
	  		topdraw = listrectptr->top + listptr->indent.v + kTopOffset;
			GetFontInfo(&fontInfo);
			MoveTo(leftdraw, topdraw + fontInfo.ascent);
			TextFace(0);
			DrawText(celldata, listdataoffset, listdatalength);
	  	}
		if (!selected) break;
		/* Fall through to draw selected cell in hilite color. */
	  case lHiliteMsg:
	  	/* Do hilite color. */
	  	BitClr(&HiliteMode, pHiliteBit);
	  	InvertRect(listrectptr);
	  	break;
	  case lCloseMsg:
	  	break;
	}
	HSetState(listptr->cells, hStateCells);
	HSetState((Handle) listhandle, hStateList);
}