#include "ui/menudef.h"
#include "ui/menumacros.h"

// Defines //
#define WINDOW_X		0
#define WINDOW_Y		0
#define WINDOW_WIDTH	__WINDOW_WIDTH
#define WINDOW_HEIGHT	480
#define GROUP_NAME		"grpPopupError_pbenable"

// Error Popup //
menuDef {
	name		"popupError_pbenable"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED
	popup

	fadeClamp	0.5
	fadeAmount  0.075

	onOpen {
		uiScript ServerStatus_diagnose ;
		setitemcolor background backcolor 0 0 0 0 ;
		fadein background
	}

	onESC {
		uiScript clearError ;
		close popupError_pbenable ;
		open main
	}

// Background //
	itemDef {
		name		"background"
		rect		0 0 WINDOW_WIDTH 480
		style		WINDOW_STYLE_FILLED
		background	"ui/assets/fadebox.tga"
		backcolor	0 0 0 0
		visible		1
		decoration
	}

// Subwindows //
#define SUBWINDOW_WIDTH		256
#define SUBWINDOW_HEIGHT	192
#define SUBWINDOW_X			.5*(WINDOW_WIDTH-SUBWINDOW_WIDTH)
#define SUBWINDOW_Y			.5*(WINDOW_HEIGHT-SUBWINDOW_HEIGHT)

	SUBWINDOWBLACK( SUBWINDOW_X, SUBWINDOW_Y, SUBWINDOW_WIDTH, SUBWINDOW_HEIGHT, _("ERROR") )

	CVARLABEL( SUBWINDOW_X+6, SUBWINDOW_Y+16, (SUBWINDOW_WIDTH)-12, 132, "com_errorMessage", .2, ITEM_ALIGN_LEFT, 0, 8 )

	// FIXME: Add message we'll never support pb
	// NAMEDBUTTON( "bttn_pbenable", SUBWINDOW_X+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-46, (SUBWINDOW_WIDTH-12), 18, "ENABLE PUNKBUSTER", .3, 14, clearFocus ; open playonline_enablepb )
	BUTTON( SUBWINDOW_X+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, _("BACK"), .3, 14, uiScript clearError ; close popupError_pbenable ; open main )
	BUTTON( SUBWINDOW_X+6+.5*(SUBWINDOW_WIDTH-18)+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, _("RECONNECT"), .3, 14, uiScript clearError ; close popupError_pbenable ; close backgroundmusic ; close background_1 ; uiScript reconnect )
}
