PreviousUpNext

15.4.1387  src/lib/x-kit/widget/leaf/button-type.pkg

## button-type.pkg

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



# Base types for buttons.



###             "Imagine if every Thursday your shoes exploded
###              if you tied them the usual way. This happens
###              to us all the time with computers, and nobody
###              thinks of complaining."
###
###                                       -- Jef Raskin


stipulate
    include threadkit;                          # threadkit     is from   src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg
    #
    package bb =  button_base;                  # button_base   is from   src/lib/x-kit/widget/leaf/button-base.pkg
    package wg =  widget;                       # widget        is from   src/lib/x-kit/widget/basic/widget.pkg
    #
    package xc =  xclient;                      # xclient       is from   src/lib/x-kit/xclient/xclient.pkg
herein

    package button_type {

        Button_Transition
          = BUTTON_DOWN  xc::Mousebutton 
          | BUTTON_UP    xc::Mousebutton
          | BUTTON_IS_UNDER_MOUSE
          | BUTTON_IS_NOT_UNDER_MOUSE
          ;

        Button =    BUTTON
                      { widget:              wg::Widget,
                        #
                        plea_slot:           Mailslot( bb::Plea_Mail ),
                        button_transition':  Mailop( Button_Transition )
                      };

        fun as_widget              (BUTTON { widget,             ... } ) =   widget;
        fun button_transition'_of  (BUTTON { button_transition', ... } ) =   button_transition';

        fun set_button_active_flag (BUTTON { plea_slot, ... }, arg)
            = 
            put_in_mailslot  (plea_slot,  bb::SET_BUTTON_ACTIVE_FLAG arg);

        fun get_button_active_flag (BUTTON { plea_slot, ... } )
            =
            {   reply_1shot =  make_oneshot_maildrop ();
                #
                put_in_mailslot  (plea_slot,  bb::GET_BUTTON_ACTIVE_FLAG reply_1shot);

                take_from_oneshot  reply_1shot;
            };
    };                  #  button_type 

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