/* ALPFrame JScript helper routines and constants. This file is a JScript/JavaScript file intended for use in DHTML pages viewed in ALPFrame utility. It must be included using a SCRIPT tag with SRC attribute before any other script includes related to ALPFrame. It contain: Constants used with the members provided by the ALPFrame host Frame Window style flags Frame Window extended style flags Window presence constants (ShowWindow) Z-oreder constants Menu item type constants System color constants Routines for easy usage of menu resources. */ // Window styles // Use with: // external.wndStyle // external.setWndStyleFlags // external.resetWndStyleFlags var WS_OVERLAPPED = 0x00000000, WS_POPUP = 0x80000000, WS_CHILD = 0x40000000, WS_MINIMIZE = 0x20000000, WS_VISIBLE = 0x10000000, WS_DISABLED = 0x08000000, WS_CLIPSIBLINGS = 0x04000000, WS_CLIPCHILDREN = 0x02000000, WS_MAXIMIZE = 0x01000000, WS_CAPTION = 0x00C00000, WS_BORDER = 0x00800000, WS_DLGFRAME = 0x00400000, WS_VSCROLL = 0x00200000, WS_HSCROLL = 0x00100000, WS_SYSMENU = 0x00080000, WS_THICKFRAME = 0x00040000, WS_GROUP = 0x00020000, WS_TABSTOP = 0x00010000, WS_MINIMIZEBOX = 0x00020000, WS_MAXIMIZEBOX = 0x00010000; // Substitutions and combinations var WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, WS_TILED = WS_OVERLAPPED, WS_ICONIC = WS_MINIMIZE, WS_SIZEBOX = WS_THICKFRAME, WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW, WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU, WS_CHILDWINDOW = WS_CHILD; // Window extended styles // Use with: // external.wndStyleEx // external.setWndStyleExFlags // external.resetWndStyleExFlags var WS_EX_DLGMODALFRAME = 0x00000001, WS_EX_NOPARENTNOTIFY = 0x00000004, WS_EX_TOPMOST = 0x00000008, WS_EX_ACCEPTFILES = 0x00000010, WS_EX_TRANSPARENT = 0x00000020, WS_EX_MDICHILD = 0x00000040, WS_EX_TOOLWINDOW = 0x00000080, WS_EX_WINDOWEDGE = 0x00000100, WS_EX_CLIENTEDGE = 0x00000200, WS_EX_CONTEXTHELP = 0x00000400, WS_EX_RIGHT = 0x00001000, WS_EX_LEFT = 0x00000000, WS_EX_RTLREADING = 0x00002000, WS_EX_LTRREADING = 0x00000000, WS_EX_LEFTSCROLLBAR = 0x00004000, WS_EX_RIGHTSCROLLBAR = 0x00000000, WS_EX_CONTROLPARENT = 0x00010000, WS_EX_STATICEDGE = 0x00020000, WS_EX_APPWINDOW = 0x00040000; // Substitutions and combinations var WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST; // Window presence (ShowWindow) constants // Use with: // external.windowPresence var SW_HIDE = 0, SW_SHOWNORMAL = 1, SW_NORMAL = 1, SW_SHOWMINIMIZED = 2, SW_SHOWMAXIMIZED = 3, SW_MAXIMIZE = 3, SW_SHOWNOACTIVATE = 4, SW_SHOW = 5, SW_MINIMIZE = 6, SW_SHOWMINNOACTIVE = 7, SW_SHOWNA = 8, SW_RESTORE = 9, SW_SHOWDEFAULT = 10, SW_FORCEMINIMIZE = 11, SW_MAX = 11; // zOrder constants // Use with: // external.zOrder var ZORDER_TOBACK = -1, ZORDER_NORMAL = 0, ZORDER_TOFRONT = 1, ZORDER_TOPMOST = 2; // Menu type constants - to be used in the resource files (VarioMenuItem.Type property) var mitNormal = 1; // Ordinary menu item var mitSeparator = 2; // Separator var mitCheckable = 3; // Menu item with a 'tick' mark var mitRadioGroup = 4; // Special menu item, holder of a radio group var mitGroupMember = 5; // Member of a radio group // System colors - to be used with sysColor var CTLCOLOR_MSGBOX = 0, CTLCOLOR_EDIT = 1, CTLCOLOR_LISTBOX = 2, CTLCOLOR_BTN = 3, CTLCOLOR_DLG = 4, CTLCOLOR_SCROLLBAR = 5, CTLCOLOR_STATIC = 6, CTLCOLOR_MAX = 7, COLOR_SCROLLBAR = 0, COLOR_BACKGROUND = 1, COLOR_ACTIVECAPTION = 2, COLOR_INACTIVECAPTION = 3, COLOR_MENU = 4, COLOR_WINDOW = 5, COLOR_WINDOWFRAME = 6, COLOR_MENUTEXT = 7, COLOR_WINDOWTEXT = 8, COLOR_CAPTIONTEXT = 9, COLOR_ACTIVEBORDER = 10, COLOR_INACTIVEBORDER = 11, COLOR_APPWORKSPACE = 12, COLOR_HIGHLIGHT = 13, COLOR_HIGHLIGHTTEXT = 14, COLOR_BTNFACE = 15, COLOR_BTNSHADOW = 16, COLOR_GRAYTEXT = 17, COLOR_BTNTEXT = 18, COLOR_INACTIVECAPTIONTEXT = 19, COLOR_BTNHIGHLIGHT = 20, COLOR_3DDKSHADOW = 21, COLOR_3DLIGHT = 22, COLOR_INFOTEXT = 23, COLOR_INFOBK = 24, COLOR_HOTLIGHT = 26, COLOR_GRADIENTACTIVECAPTION = 27, COLOR_GRADIENTINACTIVECAPTION = 28; var COLOR_DESKTOP = COLOR_BACKGROUND; var COLOR_3DFACE = COLOR_BTNFACE; var COLOR_3DSHADOW = COLOR_BTNSHADOW; var COLOR_3DHIGHLIGHT = COLOR_BTNHIGHLIGHT; var COLOR_3DHILIGHT = COLOR_BTNHIGHLIGHT; var COLOR_BTNHILIGHT = COLOR_BTNHIGHLIGHT; // Menu construction routines // See the samples and documentation for more information. var popupMenus = null; function ClearAllMenus() { window.external.MainMenu = null; window.external.Menus.MenuTree.Subs.Clear(); window.external.PopupMenuHandlerNamespace = ""; window.external.PopupMenuHandler = ""; window.external.InitMenuHandlerNamespace = ""; window.external.InitMenuHandler = ""; window.external.MenuSelectHandlerNamespace = ""; window.external.MenuSelectHandler = ""; } function LoadMainMenuFromResource(res) { var menu = ((res == null)?_mainMenu:res); if (typeof(menu) == "object") { var mainMnu = window.external.Menus.MenuTree.CreateSubItem("MainMenu"); CreateMenuBranchOn(menu,mainMnu); return mainMnu; } else { return null; } } function LoadPopupMenuFromResource(res) { if (res == null) return null; if (popupMenus == null) { popupMenus = window.external.Menus.MenuTree.CreateSubItem("Popups"); } var p = popupMenus.CreateSubItem(res.Name); CreateMenuBranchOn(res,p); return p; } function ShowHideMainMenu(mainMnu) { window.external.MainMenu = mainMnu; } function CreateMenuBranchOn(rsrc,node) { if (typeof(rsrc) != "object" || typeof(node) != "object") return false; if (typeof(rsrc.Items) != "object") return false; var resfrom = rsrc.Items; var el,i; var item,j; for (el in resfrom) { i = resfrom[el]; if (typeof(i.ReferTo) == "object") { if (i.ReferTo.length > 0) { item = external.Menus.MenuTree.Subs; for (j = 0; j < i.ReferTo.length; j++) { item = item(i.ReferTo[j]); } node.Subs.Add(i.Name,item); } } else { item = node.CreateSubItem(i.Name); item.Caption = i.Caption; if (i.IsPopup || i.Type == mitRadioGroup) { if (i.Type == mitRadioGroup) item.Type = i.Type; CreateMenuBranchOn(i,item); } else { if (node.Type != mitRadioGroup) { item.Type = i.Type; } else { if (typeof(i.Autocheck) != "undefined") { item.AutoCheck = i.Autocheck; } } item.HandlerNamespace = i.Frame; item.Handler = i.Handler; item.Info = i.Info; if (typeof(i.Accel) == "object") { item.Accelerator.Ctrl = i.Accel.Ctrl; item.Accelerator.Shift = i.Accel.Shift; item.Accelerator.Alt = i.Accel.Alt; item.Accelerator.Key = i.Accel.Key; } } } } return true; }