PreviousUpNext

15.4.1530  src/lib/x-kit/widget/old/leaf/toggle-type.pkg

## toggle-type.pkg
#
# Base types for toggles

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



stipulate
    include package   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/old/leaf/button-base.pkg
    package wg =  widget;                               # widget        is from   src/lib/x-kit/widget/old/basic/widget.pkg
herein

    package toggle_type {

        Toggleswitch_Act
          = TOGGLE_SET  Bool
          | TOGGLE_READY
          | TOGGLE_NORMAL
          ;

        Toggleswitch
            =
            TOGGLE
              { widget:     wg::Widget,
                #
                mailop:     Mailop( Toggleswitch_Act ),
                plea_slot:  Mailslot( bb::Plea_Mail )
              };

        fun as_widget (TOGGLE { widget, ... } ) =  widget;

        fun mailop_of (TOGGLE { mailop,  ... } ) =  mailop;


        fun set_button_on_off_flag (TOGGLE { plea_slot, ... }, arg)
            = 
            put_in_mailslot  (plea_slot,  bb::SET_STATE arg);


        fun get_button_on_off_flag (TOGGLE { plea_slot, ... } )
            =
            {   reply_1shot =  make_oneshot_maildrop ();
                #
                put_in_mailslot (plea_slot, bb::GET_STATE reply_1shot);

                get_from_oneshot  reply_1shot;
            };


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


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

                get_from_oneshot  reply_1shot;
            };

    };                                  # package toggle_type 

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