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

// Ingame MessageMode Menu //
menuDef {
	name		"ingame_messagemode"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onOpen
	{
		closeAllOtherMenus ;
		setEditFocus "efleftSay:"	// note this depends on the macro + item name
	}

	onESC
	{
		close ingame_messagemode ;
	}

	onEnter
	{
		close ingame_messagemode ;
		exec messageSend ;
	}

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

	SUBWINDOWBLACK( SUBWINDOW_X, SUBWINDOW_Y, SUBWINDOW_WIDTH, SUBWINDOW_HEIGHT, _("SEND MESSAGE") )

	itemDef {
		name		"efleftbackSay:"
		group		GROUP_NAME
		rect		$evalfloat((SUBWINDOW_X+4)+24+6) $evalfloat(SUBWINDOW_Y+16) $evalfloat((SUBWINDOW_WIDTH)-8-24-6) $evalfloat(10)
		style		WINDOW_STYLE_FILLED
		backcolor	.5 .5 .5 .2
		visible		1
		decoration
	}

	EDITFIELDLEFT( SUBWINDOW_X+4, SUBWINDOW_Y+16, (SUBWINDOW_WIDTH)-12, 10, _("Say:"), .2, 8, "cg_messageText" onEsc { close ingame_messagemode ; } onEnter { close ingame_messagemode ; exec messageSend ; } onTab { autocomplete ; } feeder FEEDER_PLAYER_LIST, 142, 142, _("Enter text here - press ESCAPE twice to cancel") )
	MULTILEFT( SUBWINDOW_X+4, SUBWINDOW_Y+28, (SUBWINDOW_WIDTH)-12, 10, _("To:"), .2, 8, "cg_messageType", cvarFloatList { "All" 1 "Team" 2 "Fireteam" 3 }, _("Select the destination of your message") )
	BUTTON( SUBWINDOW_X+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, _("CANCEL"), .3, 14, close ingame_messagemode ; )
	BUTTON( SUBWINDOW_X+6+.5*(SUBWINDOW_WIDTH-18)+6, SUBWINDOW_Y+SUBWINDOW_HEIGHT-24, .5*(SUBWINDOW_WIDTH-18), 18, _("SEND"), .3, 14, close ingame_messagemode ; exec messageSend ; )
}
