Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
/radiobutton-size 15 px def
2
 
3
/box-radiobutton-create {
4
  box-generic-create
5
  dup box-radiobutton-setup-methods
6
 
7
  dup /checked false put
8
  radiobutton-size 1 index put-default-baseline
9
  radiobutton-size 1 index put-height
10
  radiobutton-size 1 index put-width
11
 
12
  dup /box-radionbutton add-type
13
} def
14
 
15
/box-radiobutton-get-min-width {   % => Context This
16
  dup get-full-width
17
  exch pop
18
  exch pop
19
} def
20
 
21
/box-radiobutton-get-max-width {   % => Context This
22
  dup get-full-width
23
  exch pop
24
  exch pop
25
} def
26
 
27
/box-radiobutton-put-checked {     % => Value Box
28
  exch /checked exch put
29
} def
30
 
31
/box-radiobutton-reflow {          % => Context Parent This
32
% Set default baseline
33
  dup get-default-baseline
34
  1 index put-baseline
35
 
36
% Append to parent line box
37
  dup 2 index box-container-append-line
38
 
39
% Deterine coordinates of upper-left _margin_ corner
40
  2 copy
41
  box-generic-guess-corner         % => Context Parent This
42
 
43
% Offset parent current X coordinate
44
  1 index get-current-x
45
  1 index get-full-width add
46
  2 index put-current-x
47
 
48
% Extend parent height
49
  dup get-bottom-margin
50
  2 index box-generic-extend-height
51
 
52
  pop pop pop
53
} def
54
 
55
/box-radiobutton-setup-methods {
56
  dup /Methods get
57
  dup /get-min-width {box-radiobutton-get-min-width} put
58
  dup /get-max-width {box-radiobutton-get-max-width} put
59
  dup /reflow        {box-radiobutton-reflow} put
60
  dup /show          {box-radiobutton-show} put
61
  pop pop
62
} def
63
 
64
/box-radiobutton-show {            % => Viewport This
65
% Get check center
66
  dup get-left
67
  1 index get-right add 2 div
68
 
69
  1 index get-top
70
  2 index get-bottom add 2 div     % => Viewport This X Y
71
 
72
% Calculate checkbox size
73
  2 index /get-width call-method
74
  3 div                            % => Viewport This X Y Size
75
 
76
  2 index exch
77
  2 index exch                     % => Viewport This X Y X Y Size
78
 
79
 
80
 
81
% Draw checkbox
82
  newpath
83
  0.25 setlinewidth
84
  arc stroke                       % => Viewport This X Y
85
 
86
% Draw checkmark if needed
87
  2 index /checked get {
88
    2 index /get-width call-method
89
    6 div                          % => Viewport This X Y CheckSize
90
 
91
 
92
    newpath
93
    arc fill                       % => Viewport This
94
  } { pop pop } ifelse
95
 
96
  pop pop
97
} def