		/=========================================\
		| Otools by olew@ifi.uio.no (olew@nta.no) |
		\=========================================/


                  How to create an application with Otools:
 		 -------------------------------------------
1. your main() must have argc/argv input

	int main(int argc,char *argv[])

2. You need to include these files:

	otools.h	includes, defines and class definitions
	protos.h	prototyped functions and external variables
	colors.h	(can be left out) color defines (C_GRAY etc)
	macros.h	(can be left out) if you want to do direct
			drawing in the application window w/macros.

3. to create the main window of the application you must call
   o_Init() with the correct parameters.

	o_Init(wintitle,icontitle,fontname,xpos,ypos,xsize,ysize,
	       xmin,ymin,xmax,ymax,colors,argc,argv);

   This routine should only be called once in your application, before
   all other calls to otools routines. here's an explanation of the
   parameters:

	wintitle	Window caption title (string)
	icontitle	Window class name / icon-name (string)
	fontname	Main font to use in application (string)
	xpos,ypos	Where to place upper left corner of window
	xsize,ysize	The actual size of the window
	xmin,ymin	The smallest allowed size of the window
	xmax,ymax	The largest allowed size of the window
	colors		A list of colorstrings that the mainwindow
			should use; { bordercolor, shadow, background,
			highlight, foreground, dark, light }
			You can use the defines in "colors.h" to make
			it easy on yourself, for example C_GRAY.
	argc,argv	o_Init needs these to initialize X

   o_Init() will then open a empty window with background color, ready
   to be drawed in (expirienced people can use defines in "macros.h"
   to draw in the window allready now - though it's not a good idea
   yet).

4. All X programs depend on an EVENT loop, that is, the program should
   receive EVENTS from the system (events is keyboard action, mouse
   etc.) and handle them in different ways. In order to use otools
   correctly you should use otools own eventloop, which is

	o_EnterLoop();

   This function is the main loop of otools, and should in most cases
   not terminate before the actual termination of the program you are
   writing. This means you leave all control to otools, and depend on
   other methods to communicate your routines and functions to the end
   user, more on this later.
   This function will return when (int) o_running is set to zero, how
   to do this I will explain later.
   Just after your o_EnterLoop(); line you should place

	o_Quit();.

   This is the usual way to terminate the window and otools.
   It will clean up after otools (o_Quit doesn't clean everything up
   right yet, but will in a while) and ready you application so you
   can terminate it. o_EnterLoop(); and o_Quit(); should be the two
   last commands of your main(); routine.
   At this point you should take a peek at Source/p01.cc

5. Drawing things in your application.
   Otools depend upon special graphical objects, called Figlets. These
   figlets have different characteristics, like Button's, Switch'es,
   and Slider's. The first object 'Figlet', is just a frame with a
   rectangular size and text. The others are subclasses of this
   Figlet, so that otools can handle them just the same way as it
   handles Figlet's. I will explain more about these objects later on.
   Now we want to add these graphical objects to our window in such a
   way that they are drawn and can be used. To do this we need to add
   them to object-chains that otools is maintaining. One of the chains
   is 'o_draw', objects in this chain will be drawed in the window
   whenever it is neccessary, we initialize o_draw with this command;

	o_draw = new Chain();

   The other chain is 'o_test', it will check if you have done
   something _to_ your Figlet, e.g. a Button can be clicked, a Switch
   can be flipped etc. Usually you can set o_test to point to o_draw's
   chain, with this command;

	o_test = o_draw;

   These two commands should be found after o_Init(); and before
   o_EnterLoop(); when you have written these you can start adding
   objects to the o_draw chain. Here's how you can add a title to your
   application with a nice border:

	o_draw->Add(new Figlet(geometry,frame,color,value,"text") );

   You 'Add' a 'new Figlet' to 'o_draw' with parameters;

	geometry	rectangular size of figlet, the border (frame)
			will be	drawed outside this rectangle.
	frame		What kind of frame should the figlet have
			NONE,SINGLE,DOUBLE,IN,OUT,HEXAGON,SHADOW
	color		Pointer to an allocated color class, to use the
			mainwindows own colors, use &o_color
	value		Internal figlet value, can be used in various forms,
			is usually not required
	"text"		The name of the Figlet, e.g. for a title

   Full example;

	o_draw->Add( new Figlet(10,10,xMax-10,60,DOUBLE,&o_color,0,
				"My Program") );


   All objects created as a subclass of Figlet has these parameters first
   in their creation function. That is Button, Switch, Slider etc.
   But the other objects will have extra parameters.
   For instance Button has these arguments appended to its creationfunction;

	o_draw->Add( new Button({Figlet arguments},type,state,callback) );

	type		What kind of button is this, does it flip back when
			you release it (CLICK), or does it stay in the
			pressed position (HOLD).
	state		What state is the button in initially IN or OUT ?

	callback	What function to call when the button is pressed.
			More on this below.

   If you want to do something special (e.g. quit application) when you
   press a button, you should make a function that you can supply to your
   Button when you create it. For example, you can have a button that
   allows you to quit the application, you should then write a function like
   this;

	void MyQuitFunction(Button *b,int x,int y)
	{
	  o_running = 0;
	}

   This function takes parameters that will be supplied by your Button figlet
   when it is pressed, the first (Button *) is a pointer to the Button that
   have called this function (you can have more buttons call the same
   function, that is also why we supply the 'value' in Figlet) so that you
   can access the values of this Button figlet. The x/y is the position of the
   mousepointer when the button was pressed/clicked, can be useful.
   What this function does is set o_running to zero, this is one way of
   terminating your application, since o_EnterLoop(); now will exit, and
   o_Quit(); will be called next. You could also do o_EnterLoop(); once more
   after the first o_EnterLoop(); for instance, if you wanted your window to
   be inactive for a while (maybe you are doing some HEAVY processing?).
   Here's how you can add such a Quit button to your o_draw string;

	o_draw->Add( new Button(10,70,xMax-10,110,SINGLE,&o_color,0,"Quit",
				CLICK,OUT,MyQuitFunction) );

   As you see, we tell the Button that it's callback function is
   MyQuitFunction. We can now run this program and relax, when the Button is
   clicked it will itself call MyQuitFunction(); and then o_EnterLoop(); will
   exit, the whole application terminate. Simple.

   You should now take a look at Source/p02.cc
