/* Copyright (c) 2008, Antonie Jovanoski
 *	
 * All rights reserved.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef WINDOW_H
#define WINDOW_H

#include <windows.h>
#include <windowsx.h>

//--------------------------------------------------------------------------
// Simple window creating class
//
// Usage:
//
// Window wnd(hInstance);
// ShowWindow(wnd.GetHWND(), nCmdShow);
// Reimplement HandleMessage if you want to process window messages
// GetHWND returns !NULL if window creation is succesfull
//--------------------------------------------------------------------------

class Window
{
public:

	Window(HINSTANCE hInstance, int width = 800, int height = 600);
	HWND GetHwnd() const;
	HINSTANCE GetInstance() const;
	unsigned int GetWidth() const;
	unsigned int GetHeight() const;
	
	virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
	virtual void OnResize(int width, int height);
	virtual void OnKeyDown(UINT vkey, UINT flags);
	virtual void OnMouseLeftDown(int x, int y, UINT flags);
	virtual void OnMouseMove(int x, int y, UINT flags);
	virtual void OnMouseLeftUp(int x, int y, UINT flags);

	virtual ~Window();

private:

	static LRESULT CALLBACK s_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
	HWND m_hWnd;
	HINSTANCE m_hInst;
};

#endif