/*
	Rogue Trader.
	Copyright (c) 2007, Darragh Coy.
	All rights reserved.
	Original work(s), source code & author(s) details available at: http://www.darraghcoy.com

	Redistribution and use in source and binary forms, with or without modification, are permitted 
	provided that the following conditions are met:

		* 	Redistributions of source code must retain the above copyright notice, this list of 
			conditions and the following disclaimer.
		* 	Redistributions in binary form must reproduce the above copyright notice, this list of 
			conditions and the following disclaimer in the documentation.
		* 	Neither the name of the author nor the names of contributors may be used to endorse or 
			promote products derived from this software without specific prior written permission.
		* 	The use of any third party libraries, modules or data files provided with the source 
			form of the program must follow and respect the individual licensing terms of these 
			components. You do not have permission to modify or circumvent the licensing terms for 
			provided third party components unless the third party licenses specifically allow this. 
			If you do not agree to the terms of provided third party components then you do not have 
			permission to use them in your derived work(s).
		* 	The terms of this license do not apply to separate (but related) distributions if supplied 
			by the author(s), only to the contents of this source distribution, derived works, and the 
			binaries produced by either modified or unmodified versions of the source code. The terms 
			of this license do not also apply to any third party libraries or components provided with 
			the source distribution. Such third party elements are licensed under their own separate 
			agreements.

	THIS SOFTWARE IS PROVIDED BY DARRAGH COY ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
	BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
	ARE DISCLAIMED. IN NO EVENT SHALL DARRAGH COY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
	EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
	OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
	OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
	IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef GUIBUTTON_H
#define GUIBUTTON_H

//##############################################################################
// C Includes:
//##############################################################################

#include <Windows.h>
#include <gl/gl.h>

//##############################################################################
// Foward references
//##############################################################################

class GLFont;
class GLFontManager;
class GLTexture;
class GLTextureManager;
class SoundManager;
class SoundSystem;

//##############################################################################
// C++ Includes: cant forward reference these because the compiler complains
//##############################################################################

#include "GuiWidget.h"
#include "GLWindowEventListener.h"

//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################
//
//
// Class Name:   GuiButton
// Purpose:      Simple button widget that responds to click events.
//
//
//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################

class GuiButton : public GuiWidget
{

 public:

        //----------------------------------------------------------------------
        // Functions
        //----------------------------------------------------------------------

        // Default Constructor:

        GuiButton();

        // set the buttons highlight color

        void setHighlightColor
        (
            float r,
            float g,
            float b
        );

        // set the button label

        void setLabel( char   * label );

        // set the button font

        void setFont ( GLFont * font  );

        // set the button font size

        void setFontSize ( unsigned size );

        // set the button font color

        void setFontColor
        (
            float r,
            float g,
            float b
        );

        // Mouse released event

        void mouseReleased
        (
            int x ,
            int y ,
            GLWindow::MouseButton button
        );

        // Mouse pressed event

        void mousePressed
        (
            int x ,
            int y ,
            GLWindow::MouseButton button
        );

        // Mouse moved event:

        void mouseMoved
        (
            int x,
            int y
        );

        // window redrawing event

        void windowRedrawing();

        // lost focus event

        void lostFocus();

        // See if button is depressed:

        inline bool isDepressed(){ return depressed; }

//##############################################################################
//##############################################################################
//##############################################################################
//##############################################################################

 protected:

        //----------------------------------------------------------------------
        // Constants
        //----------------------------------------------------------------------

        // These constants control the shading of the button

        static const float INTENSITY_NORMAL_1;  // normal fill brightness for the button: first shade
        static const float INTENSITY_NORMAL_2;  // normal fill brightness for the button: second shade
        static const float INTENSITY_SHINE_1;   // fill brightness around the shiny parts of the widget: first shade
        static const float INTENSITY_SHINE_2;   // fill brightness around the shiny parts of the widget: second shade
        static const float INTENSITY_SHADE_1;   // fill brightness around the shady parts of the widget: first shade
        static const float INTENSITY_SHADE_2;   // fill brightness around the shady parts of the widget: second shade

        //----------------------------------------------------------------------
        // Variables
        //----------------------------------------------------------------------

        GLFont   * font;                // font used for the button
        unsigned   fontSize;            // font size used for the button text
        float      fontColorR;          // font color: red
        float      fontColorG;          // font color: green
        float      fontColorB;          // font color: blue
        float      highlightColorR;     // highlighted color for the button: red
        float      highlightColorG;     // highlighted color for the button: green
        float      highlightColorB;     // highlighted color for the button: blue
        char     * label;               // button label
        bool       depressed;           // is the button depressed ? And i don't mean sad either : )
        bool       highlighted;         // is the mouse over the button and is the button highLighted ?

}; // end of: class GuiButton{}

//##############################################################################
// C++ Includes:
//##############################################################################

#include "GLFont.h"
#include "GLFontManager.h"
#include "GLTexture.h"
#include "GLTextureManager.h"
#include "SoundManager.h"
#include "SoundSystem.h"

#endif // end of: ifndef GUIBUTTON_H
