#include "_Global.h"

class Main extends _Main
{
	var g:_Graphics;

	var prev:Boolean;
	var next:Boolean;

	function start():Boolean
	{
		g = getGraphics();

		prev = false;
		next = false;

		return true;
	}

	function paint():Void
	{
		g.lock();
		g.setColor( g.getColorOfRGB( 127, 127, 127 ) );
		g.fillRect( 0, 0, 240, 240 );
		g.setColor( g.getColorOfRGB( 0, 0, 255 ) );

		if( prev )
		{
			g.fillRect( 20, 20, 200, 90 );
			prev = false;
		}
		else
		{
			g.drawRect( 20, 20, 199, 89 );
		}

		if( next )
		{
			g.fillRect( 20, 130, 200, 90 );
			next = false;
		}
		else
		{
			g.drawRect( 20, 130, 199, 89 );
		}

		g.unlock();
	}

	function processEvent( type:Number, param:Number ):Void
	{
		switch( type )
		{
		case _FOCUS_PREV_EVENT:
			prev = true;
			break;
		case _FOCUS_NEXT_EVENT:
			next = true;
			break;
		}
	}
}
