## diamondbutton-drawfn-and-sizefn.pkg
# Compiled by:
#
src/lib/x-kit/widget/xkit-widget.sublib# This package gets used in:
#
#
src/lib/x-kit/widget/old/leaf/diamondbutton-look.pkgstipulate
#
package d3 = three_d; # three_d is from
src/lib/x-kit/widget/old/lib/three-d.pkg package wg = widget; # widget is from
src/lib/x-kit/widget/old/basic/widget.pkg package xc = xclient; # xclient is from
src/lib/x-kit/xclient/xclient.pkg package g2d= geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkgherein
package diamondbutton_drawfn_and_sizefn
: (weak) Button_Drawfn_And_Sizefn # Button_Drawfn_And_Sizefn is from
src/lib/x-kit/widget/old/leaf/button-drawfn-and-sizefn.api {
attributes = [];
#
fun drawfn (d, { wide, high }, bwid)
=
draw
where
offset = 1;
midx = wide / 2;
midy = high / 2;
verts = [ { col=>midx, row=>offset },
{ col=>offset, row=>midy },
{ col=>midx, row=>high - 1 },
{ col=>wide - 1, row=>midy }
];
fun draw (base, top, bottom) # Mode-dependent colors in which to draw.
=
{ xc::fill_polygon d base { verts, shape=>xc::CONVEX_SHAPE };
#
d3::draw3dpoly d (verts, bwid) { top, bottom };
};
end;
fun sizefn (wide, high)
=
wg::make_tight_size_preference
(
wide,
case high
#
THE h => h;
NULL => wide;
esac
);
fun make_button_drawfn_and_sizefn _
=
(drawfn, sizefn);
}; # package diamondbutton_drawfn_and_sizefn
end;
## COPYRIGHT (c) 1994 by AT&T Bell Laboratories See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.