#include <windows.h>
#include "cdatalogwin.h"
#include "catomswin.h"
#include "coutputwnd.h"
#include "cseparator.h"
#include "chtml.h"

#ifndef __MAINWINDOWCLASS
#define __MAINWINDOWCLASS

#define SEPHOR		100

class CMainWindow
{
	private:
		HWND hwnd;
		HWND focusHwnd;//okno, ktora ma focus pri deaktivaci okna; pri aktivacii sem focus nastavime
		HMENU menu;
		HACCEL accelerator;
		CDatalogWindow *datalogWindow;
		CAtomsWindow *atomsWindow;
		COutputWindow *outputWindow;
		CHtml *htmlWindow;
		CSeparator *sepHorWindow, *sepVerWindow;

		//window messages
		void wmCOMMAND(WPARAM wp, LPARAM lp);
		LRESULT wmCLOSE();
		void wmDESTROY();
		void wmSIZE(WPARAM wp, LPARAM lp);
		void wmNOTIFY(WPARAM wp, LPARAM lp);

		void Menu(WPARAM wp);
		void Connect(bool connect);//true = connect, false = disconnect
		void ChangeMenuState(UINT item,UINT state);
		void SetMenu(bool connect);//nastavi disable/enable polozky v menu podla hodnoty connect

		LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp);
		static LRESULT CALLBACK StaticWindowProc(HWND hwnd,UINT msg,WPARAM wp,LPARAM lp);

		static void SepHorSized(RECT *rc);//vola separator pri zmene svojej pozicie - nastavi okna
		static void SepHorGetMinMax(DWORD *min, DWORD *max);//musi vratit min a max, v ktorom sa moze pohybovat kurzor
		static void SepVerSized(RECT *rc);
		static void SepVerGetMinMax(DWORD *min, DWORD *max);

		static INT_PTR CALLBACK StaticDialogProcAbout(HWND,UINT,WPARAM,LPARAM);

	public:
		CMainWindow();
		~CMainWindow();
		HWND GetHandle();
		HACCEL GetAccelerator();
		CAtomsWindow* GetAtomsWindow();
		CDatalogWindow* GetDatalogWindow();
		CHtml* GetHtmlWindow();
		COutputWindow* GetOutputWindow();
		//static HWND hWndViewResult;
};

#endif