/*
	Trampoline Sim.
	Copyright (c) 2009, 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 MOUSE_H
#define MOUSE_H

//=====================================================================================================================
//=====================================================================================================================

namespace Game
{
	//=================================================================================================================
	//=================================================================================================================
	
	class Window;

	//=================================================================================================================
	/// @brief		Allows for querying of mouse input and also for manipulation of the mouse.
	//=================================================================================================================

	class Mouse
	{
		public:
		
			//=========================================================================================================
			// Enums
			//=========================================================================================================
			
				/// Represents a type of cursor that can be used by the mouse
			
				enum CusorType
				{
					/// Have no mouse cursor
				
					CURSOR_NONE	,
					
					/// Use an arrow mouse cursor
										
					CURSOR_ARROW ,
					
					/// Use a crosshair mouse cursor
					
					CURSOR_CROSSHAIR
				};		
				
				/// Represents a button on the mouse
				
				enum Button
				{
					/// Left mouse button
				
					BTN_LEFT = 0x1 ,
					
					/// Left mouse button
					
					BTN_RIGHT = 0x2 ,
					
					/// Middle mouse button
					
					BTN_MIDDLE = 0x4 ,
					
					/// 4th extra mouse button
					
					BTN_4 = 0x5 ,
					
					/// 5th extra mouse button
					
					BTN_5 = 0x6
				};

			//=========================================================================================================
			// Functions
			//=========================================================================================================

				/// Tells if the given mouse button is pressed
		
				static bool	IsButtonPressed( Button button_code );
				
				/// Tells if the given mouse button is released
		
				static inline bool IsButtonReleased( Button button_code ){ return ! IsButtonPressed(button_code); }
				
				/// Get the position of the mouse in screen coordinates.
				
				static void GetScreenPosition( int & screen_x , int & screen_y );
				
				/// Get the position of the mouse in client coordinates:
				
				static void GetClientPosition( Window * window , int & client_x , int & client_y );
				
				/// Restricts mouse movement to the given window: this needs to be called again if the window position changes
				
				static void RestrictToWindow( Window * window );
				
				/// Centers the mouse in the middle of the given window
				
				static void CenterInWindow( Window * window );
				
				/// If the mouse is currently restricted to the window, previous restrictions are removed
				
				static void Unrestrict();
				
				/// Tells if the mouse is within the client area of the given window
				
				static bool InClientArea( Window * window );
				
				/// Moves the mouse to a given point in screen coordinates
				
				static void MoveToScreenPosition( int screen_x , int screen_y );
				
				/// Moves the mouse to a given point in client coordinates
				
				static void MoveToClientPosition( Window * window , int client_x , int client_y );
				
				/// Sets the current cursor to use for the given window
				
				static void SetMouseCursor( Window * window , CusorType type );				
	};
};

#endif
