//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//agenttype_switchedstate_menu_context
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void agenttype_switchedstate_menu_context(Menu *m, agent *a)
{
	//Get the agent details
	agenttype_switchedstate_details *details = (agenttype_switchedstate_details *) a->agentdetails;

	char namedot[1000];
	sprintf(namedot, "%s%s", a->agentaction, ".");

	menu_controloptions(m, a->controlptr, 3, details->agents, namedot, agenttype_switchedstate_agentdescriptions, agenttype_switchedstate_agenttypes[details->datatype]);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//agenttype_compoundtext_menu_context
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void agenttype_compoundtext_menu_context(Menu *m, agent *a)
{
	agenttype_compoundtext_details *details = (agenttype_compoundtext_details *) a->agentdetails;

	make_menuitem_str(m, "Formatting", config_getfull_control_setagentprop_s(a->controlptr, a->agentaction, "Formatting"), details->text ? details->text : "");

	char namedot[1000];
	sprintf(namedot, "%s%s", a->agentaction, ".");	
	menu_controloptions(m, a->controlptr, AGENTTYPE_COMPOUNDTEXT_MAXAGENTS, details->agents, namedot, agenttype_compoundtext_agentdescriptions, agenttype_compoundtext_agenttypes);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//agenttype_graph_menu_context
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void agenttype_graph_menu_context(Menu *m, agent *a)
{
	agenttype_graph_details *details = (agenttype_graph_details *) a->agentdetails;

	for (int i = 0; i < AGENTTYPE_GRAPH_CHARTTYPECOUNT; i++)
	{
		make_menuitem_bol(m, agenttype_graph_friendlycharttypes[i], config_getfull_control_setagentprop_c(a->controlptr, a->agentaction, "GraphType", agenttype_graph_charttypes[i]), details->charttype == i);
	}
	make_menuitem_nop(m, NULL);

	char namedot[1000];
	sprintf(namedot, "%s%s", a->agentaction, ".");

	menu_controloptions(m, a->controlptr, AGENTTYPE_GRAPH_AGENTCOUNT, details->agents, namedot, agenttype_graph_agentdescriptions, agenttype_graph_agenttypes);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//controltype_switchbutton_menu_context
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void controltype_switchbutton_menu_context(Menu *m, control *c)
{
	//Get the details
	controltype_button_details *details = (controltype_button_details *) c->controldetails;

	//Show the menu
	menu_controloptions(m, c, CONTROLTYPE_TWOSTATEBUTTON_AGENTCOUNT, details->agents, "", controltype_switchbutton_agentnames, controltype_switchbutton_agenttypes);

	make_menuitem_nop(m, "");
	Menu* submenu = make_menu("Text Settings", c);
	make_menuitem_bol(submenu, "Left", config_getfull_control_setcontrolprop_c(c, "HAlign", "Left"), details->halign == 1);
	make_menuitem_bol(submenu, "Center", config_getfull_control_setcontrolprop_c(c, "HAlign", "Center"), details->halign == 0);
	make_menuitem_bol(submenu, "Right", config_getfull_control_setcontrolprop_c(c, "HAlign", "Right"), details->halign == 2);
	make_menuitem_nop(submenu, "");
	make_menuitem_bol(submenu, "Top, Word Wrapped", config_getfull_control_setcontrolprop_c(c, "VAlign", "TopWrap"), details->valign == 3);
	make_menuitem_bol(submenu, "Top", config_getfull_control_setcontrolprop_c(c, "VAlign", "Top"), details->valign == 1);
	make_menuitem_bol(submenu, "Center", config_getfull_control_setcontrolprop_c(c, "VAlign", "Center"), details->valign == 0);
	make_menuitem_bol(submenu, "Bottom", config_getfull_control_setcontrolprop_c(c, "VAlign", "Bottom"), details->valign == 2);
	make_submenu_item(m, "Text Settings", submenu);

}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//controltype_label_menu_context
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void controltype_label_menu_context(Menu *m, control *c)
{
	//Variables
	Menu *submenu;

	//Get the details
	controltype_label_details *details = (controltype_label_details *) c->controldetails;

	//Show the menu
	menu_controloptions(m, c, CONTROLTYPE_LABEL_AGENT_COUNT, details->agents, "", controltype_label_agentnames, controltype_label_agenttypes);

	make_menuitem_nop(m, "");

	submenu = make_menu("Text Settings", c);
	make_menuitem_bol(submenu, "Left", config_getfull_control_setcontrolprop_c(c, "HAlign", "Left"), details->halign == 1);
	make_menuitem_bol(submenu, "Center", config_getfull_control_setcontrolprop_c(c, "HAlign", "Center"), details->halign == 0);
	make_menuitem_bol(submenu, "Right", config_getfull_control_setcontrolprop_c(c, "HAlign", "Right"), details->halign == 2);

	make_menuitem_nop(submenu, "");

	make_menuitem_bol(submenu, "Top, Word Wrapped", config_getfull_control_setcontrolprop_c(c, "VAlign", "TopWrap"), details->valign == 3);
	make_menuitem_bol(submenu, "Top", config_getfull_control_setcontrolprop_c(c, "VAlign", "Top"), details->valign == 1);
	make_menuitem_bol(submenu, "Center", config_getfull_control_setcontrolprop_c(c, "VAlign", "Center"), details->valign == 0);
	make_menuitem_bol(submenu, "Bottom", config_getfull_control_setcontrolprop_c(c, "VAlign", "Bottom"), details->valign == 2);

	make_submenu_item(m, "Text Settings", submenu);

	if (details->is_frame)
	{
		bool temp;
		temp = !details->has_titlebar;
		make_menuitem_bol(m, "Has Title Bar", config_getfull_control_setcontrolprop_b(c, "HasTitleBar", &temp), false == temp);
		temp = !details->is_locked;
		make_menuitem_bol(m, "Lock Children", config_getfull_control_setcontrolprop_b(c, "IsLocked", &temp), false == temp);
		make_menuitem_nop(m, NULL);
		controltype_frame_insertpluginmenu(c, m);
	}
}