english
version "1.0"
identify "wxyz"

# Copyright (c) 1998-1999 by Wayne C. Gramlich.
# All rights reserved.
#
# Permission to use, copy, modify, distribute, and sell this software
# for any purpose is hereby granted without fee provided that the above
# copyright notice and this permission are retained.  The author makes
# no representations about the suitability of this software for any purpose.
# It is provided "as is" without express or implied warranty.

module swit_application

#: This module implements the top-level application of SWIT.


#: {application} procedures:

procedure application_call_back@application
    takes
	clone clone
    returns_nothing

    #: This procedure will deal will convert a clone initialization
    #, call back into an application call back.



procedure clone_delete@application
    takes
	application application
	dead_clone clone
    returns_nothing

    #: This procedure will remove {dead_clone} from the clone list in
    #, {application}.


procedure create@application
    routine_types
	procedure initialize_call_back
	    takes application
	    returns_nothing
    takes
	swit swit
	name string
	initialize_call_back initialize_call_back
    returns application

    #: This procedure will create and return an application object
    #, named {name} with {swit} as its parent.  {intialize_call_back}
    #, is eventually invoked to initialize the application.


procedure event_handler_create@application
    takes
	widget widget
    returns event_handler

    #: This procedure will create and return an {event_handler} object
    #, for {widget}.


procedure exit@application
    takes
	application application
	exit_value unsigned
    returns_nothing

    #: This procedure will shut down {application} and cause the
    #, program to exit with an exit value of {exit_value}.

    #exit@(application.swit, exit_value)



procedure item_insert@application
    takes
	application application
	uid unsigned
	item item
    returns_nothing

    #: This procedure will insert a binding between {uid} and {item}
    #, in {application}.


procedure generated_field_name1_get@application
    takes
	application application
    returns string

    #: This procedure returns the generated field name 1 string for
    #, {appliation}.


procedure generated_expression1_set@application
    takes
	application application
	expression1 string
    returns_nothing

    #: This procedure will set the generated field name 1 string for
    #, {application} to {expression1}.


procedure generated_expression1_get@application
    takes
	application application
    returns string

    #: This procedure returns the generated field name 1 string for
    #, {appliation}.


procedure generated_field_name1_set@application
    takes
	application application
	field_name1 string
    returns_nothing

    #: This procedure will set the generated field name 1 string for
    #, {application} to {field_name1}.


procedure generated_imports_get@application
    takes
	application application
    returns string

    #: This procedure returns the generated imports string for {appliation}.


procedure generated_imports_set@application
    takes
	application application
	imports string
    returns_nothing

    #: This procedure will set the generated imports string for {application}
    #, to {imports}.


procedure generated_type1_get@application
    takes
	application application
    returns string

    #: This procedure returns the generated type name 1 string for
    #, {appliation}.


procedure generated_type1_set@application
    takes
	application application
	type1 string
    returns_nothing

    #: This procedure will set the generated type name 1 string for
    #, {application} to {type1}.


procedure local_clone@application
    routine_types
	procedure initialize_call_back
	    takes clone
	    returns_nothing
    takes
	application application
	initialize_call_back initialize_call_back
    returns clone

    #: This procedure will create and return a {clone} of {application}
    #, connected to the SWIT server on the local machine.
    #, {initialize_call_back} is invoked upon successful establishment
    #, of the initial connection.


procedure master_clone@application
    takes
	application application
    returns clone

    #: This procedure will create and return a master {clone} object.


procedure remote_clone@application
    routine_types
	procedure initialize_call_back
	    takes clone
	    returns_nothing
    takes
	application application
	host_name string
	port_number unsigned
	remote_display string
	initialize_call_back initialize_call_back
    returns clone

    #: This procedure will create and return a {clone} of {application}
    #, connected to the SWIT server on port number {port_number} on
    #, the host named {host_name} and using the remote X11 display
    #, {remote_display}.  {initialize_call_back} is invoked upon
    #, successful establishment of the initial connection.


procedure restore@application
    takes
	application application
	in_stream in_stream
	error_stream out_stream
    returns logical

    #: This procedure will read an application from {in_stream}
    #, and store it into {application}.  Any errors are reported
    #, to {error_stream}.  {true}@{logical} is returned if any
    #, errors have occured; otherwize, {false} is returned.


procedure save@application
    takes
	application application
	save_stream out_stream
	supress_prefix string
    returns_nothing

    #: This procedure will save {application} to {save_stream}.  Any widgets
    #, in the application frame that have a prefix of {supress_prefix}
    #, will *not* be written out to {save_stream}.


procedure top_level_create@application
    takes
	application application
    returns frame

    #: This procedure will create and return a top level frame for
    #, {application}.


procedure uid_next@application
    takes
	application application
    returns unsigned

    #: This procedure will return the next uid from {application}.


procedure update@application
    takes
	application application
    returns_nothing

    #: This procedure causes all of the clones of {application} to be
    #, updated.