## object_class.pkg
## (C) 1999, Albert-Ludwigs-Uni Freiburg
## Author: bu
# Compiled by:
#
src/lib/tk/src/toolkit/sources.sublib# ***************************************************************************
# Unified Object Interface
# **************************************************************************
# The api Part_Class (vulgo: the object-class OBJECT-CLASS)
# in the sense of the toolkit has:
# - a type of objects object
# - an ordering on object
# - a unique abstract name for each object
# - a (formatable) string representation thereof
# - a "user-name", i.e. an explicitly
# via side-effect set or reset string hiding the
# string representation of the name.
# - an object-type part_type for each object
# - an icon for each obj-type
#
# OBJECT-CLASS is fundamental for several larger
# tk-toolkit components like tree_list_g or GenGui.
# Moreover, there is a class macro object_to_tree_object_g,
# that extends OBJECT-CLASS to TREE-OBJECT-CLASS,
# where TREE-OBJECT-CLASS is a strict extension
# of OBJECT-CLASS (such that V o object_to_tree_object_g is in
# a sense an endogeneric on OBJECT-CLASS . . .
# This facilitates to have a uniform interface
# and common lifting facilities for toolkit-
# components with respect to objects.
#
# SPECIFICATION:
# - ord is a linear ordering on names of objects
# - name_of (o) must be unique in all system states
# /* this fact is only used in tree_object_classes,
# more precisely: select_from_path, remove_at_path, update_at_path */
# - name_of (rename (s, o)) = name_of (o) # rename is actually a relabelling
# - name_of (reset_name (s, o)) = name_of (o)
# - part_type (rename (s, o)) = part_type (o)
# - part_type (reset_name (s, o)) = part_type (o)
# - icon (rename (s, o)) = part_type (o)
# - icon (reset_name (s, o)) = part_type (o)
#
# - string_of_name n f should be "as nice as possible".
#
# - (rename s o;
# string_of_name (name_of o) f) = "nice s"
# - (rename s o;
# reset_name o;
# string_of_name o f) =
# (reset_name_node o;
# string_of_name_node o f)
api Part_Class {
Part_Ilk;
eqtype Part_Type;
Name; # think of it as: id
ord: (Part_Ilk, Part_Ilk) -> Order; # based on name
name_of: Part_Ilk -> Name; # think of it as: id_of
string_of_name: Name -> print::Format ->
String; # Annotated text ?
rename: String -> # Annotated text ?
Part_Ilk -> Void;# side effect
reset_name: Part_Ilk -> Void; # side effect
part_type: Part_Ilk -> Part_Type;
icon: Part_Type -> icons::Icon;
# for lousy reasons (SML97-compliance), it is necessary to add the
# following lines, that introduce a "clipboardable" version
# of objects. This is not necessary in njml, but poly and moscow.
Cb_Objects;
cb_objects_abs: (Void -> List( Part_Ilk ) ) -> Cb_Objects;
cb_objects_rep: Cb_Objects -> (Void -> List( Part_Ilk ) );
};