PreviousUpNext

15.4.1550  src/lib/x-kit/widget/old/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/old/basic/widget.pkg
    package wa =  widget_attribute_old;                 # widget_attribute_old  is from   src/lib/x-kit/widget/old/lib/widget-attribute-old.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/old/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            =>  \\ () = { background => THE color }, 
                #
                realize_widget  =>  wg::realize_widget  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-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext