/*
*
* Preferences.xml : Preferences
*
*/
function OnPreferencesEvent_CtrlClicked(pPlusWnd, sControlId) {
var m = /^btnBread(\d)(Arrow)?$/.exec(sControlId);
if (m) {
//Collect the information from the RegExp
var nLevel = 1*m[1];
var bMenu = (m[2] !== "");
if (bMenu) {
/* Open the menu */
//Get the position for the menu
var BtnPos = GetWindowPos(pPlusWnd.GetControlHandle(sControlId) );
var Point = [BtnPos.Left + (_lang.IsRtl ? BtnPos.Width : 0), BtnPos.Top + BtnPos.Height ];
//Create the menu
var BreadcrumbMenu = new Menu(MenuCallback);
//Get the item at the left of the clicked arrow button
var sParent = objPrefTemp['Breadcrumb'][nLevel-2];
if (sParent === "Preferences") sParent = "PrefDashboard";
//Fill the menu with the childs of the menu
for (var i=0; i<objChildInfo[sParent].childs.length; i++) {
var child = objChildInfo[sParent].childs[i];
BreadcrumbMenu.AddMenuItem("Menu."+child, _lang.text['Breadcrumb_'+child] );
}
//Open the menu
BreadcrumbMenu.Open(Point, null, _lang.IsRtl );
} else {
/* Open the parent */
var ChildName = objPrefTemp['Breadcrumb'][nLevel-1];
if (ChildName === "Preferences") ChildName = "PrefDashboard";
Preferences_ShowChild(ChildName);
}
}
function MenuCallback(sId, Param) {
var m = /^Menu\.(.+)$/.exec(sId);
if (!m) return;
var ChildName = m[1];
Preferences_ShowChild(ChildName);
BreadcrumbMenu.Destroy();
}
}
function OnPreferencesEvent_Cancel(pPlusWnd) { return bIsFtpTesting; }
function OnPreferencesEvent_Destroyed(pPlusWnd, nExitCode) {
if (nExitCode !== 6) {
if (objPrefTemp['ChildOpen'] === 'PrefHkAddEdit') _hotkey.PauseHotkeyHandling(false);
objPrefTemp = {};
CloseWindow(pPlusWnd.WindowId);
return false;
}
}