#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		"grpIngameServerInfo"

// Server Info Menu //
menuDef {
	name		"ingame_serverinfo"
	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 {
		setitemcolor background backcolor 0 0 0 0 ;
		fadein background ;
		setcvar ui_serverBrowser 0 ;
		uiScript InGameServerStatus
	}

	onESC {
		close ingame_serverinfo ;
		open ingame_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		384
#define SUBWINDOW_HEIGHT	320
#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, _("SERVER INFO") )

	itemDef {
		name			"serverInfo"
		group			GROUP_NAME
		rect			 $evalfloat((SUBWINDOW_X)+6)  $evalfloat((SUBWINDOW_Y)+20)  $evalfloat((SUBWINDOW_WIDTH)-12)  $evalfloat((SUBWINDOW_HEIGHT)-20-26)
		type			ITEM_TYPE_LISTBOX
		textfont		UI_FONT_COURBD_21
		textstyle		ITEM_TEXTSTYLE_SHADOWED
		textscale		.2
		textaligny		-3
		forecolor		.6 .6 .6 1
		feeder			FEEDER_SERVERSTATUS
		elementtype		LISTBOX_TEXT
		elementwidth	$evalfloat((SUBWINDOW_WIDTH)-12)
		elementheight	12
		columns			4	0	40	20
							40	40	10
							90	40	10
							135	40	20
		visible			1
		notselectable
	}

	BUTTON( (SUBWINDOW_X)+6, (SUBWINDOW_Y)+(SUBWINDOW_HEIGHT)-24, .25*((SUBWINDOW_WIDTH)-24), 18, _("BACK"), .3, 14, close ingame_serverinfo ; open ingame_main )
	BUTTON( (SUBWINDOW_X)+6+.25*((SUBWINDOW_WIDTH)-24)+6, (SUBWINDOW_Y)+(SUBWINDOW_HEIGHT)-24, .25*((SUBWINDOW_WIDTH)-24), 18, _("REFRESH"), .3, 14, uiScript ServerStatus )
	BUTTON( (SUBWINDOW_X)+6+.25*((SUBWINDOW_WIDTH)-24)+6+.25*((SUBWINDOW_WIDTH)-24)+6, (SUBWINDOW_Y)+(SUBWINDOW_HEIGHT)-24, .5*((SUBWINDOW_WIDTH)-24), 18, _("FAVORITE"), .3, 14, clearFocus ; close ingame_serverinfo ; uiScript clientCheckFavorite ;
		conditionalScript cg_ui_favorite 0
		( "open popupAddFavorite" )
		( "open popupRemoveFavorite" ) )
}
