/*
 *  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, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef NATIVEWINDOW_H
#define NATIVEWINDOW_H


#include "NativeView.h"


namespace winBe {

	class NativeWindow;
	typedef boost::shared_ptr<NativeWindow> NativeWindowPtr;
	typedef std::map<BWindow*, NativeWindowPtr> NativeWindowLookup;

	class NativeView;
	typedef boost::shared_ptr<NativeView> NativeViewPtr;
	typedef std::map<BView*, NativeViewPtr> NativeViewLookup;


	class NativeWindow
	{
	public:
		NativeWindow (BWindow* window);
		virtual ~NativeWindow ();

		void createWindow (int left, int top, int right, int bottom);
		NativeView* createView (BView* view, const char* name, int left, int top, int right, int bottom, NativeView* parentView);
		void destroy ();
		void setTitle (std::string title) { SetWindowText (hWnd, title.c_str ()); };
		RECT getClientRect () const;
		RECT getRect () const;
		void setRect (const RECT& rect);
		HWND getHWND () { return hWnd; };

	private:
		static BWindow* getBWindow (HWND hWnd);
		friend LRESULT CALLBACK NativeWindowWndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

		BWindow* window;
		HWND hWnd;
		//NativeViewLookup viewLookup;
	};

}

#endif // NATIVEWINDOW_H
