///////////////////////////////////////////////////
//
//	Contour-tree based isosurfaces
//	version 3.0
//	copyright Hamish Carr
//	February, 2001
//
//	------------------------
//	IsosurfaceWindow.h
//	------------------------
//	
//	A simple window with an isosurface & controls
//	
//	Notes:
//	------
//
//
//	Change log:
//	-----------
//	Date:		Changes:
//	-----		--------
//	02/09/01		Initial version
//
///////////////////////////////////////////////////

#ifndef _HEADER_IsosurfaceWindow
#define _HEADER_IsosurfaceWindow

#include <stdlib.h>
#include "GLUTWindow.h"														//	the GLUTWindow class
#include "IsosurfacePane.h"
#include "GLUTToolbox.h"
#include "ContourTreePane.h"
#include "LogCollapsePane.h"
#include "ColourSelectionPane.h"

#include <fstream>
using namespace std;

class IsosurfaceWindow : public GLUTWindow									//	window that displays an isosurface
	{ // class IsosurfaceWindow
	public:
	// Collection of pointers to all the UI elements

	// Column 0: the isosurface pane and associated controls
	GLUTVertPane *isosurfacePaneColumn;

		// A text label for the main (isosurface) pane
		GLUTStaticText *isoPaneLabel;

		// the isosurface pane
		IsosurfacePane *isosurfacePane;
	
		// a horizontal pane holding arcballs & sliders
		GLUTHorizPane *arcBallRow;
		
			// inside that, the arcballs, each in a minor column to allow labels
			GLUTVertPane *rotationColumn;
			
				// the rotation arcball 
				GLUTArcBall *rotator;
				// and it's associated label
				GLUTStaticText *rotatorLabel;
				
			// inside that, the arcballs, each in a minor column to allow labels
			GLUTVertPane *lightingColumn;
			
				// the lighting arcball 
				GLUTArcBall *lightRotator;
				// and it's associated label
				GLUTStaticText *lightLabel;
			
			// another minor column to hold sliders and labels
			GLUTVertPane *labelledSliderColumn;
			
				// a row to hold a slider and a label
				GLUTHorizPane *zoomSliderRow;
				
					// the zoom slider itself
					GLUTHorizSlider *zoomSlider;
					// an extra horizontal pane to coerce text size
					GLUTHorizPane *zoomLabelPane;
					// and its label
					GLUTStaticText *zoomLabel;
					
				// a row for the second slider & label
				GLUTHorizPane *zScaleSliderRow;
				
					// the Z scale slider
					GLUTHorizSlider *zScaleSlider;
					// an extra horizontal pane to coerce text size
					GLUTHorizPane *zScaleLabelPane;
					// and its label
					GLUTStaticText *zScaleLabel;

				// filler to force position of sliders
				GLUTPane *sliderFiller;
	
		// third (in column 0): a horizontal pane to hold boxes & buttons
		GLUTHorizPane *boxButtonRow;
		
			// column to hold check boxes
			GLUTVertPane *checkBoxColumn;
			
				// checkbox for coloured contours
				GLUTCheckBox *colouredContourBox;
				// checkbox for local contours
				GLUTCheckBox *localContourBox;
				// checkbox for local min contours
				GLUTCheckBox *localMinContourBox;
			
			// column for delete buttons
			GLUTVertPane *deleteColumn;
			
				// text button to delete selection
				GLUTTextButton *deleteSelectionButton;
				// text button to delete complement
				GLUTTextButton *deleteComplementButton;
				// text button to restore deleted surfaces	
				GLUTTextButton *restoreDeletedButton;	

			// filler to force position of buttons
			GLUTPane *boxButtonFillerColumn;

	// Column 1:	The Isovalue Slider & label
	GLUTVertPane *isovalueColumn;
	
		// the label
		GLUTStaticText *isovalueLabel;
		// the slider
		GLUTVertSlider *isovalueSlider;

		// button to increment isovalue
		GLUTTextButton *incrementButton;

		// button to decrement isovalue
		GLUTTextButton *decrementButton;

		// fixed size pane to force matching reshape
		GLUTPane *isovalueFiller;
		
	// Column 2:	The Contour Tree Pane & associated elements
	GLUTVertPane *contourTreeColumn;
	
		// the label
		GLUTStaticText *contourTreeLabel;
		
		// A top filler pane to compensate for slider overhangs
		GLUTPane *treeTopFiller;

		// the contour tree pane
		ContourTreePane *contourTreePane;
		
		// a horizontal pane for two check boxes
		GLUTHorizPane *contourTreeCheckRow;
		
			// the check box to show the tree
			GLUTCheckBox *showTreeBox;
			// the check box to colour the tree
			GLUTCheckBox *colourTreeBox;
			
		// A middle filler pane to compensate for slider overhangs
		GLUTPane *treeMidFiller;

		// Static Text for colours
		GLUTStaticText *colourPaneLabel;
		
		// Colour Selection Pane
		ColourSelectionPane *colourPane;
		
		// pane to force matching reshape
		GLUTPane *contourTreeFiller;
			
		// a horizontal pane for two columns of buttons
		GLUTHorizPane *contourTreeButtonBox;

		// a vertical pane for the layout buttons
		GLUTHorizPane *layoutButtonColumn;
		
			// button for dot layout
			GLUTTextButton *dotLayoutButton;
			// button to save tree layout
			GLUTTextButton *saveLayoutButton;
			// button to load tree layout
			GLUTTextButton *loadLayoutButton;
			
	// Column 3: Log collapse pane and associated controls
	GLUTVertPane *collapseColumn;
	
		// the label
		GLUTStaticText *collapseLabel;
		
		// A top filler pane to compensate for slider overhangs
		GLUTPane *collapseTopFiller;

		// a horizontal pane to take the collapse & slider overhangs
		GLUTHorizPane *collapsePaneRow;
			
			// left filler
			GLUTPane *leftCollapseFiller;
			// the collapse pane proper
			LogCollapsePane *collapsePane;
			// right filler
			GLUTPane *rightCollapseFiller;

		// A top filler pane to compensate for slider overhangs
		GLUTPane *collapseMidFiller;

		// the slider controlling the tree size
		GLUTHorizSlider *treeSizeSlider;
			
		// horizontal pane for collapse & uncollapse buttons
		GLUTHorizPane *collapseRow;
		
			// filler for collapseRow
			GLUTPane *fillerLeftmost;
			// button to collapse by one arc
			GLUTTextButton *collapseButton;
			// filler for collapseRow
			GLUTPane *fillerLeft;
			// static text
			GLUTStaticText *treeSizeLabel;
			// filler for collapseRow
			GLUTPane *fillerRight;
			// button to grow by one arc
			GLUTTextButton *uncollapseButton;
			// filler for collapseRow
			GLUTPane *fillerRightmost;
			
		// horizontal filler pane
		GLUTPane *collapseFiller;

	// Column 4: the measure slider
	GLUTVertPane *measureColumn;
	
		// a label
		GLUTStaticText *measureLabel;
		
		// the slider
		GLUTVertSlider *measureSlider;
		
		// Radio Group for measure choice
		GLUTRadioGroup *measureChooser;

		// a filler pane
		GLUTPane *measureFiller;
		
	IsosurfaceWindow(int argc, char **argv, const char *windowName = "Flexible Isosurface Demo");				//	constructor : everything else should be in the
																			//	IsosurfacePane
																	
	}; // class IsosurfaceWindow

#endif
