nsresult
XULContentSinkImpl::ContextStack::GetTopNodeScriptType(PRUint32 *aScriptType)
{
    if (mDepth == 0)
        return NS_ERROR_UNEXPECTED;

    // This would be much simpler if nsXULPrototypeNode itself
    // stored the language ID - but text elements don't need it!
    nsresult rv = NS_OK;
    nsRefPtr<nsXULPrototypeNode> node;
    rv = GetTopNode(node);
    if (NS_FAILED(rv)) return rv;
    switch (node->mType) {
        case nsXULPrototypeNode::eType_Element: {
            nsXULPrototypeElement *parent =
                reinterpret_cast<nsXULPrototypeElement*>(node.get());
            *aScriptType = nsIProgrammingLanguage::JAVASCRIPT;
            break;
        }
        case nsXULPrototypeNode::eType_Script: {
            nsXULPrototypeScript *parent =
                reinterpret_cast<nsXULPrototypeScript*>(node.get());
            *aScriptType = parent->mScriptObject.mLangID;
            break;
        }
        default: {
            NS_WARNING("Unexpected parent node type");
            rv = NS_ERROR_UNEXPECTED;
        }
    }
    return rv;
}
예제 #2
0
void wxTreeLayout::DrawNodes(wxDC& dc)
{
    long id = GetTopNode();
    while (id != wxID_ANY)
    {
        if (NodeActive(id))
            DrawNode(id, dc);
        id = GetNextNode(id);
    }
}
예제 #3
0
void wxTreeLayoutStored::GetChildren(long id, wxList& list)
{
    long currentId = GetTopNode();
    while (currentId != wxID_ANY)
    {
        if (id == GetNodeParent(currentId))
            list.Append((wxObject *)currentId);
        currentId = GetNextNode(currentId);
    }
}
예제 #4
0
void wxTreeLayout::DrawBranches(wxDC& dc)
{
    long id = GetTopNode();
    while (id != wxID_ANY)
    {
        if (GetNodeParent(id) != wxID_ANY)
        {
            long parent = GetNodeParent(id);
            if (NodeActive(parent))
                DrawBranch(parent, id, dc);
        }
        id = GetNextNode(id);
    }
}
예제 #5
0
void wxTreeLayout::DoLayout(wxDC& dc, long topId)
{
    if (topId != wxID_ANY)
        SetTopNode(topId);

    long actualTopId = GetTopNode();
    long id = actualTopId;
    while (id != wxID_ANY)
    {
        SetNodeX(id, 0);
        SetNodeY(id, 0);
        ActivateNode(id, false);
        id = GetNextNode(id);
    }
    m_lastY = m_topMargin;
    m_lastX = m_leftMargin;
    CalcLayout(actualTopId, 0, dc);
}