PreviousUpNext

15.4.1431  src/lib/x-kit/widget/wrapper/background.pkg

## background.pkg
#

# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib


stipulate
    package wg =  widget;                               # widget                is from   src/lib/x-kit/widget/basic/widget.pkg
    package wa =  widget_attribute;                     # widget_attribute      is from   src/lib/x-kit/widget/lib/widget-attribute.pkg
    package xc =  xclient;                              # xclient               is from   src/lib/x-kit/xclient/xclient.pkg
herein

    package   background
    : (weak)  Background                                # Background            is from   src/lib/x-kit/widget/wrapper/background.api
    {
        Background = wg::Widget;

        attributes
            =
            [ (wa::background,     wa::COLOR,    wa::STRING_VAL "white") ];

        fun make_back (root_window, color, widget)
            =
            wg::make_widget
              {
                root_window,

                args      =>  fn () = { background => THE color }, 
                realize   =>  wg::realize_fn widget,

                size_preference_thunk_of
                    =>
                    wg::size_preference_thunk_of  widget
              };

        fun background (root_window, view, args) widget
            =
            {   attributes = wg::find_attribute (wg::attributes (view, attributes, args));

                color = wa::get_color (attributes wa::background);

                make_back (root_window, color, widget);
            };

        fun make_background { color, widget }
            =
            {   root_window = wg::root_window_of widget;

                color = case color
                            #
                            THE color =>  color;
                            NULL      =>  xc::white;
                        esac;

                make_back (root_window, color, widget);
            };

        fun as_widget w
            =
            w;

    };          # package background 

end;


## COPYRIGHT (c) 1994 by AT&T Bell Laboratories  See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext