Пример #1
0
void CTreeViewEx::onUpdateExecute(CCmdUI* pCmdUI) 
{   
    if(GetExecutorWindow() != NULL)
    {
        pCmdUI->Enable(GetExecutorWindow()->bGetBusStatus());
    }
}
Пример #2
0
void CTreeViewEx::DragEnd() 
{
 	eTYPE_DROPPING eDropping;
	HTREEITEM hDroppingItem = GetDropItem(eDropping);
    
    if (hDroppingItem == NULL)
    {
        return;
    }
    CTreeCtrl& omTempTreeCtrl = GetTreeCtrl();
    UINT unFirstIndex = unGetIndex(m_hDraggingItemgedItem);
    HTREEITEM hInsertAfter = DragMoveItem(m_hDraggingItemgedItem, hDroppingItem, eDropping);
    if(hInsertAfter == NULL)
    {
        return;
    }
    DWORD_PTR dwRepositionItemID = omTempTreeCtrl.GetItemData(m_hDraggingItemgedItem);
    DWORD_PTR dwInsertAfterItemID;
    if(hInsertAfter == TVI_FIRST)
    {
        dwInsertAfterItemID = (DWORD)-1;
    }
    else
    {
        dwInsertAfterItemID = omTempTreeCtrl.GetItemData(hInsertAfter);
    }
    
    UINT unNewID = GetExecutorWindow()->unRepisitonEntry((DWORD)dwRepositionItemID, (DWORD)dwInsertAfterItemID);
    //omTempTreeCtrl.SetItemData(m_hDraggingItemgedItem, unNewID);

}
Пример #3
0
void CTreeViewEx::OnTvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
{
    LPNMTVDISPINFO pTVDispInfo = reinterpret_cast<LPNMTVDISPINFO>(pNMHDR);
    LPTSTR pszText = pTVDispInfo->item.pszText;
    *pResult = ( pszText && (*pszText != _T('\0')));
    CString omstrItemNewName(pszText);
    if(GetTreeCtrl().GetItemData(pTVDispInfo->item.hItem) == def_ID_TESTSUITE)  //Just Confirm
    {
        GetExecutorWindow()->m_ouTSExecutor.SetTestsuiteName(omstrItemNewName);
    }
    m_bEditing = FALSE;
}
Пример #4
0
void CTreeViewEx::OnNMRclick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
    CPoint point;
    GetCursorPos(&point);
    CPoint omCurrentPoint(point);
    ScreenToClient(&omCurrentPoint);
    UINT flags;
    HTREEITEM hItem = GetTreeCtrl().HitTest(omCurrentPoint, &flags);
    CTreeCtrl& omTempTreeCtrl = GetTreeCtrl();

    if(hItem && (flags & TVHT_ONITEM) && !(flags & TVHT_ONITEMRIGHT))
    {
        omTempTreeCtrl.SelectItem(hItem);
        CMenu omContextMenu;
        VERIFY(omContextMenu.CreatePopupMenu());

        if(omTempTreeCtrl.GetItemData(hItem) == def_ID_TESTSUITE)
        {
            VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSUITE_ADD, _T("Add...")));

            if(GetExecutorWindow()->bGetBusStatus() == TRUE)
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSUITE_EXECUTE, _T("Execute")));
            }
            else
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING|MF_GRAYED, IDM_TESTSUITE_EXECUTE, _T("Execute")));
            }
        }
        else
        {
            HTREEITEM hParentItem = omTempTreeCtrl.GetParentItem(hItem);

            if(omTempTreeCtrl.GetItemData(hParentItem) == def_ID_TESTSUITE)
            {
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSETUP_DELETE, _T("Delete")));
                VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_TESTSETUP_MODIFY, _T("Modify...")));
            }
        }

        omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        *pResult = 0;
    }
    else        //On Tree View Create Collapse All and Expand All
    {
        CMenu omContextMenu;
        VERIFY(omContextMenu.CreatePopupMenu());
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_COLLAPSE_ALL, _T("Collapse All")));
        VERIFY(omContextMenu.AppendMenu(MF_STRING, IDM_EXPAND_ALL, _T("Expand All")));
        omContextMenu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
        *pResult = 0;
    }
}
Пример #5
0
void CTreeViewEx::vSetCheck(HTREEITEM hItem, BOOL bCheck)
{
    if(hItem == NULL)
    {
        return;
    }
	if (hItem != NULL)
	{
        int nState = (bCheck == TRUE) ? 2 : 1;
        GetTreeCtrl().SetItemState( hItem, INDEXTOSTATEIMAGEMASK(nState), TVIS_STATEIMAGEMASK );
        GetExecutorWindow()->vEnableItem((DWORD)GetTreeCtrl().GetItemData(hItem), bCheck);
	}
	return;
}
Пример #6
0
void CTreeViewEx::OnTvnKeyPress(NMHDR* pNMHDR, LRESULT* pResult)
{
    TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR;

    CTreeCtrl& omTreeCtrl = GetTreeCtrl();
    HTREEITEM hItem = omTreeCtrl.GetSelectedItem();

    if((NULL != pTVKeyDown) && (NULL != hItem) && (pTVKeyDown->wVKey == VK_SPACE))
    {
        BOOL bCheck = bIsItemChecked(hItem);
        bCheck = !bCheck ;
        GetExecutorWindow()->vEnableItem((DWORD)GetTreeCtrl().GetItemData(hItem), bCheck);
    }
}
Пример #7
0
void CTreeViewEx::OnCommandRange(UINT unCommandID)
{
    CTSExecutorChildFrame *ouExecutorWnd = GetExecutorWindow();
    if(ouExecutorWnd != NULL)
    {
        CTreeCtrl &omTempTreeCtrl = GetTreeCtrl();
        HTREEITEM hSelectedItem = omTempTreeCtrl.GetSelectedItem();
        DWORD_PTR dwID = omTempTreeCtrl.GetItemData(hSelectedItem);
        HRESULT hResult = (HRESULT)ouExecutorWnd->SendMessage(unCommandID, dwID, 0);
        if(unCommandID == IDM_TESTSETUP_DELETE && hResult == S_OK)
        {
            omTempTreeCtrl.DeleteItem(hSelectedItem);
        }
    }
}