
			STklos version 2.0
			------------------


What is STklos?
---------------

STklos is an extension of STk which provides a` la CLOS objets to STk. 
This implementation takes its inspiration from the version 1.3 of the
Tiny-clos package defined by Gregor Kickzales 
(available at arisia.xerox.com:/pub/mop/*).

However this version is completly new since it has been rewritten in C.
As a consequence, it is more than 120 times faster than previous version
and it requires really less memory.

Compiling STklos
----------------

STklos can be loaded dynamically on Sun and it can be linked with the core
STk interpreter on other architectures. Normally, STklos support is linked
with the STk interpreter (unless you have specified -with-no-stklos flag)
and you have nothing to do. If you want to build a dynamic version of STklos
read the README file in the C-code directory.

Simple test of STklos
---------------------

STklos needs some file to run properly. Until you have installed it in its
definitive place, you have to:
	1. set your default directory to STklos
	2. use the the shell script test-stklos to run the interpreter (the
	   script choose the stklos interpreter if it exists, and stk 
	   otherwise).

So, you just have to type 

	$ cd STklos; test-stklos

To test, that everything is OK, you can try:
	(let ()
	  (define-class A () ((a :initform 10) b))
	  (define inst (make A))
	  (slot-set! inst 'b 20)
	  (+ (slot-ref inst 'a) (slot-ref inst 'b)))

which should yield 30 if everything is correct.

Using STklos with TK
--------------------

A set of classes have been defined to use Tk with object flavor. All the Tk
commands (except the text widget)  have been re-written using STklos. 

Following example creates a three buttons panel (button 1 & 2 being on top of
button 3).

   (require "Frame")
   (require "Button")
   (define f  (make <Frame>))
   (define b1 (make <Button> :text "Button 1" :parent f))
   (define b2 (make <Button> :text "Button 2" :parent f))
   (define b3 (make <Button> :text "Button 3"))
   (pack b1 b2 :side "left")
   (pack f b3 :fill "both" :expand #t)

Note usage of Scheme names in the two preceding pack calls instead of dotted
Tcl/Tk names.

Tk options can be seen as slot in the STklos world. So getting the font of 
button 3 can be done with 

   (font b3)

and changing its value can be done with 

   (set! (font b3) "fixed")

and associating a callback to button 1 can be done with the following expression

   (set! (command b1) '(format #t "You have typed on \"Button1\"\n"))

The desribe function permits to see all the slots value of a given object. For
instance, 

   (describe b2)

would give something like:

    #[<button> 246698] is an instance of class <button>
    Slots are: 
	 bitmap = ""
	 width = 0
	 height = 0
	 anchor = "center"
	 font = "-Adobe-Helvetica-Bold-R-Normal--*-120-*"
	 foreground = "Black"
	 pad-x = 1
	 pad-y = 1
	 text = "Button 2"
	 text-variable = ""
	 id = #[Tk-command .v1.v3]
	 eid = #[Tk-command .v1.v3]
	 parent = #[<frame> 243538]
	 active-background = "#999999"
	 active-foreground = "Black"
	 command = ""
	 disabled-foreground = "#b0b0b0"
	 state = "normal"
	 background = "#cccccc"
	 border-width = 2
	 cursor = ""
	 relief = "raised"

Destruction of a button can be obtained with the destroy-widget generic function
as in

    (destroy b2)

Installing the STklos package
-----------------------------

To install the STklos package, you'll have to do

	make install

in this directory.


To do
-----
	* A true documentation !!!
	* write the <Text> class
	* Better documentation of dynamic loading
	* create a makefile entry which permits to dump all Tk classes in a
	  file for later fast loading

	

