⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toolbar.htc

📁 浏览器端看到树型目录结构,用户可以完整地看到像windows资源管理器一样的效果
💻 HTC
📖 第 1 页 / 共 5 页
字号:
        case "move-dock":
        case "":
            _Movement = lVal;
            break;
        case "none":
            _Movement = "";
            break;
        }
    }

    if (_Ready && (szOrig != _Movement))
    {
        if (f_IsMoveable())
        {
            defaults.style.position = "absolute";
            defaults.style.zIndex = "1";
            defaults.style.overflow = "hidden";
        }
        else
        {
            defaults.style.position = "static";
            defaults.style.zIndex = "";
            defaults.style.overflow = "visible";
        }
        prMovement.fireChange();
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_IsMoveable
//  Description:    Returns whether the toolbar is moveable.
//  Returns:        true if moveable, false otherwise.
//-----------------------------------------------------------------------------
function f_IsMoveable()
{
    switch (_Movement)
    {
    case "move":
    case "move-dock":
        return true;
    }

    return false;
}

//+----------------------------------------------------------------------------
//  Function:       f_IsDockable
//  Description:    Returns whether the toolbar is dockable.
//  Returns:        true if dockable, false otherwise.
//-----------------------------------------------------------------------------
function f_IsDockable()
{
    return (_Movement == "move-dock");
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicCreateXXXAt
//  Description:    Creates a item (of type XXX) at the specified index
//  Returns:        Returns the contract item.
//-----------------------------------------------------------------------------
function f_PublicCreateLabelAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarLabel />");
}

function f_PublicCreateButtonAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarButton />");
}

function f_PublicCreateCheckButtonAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarCheckButton />");
}

function f_PublicCreateSeparatorAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarSeparator />");
}

function f_PublicCreateGripperAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarGripper />");
}

function f_PublicCreateDropDownListAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarDropDownList />");
}

function f_PublicCreateTextBoxAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarTextBox />");
}

function f_PublicCreateCheckGroupAt(index)
{
    return f_AddItemAt(index, "<ie:ToolbarCheckGroup />");
}

//+----------------------------------------------------------------------------
//  Function:       f_AddItemAt
//  Description:    Adds a toolbaritem to the toolbar.
//  Parameters:     index       Where to add the item [0...numItems]
//                  html        Html text used to create the item.
//  Returns:        The item or null
//-----------------------------------------------------------------------------
function f_AddItemAt(index, html)
{
    var numItems = f_NumItems();
    var realIndex = f_PublicToRealIndex(index);
    if ((realIndex < 0) || (realIndex > numItems))
    {
        realIndex = numItems;
        index = f_PublicGetCount();
    }

    f_AddItemAtRealIndex(realIndex, html);

    return f_PublicGetItem(index);
}

//+----------------------------------------------------------------------------
//  Function:       f_AddItemToGroupAt
//  Description:    Adds an item to a group
//-----------------------------------------------------------------------------
function f_AddItemToGroupAt(index, group, publicGroup)
{
    var parent = f_GetParent();
    if (parent == null)
        return null;

    var numInGroup = publicGroup.getCount();
    if ((index < 0) || (index > numInGroup))
        index = numInGroup;

    var realIndex = 0;
    var cell;
    var foundGroup = false;
    for (realIndex = 0; realIndex < parent.children.length; realIndex++)
    {
        cell = parent.children[realIndex];
        if ((orientation == "vertical") && (cell.children.length > 0))
            cell = cell.children[0];

        if (((cell._type == "checkbutton") || (cell._type == "emptygroup")) &&
            (cell._group != null))
        {
            if (group == cell._group)
            {
                foundGroup = true;
                break;
            }
        }
    }

    if (!foundGroup)
        return null;

    var selectItem = false;
    if (cell._type == "emptygroup")
    {
        if (orientation == "vertical")
            cell = cell.parentElement;
        cell.removeNode(true);
        selectItem = group.bForceSel;
    }

    var newIndex = realIndex + index;
    var newItem = f_AddItemAtRealIndex(newIndex, "<ie:ToolbarCheckButton />");
    newItem._group = group;
    newItem.id = newItem.uniqueID;

    var publicNewItem = publicGroup.getItem(index);;
    if (selectItem && (publicNewItem != null))
        publicNewItem.setAttribute("selected", "true");

    return publicNewItem;
}

