Exemplo n.º 1
0
wxTreeListItem
wxTreeListCtrl::GetNextSibling(wxTreeListItem item) const
{
    wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" );

    return item->GetNext();
}
Exemplo n.º 2
0
void wxTreeListCtrl::UpdateItemParentStateRecursively(wxTreeListItem item)
{
    wxCHECK_RET( item.IsOk(), "Invalid item" );

    wxASSERT_MSG( HasFlag(wxTL_3STATE), "Can only be used with wxTL_3STATE" );

    for ( ;; )
    {
        wxTreeListItem parent = GetItemParent(item);
        if ( parent == GetRootItem() )
        {
            // There is no checked state associated with the root item.
            return;
        }

        // Set parent state to the state of this item if all the other children
        // have the same state too. Otherwise make it indeterminate.
        const wxCheckBoxState stateItem = GetCheckedState(item);
        CheckItem(parent, AreAllChildrenInState(parent, stateItem)
                            ? stateItem
                            : wxCHK_UNDETERMINED);

        // And do the same thing with the parent's parent too.
        item = parent;
    }
}
Exemplo n.º 3
0
bool
wxTreeListCtrl::AreAllChildrenInState(wxTreeListItem item,
                                      wxCheckBoxState state) const
{
    wxCHECK_MSG( item.IsOk(), false, "Invalid item" );

    for ( wxTreeListItem child = GetFirstChild(item);
          child.IsOk();
          child = GetNextSibling(child) )
    {
        if ( GetCheckedState(child) != state )
            return false;
    }

    return true;
}
Exemplo n.º 4
0
wxTreeListItem
TreeListCtrlTestCase::AddItem(const char *label,
                              wxTreeListItem parent,
                              const char *numFiles,
                              const char *size)
{
    if ( !parent.IsOk() )
        parent = m_treelist->GetRootItem();

    wxTreeListItem item = m_treelist->AppendItem(parent, label);
    m_treelist->SetItemText(item, 1, numFiles);
    m_treelist->SetItemText(item, 2, size);

    m_numItems++;

    return item;
}
Exemplo n.º 5
0
int expandtree(wxTreeListCtrl* tree, wxTreeListItem& item, bool expand, int depth)
{
	if (!item.IsOk())
		return depth;

	if (expand)
		tree->Expand(item);

	// Expand first sibling
	wxTreeListItem sibling = tree->GetNextSibling(item);
	expandtree(tree, sibling, expand, depth);

	// Expand first child
	wxTreeListItem child = tree->GetFirstChild(item);
	depth = expandtree(tree, child, expand, depth + 1);

	if (!expand)
		tree->Collapse(item);

	return depth;
}
Exemplo n.º 6
0
wxCheckBoxState wxTreeListCtrl::GetCheckedState(wxTreeListItem item) const
{
    wxCHECK_MSG( item.IsOk(), wxCHK_UNDETERMINED, "Invalid item" );

    return item->m_checkedState;
}
Exemplo n.º 7
0
wxTreeListItem wxTreeListCtrl::GetFirstChild(wxTreeListItem item) const
{
    wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" );

    return item->GetChild();
}
Exemplo n.º 8
0
wxTreeListItem wxTreeListCtrl::GetItemParent(wxTreeListItem item) const
{
    wxCHECK_MSG( item.IsOk(), wxTreeListItem(), "Invalid item" );

    return item->GetParent();
}
Exemplo n.º 9
0
wxString MyFrame::DumpItem(wxTreeListItem item) const
{
    return item.IsOk() ? m_treelist->GetItemText(item) : wxString("NONE");
}