## size-preference-wrapper.pkg
#
# Wrapper widget to override or modulate the
# size preferences of its child widget.
# Compiled by:
#
src/lib/x-kit/widget/xkit-widget.sublibstipulate
package g2d= geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkg package wg = widget; # widget is from
src/lib/x-kit/widget/old/basic/widget.pkgherein
# This api is implemented in:
#
#
src/lib/x-kit/widget/old/wrapper/size-preference-wrapper.pkg #
api Size_Preference_Wrapper {
# child:
# Widget whose size preferences are to be modified.
#
# size_preference_fn:
# Gets called with child's size preference function,
# returns overriding value to be used instead.
#
# resize_fn:
# Gets called with child's size preference function,
# child's resize request is only passed on to parent
# if resize_fn returns TRUE.
#
make_size_preference_wrapper
:
{ child: wg::Widget,
size_preference_fn: (Void -> wg::Widget_Size_Preference) -> wg::Widget_Size_Preference,
resize_fn: (Void -> wg::Widget_Size_Preference) -> Bool
}
->
wg::Widget;
# The following four functions are all
# special cases of the above function.
make_tight_size_preference_wrapper: wg::Widget -> wg::Widget;
#
# Create a widget fixed at the ideal size
# of its child, which will never request a resize.
make_loose_size_preference_wrapper: wg::Widget -> wg::Widget;
#
# Create a widget with the ideal size of its child
# which may be contracted and expanded without limit.
# This widget passes on all resize requests from its child.
make_tight_sized_preference_wrapper: (wg::Widget, g2d::Size) -> wg::Widget;
#
# Create a widget fixed at given size,
# which will never request a resize.
make_loose_sized_preference_wrapper: (wg::Widget, g2d::Size) -> wg::Widget;
#
# Create a widget with given ideal size
# which may be contracted and expanded
# without limit. This widget passes on
# all resize requests from its child.
};
end;