//+----------------------------------------------------------------------------
//  Function:       f_AddItemAtRealIndex
//  Description:    Adds an item given a real (internal) index.
//-----------------------------------------------------------------------------
function f_AddItemAtRealIndex(index, html)
{
    var parent = f_GetParent();
    if (parent == null)
        return null;

    // Create the toolbaritem from the Html text
    var aNodes = f_CreateNodesFromHtml(html);
    if ((aNodes == null) || (aNodes.length < 1))
        return null;

    // Adjust for vertical toolbars
    var cell = aNodes[0];
    var retCell = cell;
    if (orientation == "vertical")
    {
        var trRow = element.document.createElement("TR");
        if (cell._type == "emptygroup")
            trRow.style.display = "none";
        trRow.appendChild(cell);
        cell = trRow;
    }

    if (index == f_NumItems())
    {
        // If the location is beyond the last item, then append the item.
        parent.appendChild(cell);
    }
    else
    {
        // The new item is being placed before an existing item.
        parent.children[index].insertAdjacentElement("beforeBegin", cell);
    }

    f_ApplyStylesToChildren();

    return retCell;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicToRealIndex
//  Description:    Converts a public index to a real index.
//-----------------------------------------------------------------------------
function f_PublicToRealIndex(index)
{
    var parent = f_GetParent();
    if ((parent == null) || (parent.children.length == 0))
        return -1;

    var curIndex = -1;
    var realIndex;
    var cell;
    var group = null;
    for (realIndex = 0; realIndex < parent.children.length; realIndex++)
    {
        cell = parent.children[realIndex];
        if ((orientation == "vertical") && (cell.children.length > 0))
            cell = cell.children[0];

        if (((cell._type == "checkbutton") || (cell._type == "emptygroup")) && 
            (cell._group != null))
        {
            if (group != cell._group)
            {
                curIndex++;
                group = cell._group;
            }
        }
        else
        {
            group = null;
            curIndex++;
        }

        if (curIndex == index)
            return realIndex;
    }

    return -1;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetCount
//  Description:    Returns the number of top-level items (checkgroups are 1)
//  Returns:        The number of items
//-----------------------------------------------------------------------------
function f_PublicGetCount()
{
    var parent = f_GetParent();
    if ((parent == null) || (parent.children.length == 0))
        return 0;

    var numItems = 0;
    var realIndex;
    var cell;
    var group = null;
    for (realIndex = 0; realIndex < parent.children.length; realIndex++)
    {
        cell = parent.children[realIndex];
        if ((orientation == "vertical") && (cell.children.length > 0))
            cell = cell.children[0];

        if (((cell._type == "checkbutton") || (cell._type == "emptygroup")) && 
            (cell._group != null))
        {
            if (group != cell._group)
            {
                numItems++;
                group = cell._group;
            }
        }
        else
        {
            group = null;
            numItems++;
        }
    }

    return (numItems < 0) ? 0 : numItems;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetItem
//  Description:    Retrieves a public "contract" item representing an item
//  Parameters:     index   Index of the item
//  Returns:        The item or null
//-----------------------------------------------------------------------------
function f_PublicGetItem(index)
{
    if ((index < 0) || (index > f_NumItems()))
        return null;
        
    var realIndex = f_PublicToRealIndex(index);
    var item = f_GetItem(realIndex);
    if (item == null)
        return null;

    if (((item._type == "checkbutton") || (item._type == "emptygroup")) && (item._group != null))
        return f_PublicMakeGroupContract(item);
    else
        return f_PublicMakeContract(item);
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicMakeContract
//  Description:    Makes a contract object out of the given item
//  Parameters:     item    The item
//  Returns:        The contract item
//-----------------------------------------------------------------------------
function f_PublicMakeContract(item)
{
    var obj = new Object();

    obj.getType = function() { return item._type; };
    if ((item._type == "dropdownlist") || (item._type == "textbox"))
    {
        obj.click = function() { item.children[0].click(); };
        obj.focus = function() { item.children[0].focus(); };
        obj.blur = function() { item.children[0].blur(); };
    }
    else
    {
        obj.click = function() { item.click(); };
        obj.focus = function() { item.focus(); };
        obj.blur = function() { item.blur(); };
    }
    obj.remove = function() { f_PublicRemoveItem(item); };
    obj.getAttribute = function(name) { return f_PublicGetAttribute(item, name); };
    obj.setAttribute = function(name, value) { f_PublicSetAttribute(item, name, value); };

    if (item._type == "dropdownlist")
        obj.getOptions = function() { return item.children[0].options; };

    return obj;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicMakeGroupContract
//  Description:    Makes a contract object for the group in the item
//  Parameters:     item    The item
//  Returns:        The contract item
//-----------------------------------------------------------------------------
function f_PublicMakeGroupContract(item)
{
    var obj = new Object();

    obj.getType = function() { return "checkgroup"; };
    obj.getItem = function(subIndex) { return f_PublicGetGroupItem(subIndex, item._group); };
    obj.getSelected = function() { var selItem = _oTable.document.all[item._group.oSelected]; if (selItem != null) return f_PublicMakeContract(selItem); else return null; };
    obj.getAttribute = function(name) { return f_PublicGetGroupAttribute(item._group, name); };
    obj.setAttribute = function(name, value) { f_PublicSetGroupAttribute(item._group, name, value); };
    obj.remove = function() { f_PublicRemoveGroup(item._group); };
    obj.getCount = function() { return f_PublicGetGroupCount(item._group); };
    obj.createCheckButtonAt = function(subIndex) { return f_AddItemToGroupAt(subIndex, item._group, obj); };

    return obj;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetGroupCount
//  Description:    Returns the number of items in the group.
//-----------------------------------------------------------------------------
function f_PublicGetGroupCount(group)
{
    var parent = f_GetParent();
    if (parent == null)
        return 0;

    var realIndex = 0;
    var count = 0;
    var cell;
    var foundGroup = false;
    for (realIndex = 0; realIndex < parent.children.length; realIndex++)
    {
        cell = parent.children[realIndex];
        if ((orientation == "vertical") && (cell.children.length > 0))
            cell = cell.children[0];

        if (((cell._type == "checkbutton") || (cell._type == "emptygroup")) && 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -