## appl.api
## (C) 1996, 1998, Bremen Institute for Safe Systems, Universitaet Bremen
## Author: cxl
# Compiled by:
#
src/lib/tk/src/toolkit/sources.sublib# ***************************************************************************
# Api for "applications" of generic graphical user interface.
# Application is the api for an application with which to
# instantiate gen_gui. It comes in seberal variants and degrees of
# completion.
#
# See <a href=file:../../doc/manual::html>the documentation</a> for more
# details. tests+examples/simpleinst.pkg contains a small example
# of how to use this package.
# **************************************************************************
# Api for a simple application with which the generic GUI can
# be instantiated.
api Notepad0_Application {
include api Part_Class; # Part_Class is from
src/lib/tk/src/toolkit/object_class.api # New objects are objects together with an annotation where
# they should appear. This is a coordinate followed by an Anchor
# which gives the direction in which generate_gui_g tries to place the
# object if another object is in the way.
# New_Part will correspond directly to Contents in TreeObjects.
New_Part = (Part_Ilk, ((tk::Coordinate, tk::Anchor_Kind)));
# Now comes the generate_gui_g-specific Part_Class extensions:
# Typing, modes, is_constructed, outline.
# Typing
objlist_type: List( Part_Ilk ) -> null_or::Null_Or( Part_Type );
is_constructed: Part_Type -> Bool;
# objects of this type are construction objects
# "Modes" are states for objects. They are changed with the object's pop-up
# menu, which displays the mode by the mode_name given below.
# Every object's mode can be set within the range given by its type
# (function modes below) by set_mode.
# Every object's mode can be set within the range given by its type (function
# modes below) by set_mode.
eqtype Mode;
mode: Part_Type -> Mode; /* New ! mode is attached to Part_Type
for structuring reasons . . . */
modes: Part_Type -> List( Mode );
mode_name: Mode -> String;
set_mode: (Part_Ilk, Mode) -> Void;
# These objects are displayed with an "outline" icon, to indicate
# some out-of-date condition. Note that they can still receive
# drag-and-drop operations.
outline: Part_Ilk -> Bool;
#
# Nullary objects are constants, or in other words, objects
# existiting a priori.
# The init function returns a list of all these objects; it will
# only be called once, on startup.
init: Void -> List( New_Part );
# Unary operations
# standard actions, called ops for historic reasons
std_ops: Part_Type -> List (((Part_Ilk -> Void), String));
# Better api ?
create_actions: List ((( { pos: tk::Coordinate, tag: String } -> Void)
, String));
label_action: { obj: Part_Ilk,
cc: String -> Void } -> Void;
delete: Part_Ilk -> Void;
# further object type specific operations: for a type t, monOps t
# is a list of pairs (f, s), where f is a unary operation, and s
# is a string, the name under which it appears in the pop-up
# menu. f has the functionality
# Part_Ilk* tk::Coordinate -> (newObject -> Void) -> Void;
# where the first argument is the object itself, together with its present
# location, and the second argument is a fate you can use
# to create new objects.
mon_ops: Part_Type ->
List ((((Part_Ilk, tk::Coordinate) ->
(New_Part -> Void) -> Void), String));
# binary operations
#
# aka::the drag&drop-action-table
bin_ops: (Part_Type, Part_Type) -> null_or::Null_Or ((Part_Ilk, tk::Coordinate,
List( Part_Ilk ),
(New_Part -> Void)) -> Void);
# --- Subpackages --------------------------------------------------
# The clipboard will allow the exchange of items between
# the drag&drop area and other application-specific
# widgets-- eg. a chooser.
# It gets passed closures of objects, so we create
# an object only if it is really taken out of the clipboard
package clipboard: Clipboard; # Clipboard is from
src/lib/tk/src/toolkit/clipboard-g.pkg sharing clipboard::Part == Cb_Objects;
# --- Configuration -- see above ---
package conf: Gen_Gui_Conf; # Gen_Gui_Conf is from
src/lib/tk/src/toolkit/generated-gui.api};
api Notepad_Application {
include api Notepad0_Application; # Notepad0_Application is from
src/lib/tk/src/toolkit/appl.api object_action: { window: tk::Window_Id,
obj: Part_Ilk,
replace_object_action: Part_Ilk -> Void,
outline_object_action: Void -> Void }
-> Void;
is_locked_object: Part_Ilk -> Bool; # locking manipulations -
# e::g. opened construction objects
};
api Application {
include api Notepad0_Application; # Notepad0_Application is from
src/lib/tk/src/toolkit/appl.api # --- The Construction Area -----------------------------------------
Ca
# This data type represents the Construction Area's
# state. It might eg. probably contain the area's
# widget's widget id.
# This should be the respective row of the drag&drop table in
# binaryOps above. Has to be here explicitly, since it will change
# the whole area rather than just the object. Further, objects may
# behave differently while being open.
; area_ops: Part_Type -> Ca -> List( Part_Ilk ) -> Void;
# open an object to be worked on the construction area
# The old object is deleted from the manipulation area.
#
# One (or even more?) new objects may appear on the notepad
# when the construction finishes, they are introduced with
# the second argument.
#
# The result is a tuple, consisting of a data package
# ws as above, a list of widgets representing the
# area on the screen and an init function to be called after
# the widget has been placed and that would not be necessary
# if we could instantiate text widgets properly.
area_open: (tk::Window_Id, Part_Ilk, (Part_Ilk -> Void)) ->
((Ca, List( tk::Widget ), (Void -> Void)));
area_init: Void -> Void;
# initializations that need to be done only once.
# !!! Caution, this is called when the area isn't open.
};