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

// Defines //
#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	160
#define WINDOW_HEIGHT	224
#define GROUP_NAME		"grpIngameMain"

// Main Menu //
menuDef {
	name		"ingame_main"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onOpen {
		conditionalscript ROldModeCheck 2
			( "clearFocus ; open vid_confirm" )
			( "clearFocus" )
	}

	onEsc {
		close ingame_main ;
	}

// Window //
	WINDOW( _("MENU"), 50 )

// Buttons //
// FIXME: tooltips with BUTTONEXT don't work when conditionalScript or cvartest is used?! ...
	BUTTONEXT( 6, 32, WINDOW_WIDTH-12, 18, _("LIMBO MENU"), .3, 14, exec "openlimbomenu" ; close ingame_main, tooltip _("Select your team, class, weapon and spawnpoint") )
	BUTTONEXT( 6, 56, WINDOW_WIDTH-12, 18, _("VOTE"), .3, 14, uiScript clientCheckVote ;
		conditionalScript cg_ui_novote 0
		( "clearFocus ; open ingame_votedisabled" )
		( "close ingame_main ; open ingame_vote" ),
		cvarTest "authLevel" showCVar { RL_NONE } )
	BUTTONEXT( 6, 56, WINDOW_WIDTH-12, 18, _("REFEREE"), .3, 14, close ingame_main ; open ingame_vote, cvarTest "authLevel" showCVar { RL_REFEREE } )
	BUTTONEXT( 6, 56, WINDOW_WIDTH-12, 18, _("RCON"), .3, 14, close ingame_main ; open ingame_vote, cvarTest "authLevel" showCVar { RL_RCON } )
	BUTTONEXT( 6, 80, WINDOW_WIDTH-12, 18, _("SERVER INFO"), .3, 14, clearFocus ; open ingame_serverinfo, tooltip _("Print all server info") )
	BUTTONEXT( 6, 104, WINDOW_WIDTH-12, 18, _("OPTIONS"), .3, 14, close ingame_main ; open options, tooltip _("Set available game options") )
	BUTTONEXT( 6, 128, WINDOW_WIDTH-12, 18, _("FAVORITE"), .3, 14, uiScript clientCheckFavorite ;
		conditionalScript cg_ui_favorite 0
		( "open popupAddFavorite" )
		( "open popupRemoveFavorite" ), tooltip _("Set or unset this server as favorite") )
	BUTTONEXT( 6, 152, WINDOW_WIDTH-12, 18, _("CREDITS"), .3, 14, close ingame_main ; open credits_etlegacy, tooltip _("Look at the legacy hall of fame") )
	BUTTONEXT( 6, 176, WINDOW_WIDTH-12, 18, _("DISCONNECT"), .3, 14, clearFocus ; open ingame_disconnect, tooltip _("Disconnect your connection from current server") )
	BUTTONEXT( 6, 200, WINDOW_WIDTH-12, 18, _("EXIT GAME"), .3, 14, clearFocus ; open quit, tooltip _("Don't press this. Be warned!") )

	itemDef {
		name        "legacy_logo"
		rect        15 220 128 64
		style       WINDOW_STYLE_SHADER
		background  "ui/assets/etl_logo"
		forecolor   1 1 1 1
		visible     1
		decoration
	}

	LABEL( 60, 262, 114, 10, "^1"ETLEGACY_VERSION, .2, ITEM_ALIGN_LEFT, 0, 8 )
}
