
//ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
//	FILE	: Splash.h
//	AUTHOR	: Catalin Cocos
//__________________________________________________________________________________________________

#ifndef __SPLASH__
#define __SPLASH__


class CSplashScreen
{
	BYTE R,G,B;
	RECT r;
	int Dlg_RES, Bmp_RES, m_TextHeight;
	HWND StartDialog;
	HGLOBAL hDib;
	BITMAPINFO* pDib;
	HPALETTE pal;
	char* szSplashString, *m_FontName;
	HFONT hfont;
	BOOL volatile CanDelete;

	static void RGBQuadToPaletteEntry(RGBQUAD rgbq[256], PALETTEENTRY pe[256], int flag);
	static HPALETTE CreatePaletteHandle(RGBQUAD rgbq[256], int flag = 0);
	static BOOL CALLBACK StartDlgProc( HWND  hwnd, UINT msg, WPARAM  wp, LPARAM  lp );
	static void TimeCollapse( CSplashScreen* pSS);
	~CSplashScreen();
public:
	CSplashScreen(HINSTANCE hInstance, int SplashBmpID, UINT minTime = 2000, int FontHeight = 16, RECT* TextRect = NULL, char* FontName = NULL, RGBQUAD* Clr = NULL);
	void SetText( char* szText);
	void Close()
	{
		if(!CanDelete)
			CanDelete = TRUE;
		else
			delete this;
	}
};

#endif