示例#1
0
/*!
 *
 */
void CNutConfDoc::AddChildItems(NUTCOMPONENT * compo, wxTreeItemId parent)
{
    CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl();

    if(compo) {
        compo = compo->nc_child;
        while (compo) {
            CConfigItem *item = new CConfigItem(NULL, compo);

            wxTreeItemId childId = treeCtrl->AppendItem(parent, wxT(""), -1, -1, new CTreeItemData(item));
            item->SetTreeItem(childId);
            item->UpdateTreeItem(*treeCtrl);
            m_items.Append(item);


            NUTCOMPONENTOPTION *opts = compo->nc_opts;
            while (opts) {
                item = new CConfigItem(item, opts);
                wxTreeItemId optId = treeCtrl->AppendItem(childId, wxT(""), -1, -1, new CTreeItemData(item));
                item->SetTreeItem(optId);
                item->UpdateTreeItem(*treeCtrl);
                m_items.Append(item);
                opts = opts->nco_nxt;
            }

            AddChildItems(compo, childId);
            compo = compo->nc_nxt;
        }
    }
}
示例#2
0
/*!
 * \brief Create all configuration items.
 */
void CNutConfDoc::AddAllItems()
{
    CConfigTree *treeCtrl = wxGetApp().GetMainFrame()->GetTreeCtrl();

    wxGetApp().GetMainFrame()->GetPropertyListWindow()->Fill(NULL);

    treeCtrl->DeleteAllItems();

    CConfigItem *item = new CConfigItem();
    wxTreeItemId rootId = treeCtrl->AddRoot(wxT(""), -1, -1, new CTreeItemData(item));

    item->SetTreeItem(rootId);
    item->UpdateTreeItem(*treeCtrl);
    m_items.Append(item);

    AddChildItems(m_root, rootId);

    UpdateAllViews();

    if (GetItems().GetCount() > 0) {
        wxGetApp().GetMainFrame()->GetTreeCtrl()->Expand(rootId);
    }
    wxGetApp().GetMainFrame()->GetTreeCtrl()->SetFocus();
}