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

////////////////////////////////////
//
// CONSTANTS
//
//


#define OPTION_COLOR		0 0 .1 1
#define Tab_Color1			0 0 0 1
#define Tab_Color2			0 0 .5 1
#define VSPACE				16
#define VSIZE				16
#define ICON_ALPHA			0.5
#define LINE_ALPHA			0.2
#define FADEIN_TIME			125
#define HINT_COLOR			.25 .25 .25
#define HINT_FADE_TIME		125
#define TAB_HEIGHT			20
#define LINE_WIDTH			300


////////////////////////////////////
//
// MENU DEFINITION
//
//

{
    menuDef {
		name "ingame_callvote"
		visible MENU_FALSE				// Visible on open
		focusColor RQ3_MAIN_FOCUSCOLOR			// Menu focus color for text and items
		rect 120 112 344 264
		anglevectors 3 -87
		style WINDOW_STYLE_EMPTY
		popup
		
		onOOBClick { close _self }
		onOpen {
			play "sound/ui/whoosh3.wav" ;
			uiScript loadVoteArenas ;
			setitemcolor hints forecolor HINT_COLOR 1 ; hide "hints" ;
			ACTIVATE_TAB(1) ;
		}
		
		onClose { open _prev }
		onEsc { close _self }
		
		onOpenSpecial {
			//normal items
			setItemColor "fade_alpha" forecolor 5 5 5 0 ;
			timeFade "fade_alpha" forecolor 5 5 5 1 0 FADEIN_TIME ;
			//icon - special alpha
			setItemColor "icon" forecolor 5 5 5 0 ;
			timeFade "icon" forecolor 5 5 5 ICON_ALPHA 0 FADEIN_TIME ;
			//line - special alpha; using backcolor
			setItemColor "line" backcolor 5 5 5 0 ;
			timeFade "line" backcolor 5 5 5 LINE_ALPHA 0 FADEIN_TIME ;
		}
		
		itemDef {
			name "paper,fade_alpha"
			style WINDOW_STYLE_SHADER
			background UI_ASSETS"/paper_1"
			forecolor MENUCOLOR_OPTIONS 1
			rect -8 -16 380 320
			anglevectors 3 -87
			visible 1
			menuAnchor
			decoration
		}
		
		itemDef {
			renderpoint
			name "title,fade_alpha"
			text "Call a vote:"
			forecolor .6 .0 .0 1
			style WINDOW_STYLE_EMPTY
			textalign ITEM_ALIGN_LEFT
			textalignx 4
			textaligny 24
			textscale RQ3_MAIN_TEXTSIZE
			alignrect paper ITEM_ALIGN_LEFT 32 32 240 36 
			visible 1
			autowrapped
			decoration
		}

		//Line

		itemDef {
			name "line,fade_alpha"
			style WINDOW_STYLE_FILLED
			backcolor .25 .25 .25 LINE_ALPHA
			alignrect "title" ITEM_ALIGN_LEFT 0 48 LINE_WIDTH 2
			visible 1
			decoration
		}

    ///////////////////////////////////////////////////////////
    //
    // Sub-options
    //
    //

	// Gametype

	ADD_TAB(
		"^_G^_ametype.",
		"G", 1, "group2,group3",
		alignrect "title" ITEM_ALIGN_LEFT 2 28 55 TAB_HEIGHT
	)
    ADD_HINT("hint_tab1", "Call a vote for a gametype change", "group2,group3")

//---------------------------------------------------------

	// Map

	ADD_TAB(
		"^_M^_ap.",
		"M", 2, "group1,group3",
		alignrect "tab1" ITEM_ALIGN_RIGHT -27 0 27 TAB_HEIGHT
	)
    ADD_HINT("hint_tab2", "Call a vote for a map change", "group1,group3")


//---------------------------------------------------------

	// Kick

	ADD_TAB(
		"^_K^_ick.",
		"K", 3, "group1,group2",
		alignrect "tab2" ITEM_ALIGN_RIGHT -31 0 32 TAB_HEIGHT
	)
    ADD_HINT("hint_tab3", "Call a vote to kick a player from the server", "group1,group2")

/*
==========================================================

Group # 1 - Gametype

==========================================================
*/

		BEGIN_SIMPLE_OPTION(1, 1)
			alignrect "line" ITEM_ALIGN_LEFT 56 44 156 VSIZE
			text ""
			ownerdraw UI_NETGAMETYPE
			ASSIGN_HINT("hint_tab1")
		END_OPTION
		
		itemDef	{
			name "btn_game,allgroups,group1"
			subgroup "fade_fore_alpha"
			alignrect "line" ITEM_ALIGN_LEFT 228 46 36 16
			text "> ^_O^_K <"
			shortcutKey "O"
			style WINDOW_STYLE_EMPTY
			forecolor .5 0 0 1
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action { play "sound/ui/whoosh3.wav" ; uiScript voteGame ; uiScript closeingame }
			ASSIGN_HINT("hint_tab1")
		}
		
		itemDef {
			name "gametype_dots"
			group "fade_fore_alpha,group1,allgroups"
			style 0
			text ".............................................."
			alignrect "gr1_ctrl1" ITEM_ALIGN_LEFT 0 0 168 20
			textscale .225
			textalign ITEM_ALIGN_LEFT
			textaligny 20
			forecolor OPTION_COLOR
			visible 1
			decoration
		}

/*
==========================================================

Group # 2 - Map

==========================================================
*/
	
		itemDef {
			text "Call a vote for"
			name "hint_map,allgroups,group2,hints,fade_alpha"	
			group "fade_fore_alpha,group2,allgroups"
			ownerdraw UI_ALLMAPS_SELECTION
			autowrapped
			forecolor HINT_COLOR 1
			textalign ITEM_ALIGN_LEFT
			textalignx 6
			textaligny 10
			textscale .2
			alignrect "line" ITEM_ALIGN_LEFT 0 8 288 40
			style WINDOW_STYLE_EMPTY
			visible 0
			decoration
		}
		
		// Map list //
		
		itemDef {
			name "maplist"
			subgroup "fade_fore_alpha,group2,allgroups"
			LISTBOX_STYLE(.225, 8)
			alignrect "line" ITEM_ALIGN_LEFT 4 32 188 124
			feeder FEEDER_ALLMAPS
			visible 1
			columns 1 2 140 25
			ASSIGN_HINT("hint_tab2")
		}
		
		itemDef	{
			name "allgroups,group2,gr2_ctrl3,fade_alpha"
			group "fade_fore_alpha,group2,allgroups"
			alignrect "paper" ITEM_ALIGN_LEFT 240 112 68 14
			text "> ^_N^_ext map <"
			shortcutKey "N"
			style WINDOW_STYLE_EMPTY
			forecolor OPTION_COLOR
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action { play "sound/ui/whoosh3.wav" ; exec "cmd callvote cyclemap" ; uiScript closeingame }
			ASSIGN_HINT("hint_next")
		}
		
		itemDef	{
			name "vote_restart"
			subgroup "fade_fore_alpha,group2,allgroups"
			alignrect "paper" ITEM_ALIGN_LEFT 240 128 84 14
			text "> ^_R^_estart map <"
			shortcutKey "R"
			style WINDOW_STYLE_EMPTY
			forecolor OPTION_COLOR
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action { play "sound/ui/whoosh3.wav" ; exec "cmd callvote map_restart" ; uiScript closeingame }
			ASSIGN_HINT("hint_restart")
		}
		
		itemDef	{
			name "vote_map"
			subgroup "fade_fore_alpha,group2,allgroups"
			alignrect "paper" ITEM_ALIGN_LEFT 240 224 36 14
			text "> ^_O^_K <"
			shortcutKey "O"
			style WINDOW_STYLE_EMPTY
			forecolor .5 0 0 1
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action { play "sound/ui/whoosh3.wav" ; uiScript voteMap ; uiScript closeingame }
			ASSIGN_HINT("hint_map")
		}
		
		ADD_HINT("hint_next", "Call a vote to change to the next map in rotation", "group2")
		ADD_HINT("hint_restart", "Call a vote to restart the current map", "group2")

/*
==========================================================

Group # 3 - Kick

==========================================================
*/
		itemDef {
			name "allgroups,group3,gr3_ctrl1,fade_alpha"
			subgroup "fade_fore_alpha"
			LISTBOX_STYLE(.225, 8)
			alignrect "line" ITEM_ALIGN_LEFT 4 32 188 124
			feeder FEEDER_PLAYER_LIST
			visible 1
			ASSIGN_HINT("hint_tab3")
		}
		
		itemDef	{
			name "btn_kick,allgroups,group3"
			subgroup "fade_fore_alpha"
			alignrect "paper" ITEM_ALIGN_LEFT 240 224 36 14
			text "> ^_O^_K <"
			shortcutKey "O"
			style WINDOW_STYLE_EMPTY
			forecolor .5 0 0 1
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action { play "sound/ui/whoosh3.wav" ; uiScript voteKick ; uiScript closeingame }
			ASSIGN_HINT("hint_kick")
		}
		
		itemDef {
			text "Call a vote to kick"
			name "hint_kick,allgroups,group3,hints,fade_alpha"	
			group "fade_fore_alpha,group3,allgroups"
			ownerdraw UI_SELECTEDPLAYER
			autowrapped
			forecolor HINT_COLOR 1
			textalign ITEM_ALIGN_LEFT
			textalignx 6
			textaligny 10
			textscale .2
			alignrect "line" ITEM_ALIGN_LEFT 0 8 288 40
			style WINDOW_STYLE_EMPTY
			visible 0
			decoration
		}
		
	}
}
