/******************** start of window.pde ********************/

//
public class WindowButton {
	//ControlP5 mycp5;
	controlP5.Button miniButton;
	controlP5.Button closeButton;
	controlP5.Button setButton;

	//load image for button
	PImage[] close_img = { 
		loadImage ("close_a.png"), 
		loadImage ("close_b.png"), 
		loadImage ("close_c.png")
	};

	PImage[] mini_img = { 
		loadImage ("mini_a.png"), 
		loadImage ("mini_b.png"), 
		loadImage ("mini_c.png")
	};

	PImage[] set_img = { 
		loadImage ("set_a.png"), 
		loadImage ("set_b.png"), 
		loadImage ("set_c.png")
	};

	WindowButton (ControlP5 thecp5, int theX, int theY) {
		createButton (thecp5, theX, theY);
	}

	//
	void createButton (ControlP5 thecp5, int theX, int theY) {
		setButton  = thecp5.addButton ("setButton")
			.setCaptionLabel ("Set")
			.setPosition (theX, theY)
			.setImages (set_img)
			//.setColorBackground (color (60, 60, 60))
			.setId (ServoId.SET_BUTTON)
			.setSize (21, 20)
			;
		miniButton = thecp5.addButton ("miniButton")
			.setCaptionLabel ("-")
			.setPosition (theX+26, theY)
			.setImages (mini_img)
			//.setColorBackground (color (60, 60, 60))
			.setId (ServoId.MINIMIZE_BUTTON)
			.setSize (21, 20)
			;
		closeButton = thecp5.addButton ("closeButton")
			.setCaptionLabel ("X")
			.setPosition (theX+52, theY)
			.setImages (close_img)
			//.setColorBackground (color (60, 60, 60))
			.setId (ServoId.CLOSE_BUTTON)
			.setSize (21, 20)
			;

		miniButton.captionLabel()
			.toUpperCase(false)
			.align(CENTER, CENTER)
			.setFont (buttonfont);
		closeButton.captionLabel()
			.toUpperCase(false)
			.align(CENTER, CENTER)
			.setFont (buttonfont);
	}
}

/******************** end of window.pde ********************/
