Esempio n. 1
0
// Refresh -- redraws the tree starting at the specified node
void V4StudioTree::Refresh(GF_Node * node) 
{

	// check if we have to display the dictionnary or not
	if (parent->GetEditDict())
	  node = parent->GetV4SceneManager()->GetDictionnary();


	wxTreeItemId rootId = GetRootItem();
	CollapseAndReset(rootId);
	if (node) {
		AddNodesToItem(rootId, node, -1, -1);
		Expand(rootId);
	}
}
Esempio n. 2
0
void wxGxTreeViewBase::OnObjectChanged(wxGxCatalogEvent& event)
{
	wxTreeItemId TreeItemId = m_TreeMap[event.GetObjectID()];
	if(TreeItemId.IsOk())
	{
		wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(TreeItemId);
		if(pData != NULL)
		{
            wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
			IGxObjectUI* pGxObjectUI = dynamic_cast<IGxObjectUI*>(pGxObject);
			wxGxObjectContainer* pGxObjectContainer = dynamic_cast<wxGxObjectContainer*>(pGxObject);
            IGxObjectTreeAttr* pGxObjectAttr = dynamic_cast<IGxObjectTreeAttr*>(pGxObject);
			if(pGxObjectUI != NULL)
			{
                wxString sName;
                if(m_pCatalog->GetShowExt())
                    sName = pGxObject->GetName();
                else
                    sName = pGxObject->GetBaseName();

                if(pGxObjectAttr && pGxObjectAttr->ShowCount())
                {
                    sName.Append(wxString::Format(wxT(" [%d]"), pGxObjectAttr->GetCount()));
                }

				wxIcon icon = pGxObjectUI->GetSmallImage();

                int pos(wxNOT_FOUND);
				if(icon.IsOk())
                {
                    for(size_t i = 0; i < m_IconsArray.size(); ++i)
                    {
                        if(m_IconsArray[i].oIcon.IsSameAs(icon))
                        {
                            pos = m_IconsArray[i].iImageIndex;
                            break;
                        }
                    }
                    if(pos == wxNOT_FOUND)
                    {
                        pos = m_TreeImageList.Add(icon);
                        ICONDATA myicondata = {icon, pos};
                        m_IconsArray.push_back(myicondata);
                    }
                    SetItemImage(TreeItemId, pos);
					//m_TreeImageList.Replace(pData->m_smallimage_index, icon);
                }
				SetItemText(TreeItemId, sName);
				if(pGxObjectContainer != NULL)
				{
					wxBusyCursor wait;
					bool bItemHasChildren = pGxObjectContainer->HasChildren();
					if(ItemHasChildren(TreeItemId) && !bItemHasChildren)
					{						
						CollapseAndReset(TreeItemId);
						pData->m_bExpandedOnce = false;
                        UpdateGxSelection();
					}
					SetItemHasChildren(TreeItemId, bItemHasChildren && pGxObjectContainer->AreChildrenViewable());
				}
                
                if(pGxObjectAttr)
                {
                    SetItemBold(TreeItemId, pGxObjectAttr->IsBold());
                    SetItemTextColour(TreeItemId, pGxObjectAttr->GetColor());                    
                }
				//wxTreeCtrl::Refresh();
			}
		}
	}
}