/*
 *  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 NATIVEAPPLICATION_H
#define NATIVEAPPLICATION_H

#include "NativeView.h"
#include "NativeWindow.h"

namespace winBe {

	typedef std::list<BWindow*> WindowList;


	class NativeApplication : public boost::noncopyable
	{
	public:
		void initialize (HINSTANCE hInstance, HINSTANCE hPrevInstance, const char* lpCmdLine);
		~NativeApplication ();

		int run ();

		static NativeApplication& instance () { return appInstance; }
		HINSTANCE getHINSTANCE ();

		// Window management functions
		NativeWindow* addWindow (BWindow* window);
		NativeWindow* findWindow (BWindow* window);
		void deleteWindow (BWindow* window);
		WindowList NativeApplication::getWindowList ();

		// View management functions
		NativeView* addView (BView* view, NativeWindow* window);
		NativeView* findView (BView* view);
		void deleteView (BView* view);

	protected:
		NativeApplication ();

	private:
		void initialize ();

		HINSTANCE hInstance;
		NativeWindowLookup windowLookup;
		NativeViewLookup viewLookup;

		static NativeApplication appInstance;
	};


	typedef boost::shared_ptr<NativeApplication> NativeApplicationPtr;

}

#endif // NATIVEAPPLICATION_H
