Exemplo n.º 1
0
BOOL  CdIpmDoc::IsEnabledItemReplicationServerChangeNode()
{
	try
	{
		CTreeItem* pSelected = GetSelectedTreeItem();
		BOOL bEnable = pSelected? pSelected->IsEnabled(IDM_IPMBAR_REPLICSVR_CHANGERUNNODE): FALSE;
		return bEnable; 
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::IsEnabledItemReplicationServerChangeNode\n");
	}
	return FALSE;
}
Exemplo n.º 2
0
BOOL CdIpmDoc::IsEnabledItemCloseServer()
{
	try
	{
		CTreeItem* pSelected = GetSelectedTreeItem();
		BOOL bEnable = pSelected? pSelected->IsEnabled(IDM_IPMBAR_CLOSESVR): FALSE;
		return bEnable; 
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::IsEnabledItemCloseServer\n");
	}
	return FALSE;
}
Exemplo n.º 3
0
BOOL CdIpmDoc::ItemCloseServer()
{
	try
	{
		CTreeItem* pItem = GetSelectedTreeItem();
		if (pItem)
			return pItem->TreeCloseServer();
	}
	catch (CeIpmException e)
	{
		AfxMessageBox (e.GetReason(), MB_ICONEXCLAMATION|MB_OK);
	}
	catch (...)
	{
		TRACE0("Exception in: CdIpmDoc::ItemCloseServer\n");
	}
	return FALSE;
}
void EXTreeCtrl::OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
    if(m_bLDragging)
        return;

//	if( m_bSelectionWasInitializedByMyself )
//	{

    NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
    IXTreeItem* pItem = GetSelectedTreeItem();

    if (pItem)
    {
        if( m_pTreeListener != NULL )
        {
            m_pTreeListener->TreeNodeSelected(pItem);
        }
    }
//	}

    *pResult = 0;
}
void EXTreeCtrl::SelectDataItem(IXTreeItem *pITreeItem)
{
    if( pITreeItem==GetSelectedTreeItem() )	//dont select the same again!
    {
        return;
    }

//--------------

    // Create Parent list
    std::list<IXTreeItem *> lParents;
    std::list<IXTreeItem *>::iterator It, ItLast;

    if(pITreeItem == NULL)
    {
        SelectItem(NULL);
        return;
    }

    TRACE("parent-stack:\n");
    pITreeItem->GetParentList(lParents);

    TRACE("Found %i generations of parents to selected item\n",lParents.size());

    HTREEITEM hItem = GetRootItem();
    HTREEITEM hLastItem = hItem;
    It = lParents.begin();

    if( h2p(hItem)!=(*It) )		//root at top of parent stack!
    {
        SelectItem(0);
    }
    else
    {
        while( It!=lParents.end() )
        {
            //
            // current h must be the p in the parent list. if this is not the case, the
            // p reported a parent, that didn't list p as a child when expanding!
            //

            ASSERT( (*It) == h2p(hItem) );	//make sure parent lists all it's children!

            //
            // expand the node
            //

            TRACE( "expanding parent {%s}\n" , h2p(hItem)->GetLabel() );
            Expand(hItem,TVE_EXPAND);

            if( (*It)==pITreeItem )
            {
                break;
            }

            //
            // find the h of the child
            //

            It++;	//next generation...

            if( It!=lParents.end() )
            {
                IXTreeItem* pChild = *It;

                hItem = GetChildItem(hItem);	//search for the item that contains next ITreeItem

                while( hItem!=NULL )
                {
                    if( h2p(hItem)==pChild )
                    {
                        break;					//break search and continue treating this child as the next parent
                    }

                    hItem = GetNextSiblingItem(hItem);
                }
            }
        }

        if(hItem)
        {
            EnsureVisible(hItem);
            SelectItem(hItem);
        }
    }

}