blob: 84bf9ecc66d9de30394b006498203cdc3b30be89 (
plain)
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
|
############################################################################
#
# File: typebind.icn
#
# Subject: Procedures to produce table of graphic contexts for type
#
# Author: Ralph E. Griswold and Clinton L. Jeffery
#
# Date: March 4, 1997
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# typebind(window, codes, opts) returns a table of graphic contexts bound to
# window with foreground colors keyed by type in the string of event codes.
#
# Codes for which there is no corresponding color are ignored.
#
# Note: Event monitoring global identifiers must be linked by the program
# that uses this procedure.
#
############################################################################
#
# Links: colormap
#
############################################################################
#
# Requires: Version 9 graphics
#
############################################################################
link colormap
procedure typebind(window, codes, opts)
local code, context
static contexts, color
initial {
contexts := table()
if /opts then color := colormap("standard")
else color := colormap(opts["p"])
}
if /contexts[window] := table() then {
context := contexts[window]
every code := !codes do
context[code] := Clone(window, , "fg=" || \color[code])
}
contexts[window]["bg"] := Clone(window, "fg=" || WAttrib(window,"bg"))
return contexts[window]
end
|