/**
 * \file Visual.h
 * \date 13.03.2003
 *
 * Graphical user interface using the Fox library
 */

#ifndef MODULES_VISUAL_H
#define MODULES_VISUAL_H

#ifdef WITH_VISUAL

#include "Player/PlayerKernel.h"
#include "Common/Module.h"
#include "Common/Main.h"
#include "include/fx.h"

class VisualFrame;


/**
 * \class Visual
 * \author Matus Horvath
 * \brief Graphical interface module
 * 
 * Displays players internal world model
 */
class Visual : public Module
{
public:
// Construction and destruction
	Visual();
	virtual ~Visual() {}

// Interface implementation
	virtual int Init(int argc, char** argv, int task = -1);
	virtual void Run(int task = -1);

protected:

private:
	FXApp* application; 
	VisualFrame* frame;

};


/**
 * \class VisualFrame
 * \author Matus Horvath
 * \brief Graphical interface main frame
 * 
 * Main frame for GUI
 */
class VisualFrame : public FXMainWindow
{
	FXDECLARE(VisualFrame);

private:
	FXButton* quit;

	FXCanvas* fieldCtl;
	FXImage* fieldBuf;

	FXbool fieldChanged;

	FXint transWidth, transHeight;

	World* world;

protected:
	VisualFrame() {}

	FXint transX(float x);
	FXint transY(float y);
	
	void drawPlayerData(FXDC* dc);

public:
	VisualFrame(FXApp* application);
	virtual ~VisualFrame();
	virtual void create();

	enum
	{
		ID_QUIT = FXMainWindow::ID_LAST,
		ID_FIELD, ID_LAST
	};

	long onQuit(FXObject*, FXSelector, void*);
	long onPaintField(FXObject*, FXSelector, void*);
	long onUpdateField(FXObject*, FXSelector, void*);

};

#endif // WITH_VISUAL

#endif // MODULES_VISUAL_H
