Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/fpdf/postscript/
Upload File :
Current File : /var/www/cesa.co.za/fpdf/postscript/box.radiobutton.ps

/radiobutton-size 15 px def

/box-radiobutton-create {
  box-generic-create
  dup box-radiobutton-setup-methods

  dup /checked false put
  radiobutton-size 1 index put-default-baseline
  radiobutton-size 1 index put-height
  radiobutton-size 1 index put-width
  
  dup /box-radionbutton add-type
} def

/box-radiobutton-get-min-width {   % => Context This
  dup get-full-width
  exch pop
  exch pop
} def

/box-radiobutton-get-max-width {   % => Context This
  dup get-full-width
  exch pop
  exch pop
} def

/box-radiobutton-put-checked {     % => Value Box
  exch /checked exch put
} def

/box-radiobutton-reflow {          % => Context Parent This
% Set default baseline
  dup get-default-baseline
  1 index put-baseline

% Append to parent line box
  dup 2 index box-container-append-line

% Deterine coordinates of upper-left _margin_ corner
  2 copy
  box-generic-guess-corner         % => Context Parent This

% Offset parent current X coordinate
  1 index get-current-x
  1 index get-full-width add
  2 index put-current-x

% Extend parent height
  dup get-bottom-margin
  2 index box-generic-extend-height

  pop pop pop
} def

/box-radiobutton-setup-methods {
  dup /Methods get
  dup /get-min-width {box-radiobutton-get-min-width} put
  dup /get-max-width {box-radiobutton-get-max-width} put
  dup /reflow        {box-radiobutton-reflow} put
  dup /show          {box-radiobutton-show} put
  pop pop
} def

/box-radiobutton-show {            % => Viewport This
% Get check center
  dup get-left
  1 index get-right add 2 div

  1 index get-top
  2 index get-bottom add 2 div     % => Viewport This X Y

% Calculate checkbox size
  2 index /get-width call-method
  3 div                            % => Viewport This X Y Size

  2 index exch
  2 index exch                     % => Viewport This X Y X Y Size

  0 360

% Draw checkbox
  newpath
  0.25 setlinewidth
  arc stroke                       % => Viewport This X Y

% Draw checkmark if needed
  2 index /checked get {
    2 index /get-width call-method
    6 div                          % => Viewport This X Y CheckSize

    0 360
    newpath
    arc fill                       % => Viewport This
  } { pop pop } ifelse

  pop pop
} def