/*=================================================================
	File created by Yohann NICOLAS.

	New Interfaces functions

=================================================================*/
#pragma once

#include "common.h"

#define MILIEU(X,L,N) (X + ((N<L)? (L-N)/2 : 0))
#define isOnStatsPage(x,y)		(x<RX(512))

extern DWORD bDontPrintBorder;
extern int selectedPage;
extern int extraHiddenPage;
extern int curRunesPage;
extern int maxRunesPage;

void GoNextStatPage();
void GoPreviousStatPage();
void GoStatPage(int page);
int GetCurrentPage();

struct BtnState
{
	union{
		DWORD all;
		struct{
			DWORD AssSTR:1;
			DWORD AssDEX:1;
			DWORD AssVIT:1;
			DWORD AssENE:1;
			DWORD UnaSTR:1;
			DWORD UnaDEX:1;
			DWORD UnaVIT:1;
			DWORD UnaENE:1;
			DWORD close:1;
			DWORD previousPage:1;
			DWORD nextPage:1;
			DWORD prevRunes:1;
			DWORD nextRunes:1;
		};
	};
};
extern BtnState isDownBtn;

extern bool active_newInterfaces;
extern bool selectMainPageOnOpenning;
extern bool printBackgroundOnMainPage;

extern int posXNextPageBtn;
extern int posYNextPageBtn;
extern int posXPrevPageBtn;
extern int posYPrevPageBtn;
extern int posXClosePageBtn;
extern int posYClosePageBtn;
extern int posXNextRuneBtn;
extern int posYNextRuneBtn;
extern int posXPrevRuneBtn;
extern int posYPrevRuneBtn;
extern int posXRunesList;
extern int posYRunesList;
extern int runesPerPage;

DWORD getXNextPageBtn();
DWORD getYNextPageBtn();
DWORD getXPreviousPageBtn();
DWORD getYPreviousPageBtn();
DWORD getXCloseBtn();
DWORD getYCloseBtn();
DWORD getXNextRunesBtn();
DWORD getYNextRunesBtn();
DWORD getXPrevRunesBtn();
DWORD getYPrevRunesBtn();

#define	getLCloseBtn()			32
#define	getHCloseBtn()			32
#define isOnCloseBtn(x,y)		isOnRect(x, y, getXCloseBtn(), getYCloseBtn(), getLCloseBtn(), getHCloseBtn())

#define	getLPreviousPageBtn()		32
#define	getHPreviousPageBtn()		32
#define isOnPreviousPageBtn(x,y)	isOnRect(x, y, getXPreviousPageBtn(), getYPreviousPageBtn(), getLPreviousPageBtn(), getHPreviousPageBtn())

#define	getLNextPageBtn()		32
#define	getHNextPageBtn()		32
#define isOnNextPageBtn(x,y)	isOnRect(x, y, getXNextPageBtn(), getYNextPageBtn(), getLNextPageBtn(), getHNextPageBtn())

#define	getLPrevRunesBtn()		32
#define	getHPrevRunesBtn()		32
#define isOnPrevRunesBtn(x,y)	isOnRect(x, y, getXPrevRunesBtn(), getYPrevRunesBtn(), getLPrevRunesBtn(), getHPrevRunesBtn())

#define	getLNextRunesBtn()		32
#define	getHNextRunesBtn()		32
#define isOnNextRunesBtn(x,y)	isOnRect(x, y, getXNextRunesBtn(), getYNextRunesBtn(), getLNextRunesBtn(), getHNextRunesBtn())

DWORD STDCALL statsLeftDown(sWinMessage* msg);
DWORD STDCALL statsLeftUp(sWinMessage* msg);

void Install_NewInterfaces();

/*================================= END OF FILE =================================*/