/****************************************************************************
	Knihovna obsahujici metody tridy TScreenObject

*****************************************************************************/

#include "GR_object.h"
#include "GLCD.h"


/****************************************************************************
	Metoda pro inicializaci obrazoveho objektu 

	Vstup: 
		X, Y:				Souradnice objektu
		Type				Typ objektu (tlacitko, pozadi...)
		Id:					Id objektu v obrazu - melo by korespondovat s pozici
							objektu v poli objektu
		Caption:			Text prirazeny objektu
		State:				Stav objektu - Povolen/Zakazan
		Params:				Ukazatel na parametry objektu
		Object_callback:	Funkce vykonavajici akce objektu
		Draw:				Funkce pro vykresleni objektu

	Výstup:
		není

*****************************************************************************/
void TScreenObject::Init(	short X, 
							short Y, 
							SCREEN_OBJECT_TYPE Type, 
							char Id, 
							unsigned char * Caption, 
							SCREEN_OBJECT_STATE State, 
							void *Params, 
							void (*Object_callback)(TScreenObject *obj,OBJECT_MESSAGE message), 
							void (*Draw)(TScreenObject *obj, OBJECT_MESSAGE message))
{
	this->x = X;
	this->y = Y;
	this->type = Type;
	this->id = Id;
	this->caption = Caption;
	this->state = State;
	this->params = (TScreenObjectParams*) Params;
	this->object_callback = Object_callback;
	this->draw = Draw;
	this->bitmap = 0;
}


/****************************************************************************
	Metoda pro inicializaci obrazoveho objektu 

	Vstup: 
		X, Y:				Souradnice objektu
		Type				Typ objektu (tlacitko, pozadi...)
		Id:					Id objektu v obrazu - melo by korespondovat s pozici
							objektu v poli objektu
		Caption:			Text prirazeny objektu
		Bitmap:				Obrazek prirazeny objektu
		State:				Stav objektu - Povolen/Zakazan
		Params:				Ukazatel na parametry objektu
		Object_callback:	Funkce vykonavajici akce objektu
		Draw:				Funkce pro vykresleni objektu

	Výstup:
		není

*****************************************************************************/
void TScreenObject::Init(short X, short Y, SCREEN_OBJECT_TYPE Type, char Id, unsigned char * Caption, const unsigned short * Bitmap,SCREEN_OBJECT_STATE State, void *Params, void (*Object_callback)(TScreenObject *obj,OBJECT_MESSAGE message), void (*Draw)(TScreenObject *obj, OBJECT_MESSAGE message))
{
	this->x = X;
	this->y = Y;
	this->type = Type;
	this->id = Id;
	this->caption = Caption;
	this->bitmap = Bitmap;
	this->state = State;
	this->params = (TScreenObjectParams*) Params;
	this->object_callback = Object_callback;
	this->draw = Draw;
}

/****************************************************************************
	Vychozi konstruktor objektu.

	Vstup: 
		není

	Výstup:
		není

*****************************************************************************/
TScreenObject::TScreenObject(void)
{
	this->id = 0;
	this->state = OBJECT_DISABLED;
}



