
function SceneToolListLightSeletor(options) {

	this.options = options;		

	this.list	= null;

	this.CurIndex	= -1;
	
	this.Callback = null;
}

SceneToolListLightSeletor.prototype.initialize = function () {
	alert("SceneToolListLightSeletor.initialize()");	
	this.create();
}

SceneToolListLightSeletor.prototype.handleShow = function () {
	alert("SceneToolListLightSeletor.handleShow()");

	this.list.Show();
}

SceneToolListLightSeletor.prototype.handleHide = function () {
	alert("SceneToolListLightSeletor.handleHide()");
	
	this.list.Hide();

}

SceneToolListLightSeletor.prototype.handleFocus = function () {
	alert("SceneToolListLightSeletor.handleFocus()");

	if(this.list.GetCurrentDataIndex() != this.CurIndex){
		this.list.SetHighlightForDataIndex(this.CurIndex);	
	}
	else {		
		this.list.highlight();
	}
	
}

SceneToolListLightSeletor.prototype.handleBlur = function () {
	alert("SceneToolListLightSeletor.handleBlur()");
	
	this.list.blur();
}

SceneToolListLightSeletor.prototype.handleKeyDown = function (keyCode) {
	
	alert("SceneToolListLightSeletor.handleKeyDown(" + keyCode + ")");
	
	PluginAPIMgr.PlayAudio(keyCode);
	if(ProcMgr.checkWidgetHighlight()==false){
		return;
	}
	switch(keyCode){
    
		case sf.key.ENTER:
			alert("KEY_ENTER");
			this.ResetCallerSceneTimer();
			this.ProcessKeyEnter();			
			break;			
                   
		case sf.key.RETURN:
			alert("KEY_RETURN");
			this.ResetCallerSceneTimer();
			this.ProcessKeyReturn();
		sf.key.preventDefault();
			break;
			
		case sf.key.EXIT:
		sf.key.preventDefault();
			break;	
			
        case 147:  //infolink
        case 261:  //contents
        case 115:  //wiselink
            ProcMgr.processInfolinkKey(); 
			break;
			
		default :
			if(keyCode == sf.key.DOWN || keyCode == sf.key.UP)
			{
				this.ResetCallerSceneTimer();
				this.processLightMode(keyCode);
			}
			
			
			this.list.KeyProcess(keyCode);	
			break;	
		                   
    }
	
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////

SceneToolListLightSeletor.prototype.create = function(){
    alert("SceneToolListLightSeletor.create() ");


	this.list = new List();
	this.list.CreateBG("LightAdjustList");
	this.list.SetBGImage(g_Image.IMAGE_LIST_MAIN_ADD_PHONE_NUMBER_LABEL_LIST_BG);	
	this.list.SetNumOfVisibleItem(4);
    this.list.SetStartDataIndex(0);	
	this.list.SetItemBgImage(ITEM_STATE.NORMAL," ");
	this.list.SetItemBgImage(ITEM_STATE.HIGHLIGHT,g_Image.SELECTOR_ITEM_HIGHLIGHT);
	this.list.SetItemDefualtTextStyle(ITEM_STATE.NORMAL,"cLightAdjustListItem_Text_normal_style");
	this.list.SetItemDefualtTextStyle(ITEM_STATE.HIGHLIGHT,"cLightAdjustListItem_Text_Highlight_style");
	this.list.SetDataType(ITEM_DATA_TYPE.TEXT_ONLY);

	var tempData = [SID_OFF_KR_DEACT , null ];				
	this.list.AddData(tempData);

	tempData = [SID_LOW_KR_VOL , null ];				
	this.list.AddData(tempData);	

	tempData = [COM_SID_MEDIUM , null ];				
	this.list.AddData(tempData);

	tempData = [SID_HIGH_KR_VOL , null ];				
	this.list.AddData(tempData);

	this.list.SetOnClickCallbackFunc(0,this.onClickEventFunc1);
	this.list.SetOnClickCallbackFunc(1,this.onClickEventFunc2);
	this.list.SetOnClickCallbackFunc(2,this.onClickEventFunc3);
	this.list.SetOnClickCallbackFunc(3,this.onClickEventFunc4);	
	this.list.SetClickEventAvailable(WndMgr.MouseClickEnable);
				
	this.list.ShowItem();
	
}

SceneToolListLightSeletor.prototype.Init = function(Value,CallbackFunc)
{
	
	this.CurIndex = Value;
	this.Callback = CallbackFunc;
}


SceneToolListLightSeletor.prototype.ProcessKeyReturn = function(){
	alert("SceneToolListLightSeletor.ProcessKeyReturn() ");
	
	sf.scene.focus('ToolList');
	sf.scene.hide('ToolListLightSeletor');
		
}


SceneToolListLightSeletor.prototype.ProcessKeyEnter = function(){
	alert("SceneToolListLightSeletor.ProcessKeyEnter() ");
	
	if(this.Callback)
	{
		this.Callback(this.CurIndex);
	}
	
	this.ProcessKeyReturn();
}


SceneToolListLightSeletor.prototype.ResetCallerSceneTimer = function()
{
	alert("SceneToolListLightSeletor.ResetCallerSceneTimer() ");	
	sf.scene.get("ToolList").resetTimer();
}

SceneToolListLightSeletor.prototype.processLightMode = function(keycode)
{
	alert("SceneToolListLightSeletor.processLightMode() prev:" + this.CurIndex);

	if(keycode == sf.key.DOWN)
	{
		this.CurIndex++;
		
		if(this.CurIndex > 3)
		{
			this.CurIndex = 0;
		}
	}
	else
	{
		this.CurIndex--;
		
		if(this.CurIndex < 0)
		{
			this.CurIndex = 3;
		}		
	}
	
	PluginAPIMgr.SaveCameraLightMode(this.CurIndex);
	PluginAPIMgr.SetCameraLightMode();
}


SceneToolListLightSeletor.prototype.onClickEventFunc1 = function(){
	
	PluginAPIMgr.SaveCameraLightMode(0);
	PluginAPIMgr.SetCameraLightMode();


	var This_ = sf.scene.get("ToolListLightSeletor");
	
	This_.CurIndex = 0;	
	This_.ProcessKeyEnter();
	
}

SceneToolListLightSeletor.prototype.onClickEventFunc2 = function(){

	PluginAPIMgr.SaveCameraLightMode(1);
	PluginAPIMgr.SetCameraLightMode();


	var This_ = sf.scene.get("ToolListLightSeletor");
	
	This_.CurIndex = 1;	
	This_.ProcessKeyEnter();
}

SceneToolListLightSeletor.prototype.onClickEventFunc3 = function(){
	
	PluginAPIMgr.SaveCameraLightMode(2);
	PluginAPIMgr.SetCameraLightMode();


	var This_ = sf.scene.get("ToolListLightSeletor");
	
	This_.CurIndex = 2;	
	This_.ProcessKeyEnter();
	
}

SceneToolListLightSeletor.prototype.onClickEventFunc4 = function(){
	
	PluginAPIMgr.SaveCameraLightMode(3);
	PluginAPIMgr.SetCameraLightMode();


	var This_ = sf.scene.get("ToolListLightSeletor");
	
	This_.CurIndex = 3;	
	This_.ProcessKeyEnter();
	
}
