#include "StylizedGUI.h"
#include "Callbacks.h"

#include <FL/fl.h>


/*
	In the future, I'd like to be able to read in a list of files that would be our 3D scenes.
	Not sure how that'd work, but it's an idea.
*/

StylizedGUI::StylizedGUI(const int x, const int y) : Fl_Double_Window(x,y,1300,770,"Stylizations!")
{
	int pty = 5;

	begin();
	{
		glWindow = new StylizedGLWindow(5,5,1024,768);
		glWindow->sw = this;

		widgets = new Fl_Group(1030,5,190,590);
		widgets->begin();

		stylizeButton = new Fl_Button(1030,pty,60,20,"Stylize");
		//stylizeButton->callback((Fl_Callback*)stylizeCB,this);
		
		//insert callback code here


		/* this button may be useless. */
		gaussButton = new Fl_Button(1100, pty, 100, 20, "Gauss Blur");
		//gaussButton->callback((Fl_Callback*)unstylizeCB,this);

		togglifyStylize(stylizeButton);
		togglifyGauss(gaussButton, 1);
		//insert callback code here

		pty += 30;
		sceneBrowser = new Fl_Browser(1030, pty, 200, 100, "Style Chooser");
		sceneBrowser->type(2);
		//need some callback stuff here too...
		sceneBrowser->callback((Fl_Callback*)damageCB,this);
		sceneBrowser->add("Basic Impressionist");
		sceneBrowser->add("Kinda Toony");
		sceneBrowser->add("Gradient Painting");
		//sceneBrowser->add("Raptors with Lasers");
		//sceneBrowser->add("Raptors with Bear-nunchucks");
		sceneBrowser->select(1);

		widgets->end();
	}
	end();
		
}
/* these could cause some trouble if both were deselected */

void StylizedGUI::togglifyStylize(Fl_Button* b, int val)
{
    b->type(FL_TOGGLE_BUTTON);		// toggle
    b->value(val);		// turned off
    b->selection_color((Fl_Color)3); // yellow when pressed	
	b->callback((Fl_Callback*)stylizeCB,this);
}

void StylizedGUI::togglifyGauss(Fl_Button* b, int val)
{
    b->type(FL_TOGGLE_BUTTON);		// toggle
    b->value(val);		// turned off
    b->selection_color((Fl_Color)3); // yellow when pressed	
	b->callback((Fl_Callback*)unStylizeCB,this);
}

void damageCB(Fl_Widget*, StylizedGUI* sG)
{
	sG->damageMe();
}

void StylizedGUI::damageMe()
{
	glWindow->damage(1);
}