コード例 #1
0
void CXTPReportInplaceList::Apply()
{
	if (!pControl)
		return;

	CXTPReportControl* pReportControl = pControl;

	int nIndex = GetCurSel();
	if (nIndex != LB_ERR)
	{
		m_bApply = TRUE;

		CXTPReportRecordItemConstraint* pConstraint = (CXTPReportRecordItemConstraint*)GetItemDataPtr(nIndex);

		XTP_REPORTRECORDITEM_ARGS itemArgs = *((XTP_REPORTRECORDITEM_ARGS*)this);
		itemArgs.AddRef();

		pItem->OnConstraintChanged(&itemArgs, pConstraint);
		pReportControl->RedrawControl();

		pReportControl->SendMessageToParent(itemArgs.pRow, itemArgs.pItem, itemArgs.pColumn, XTP_NM_REPORT_VALUECHANGED, 0);

		itemArgs.Release();
	}

	pReportControl->SetFocus();
}
コード例 #2
0
void CXTPReportHeaderDragWnd::OnTimer(UINT_PTR nIDEvent)
{
	UNREFERENCED_PARAMETER(nIDEvent);

	if (!m_pHeader || !m_pHeader->GetControl())
	{
		return;
	}
	CXTPReportControl* pControl = m_pHeader->GetControl();

	ASSERT(pControl->m_bHScrollBarVisible);

	CRect rcHeaderScreen = m_pHeader->m_rcHeader;
	pControl->ClientToScreen(&rcHeaderScreen);

	CRect rcControlScreen(0,0,0,0);
	CRect rcDragScreen(0,0,0,0);

	pControl->GetWindowRect(&rcControlScreen);
	GetWindowRect(&rcDragScreen);


	CPoint ptMouseScreen(0, 0);
	if (!GetCursorPos(&ptMouseScreen) ||
		ptMouseScreen.y < rcHeaderScreen.top || ptMouseScreen.y > rcHeaderScreen.bottom)
	{
		return;
	}

	BOOL bScrolled = FALSE;
	BOOL bLayoutRTL = pControl->GetExStyle() & WS_EX_LAYOUTRTL;

	int nDiffRight = bLayoutRTL ? rcControlScreen.left - rcDragScreen.left :
		rcDragScreen.right - rcControlScreen.right;

	//-----------------------------------------------------------------------
	CXTPReportColumn *pPrev = NULL, *pCurr = NULL, *pNext = NULL;
	int nScrollPos = 0, nScrollMax = 0;
	int nFreezOffset = 0;
	BOOL bFullColumnScrolling = pControl->IsFullColumnScrolling();
	if (bFullColumnScrolling)
		nFreezOffset = m_pHeader->GetFulColScrollInfo(pPrev, pCurr, pNext, nScrollPos, nScrollMax);
	//-----------------------------------------------------------------------

	if (nDiffRight > 0)
	{
		int nStep = max(min(7, nDiffRight/10), CXTPReportHeader::s_nMinAutoScrollStep);
		UINT uTimer = bFullColumnScrolling ? max(30, 800 - nDiffRight * 10) : max(10, 100 - nDiffRight);
		SCROLLINFO scrollInfo;

		BOOL bRes = pControl->GetScrollInfo(SB_HORZ, &scrollInfo);
		if (bRes)
		{
			if (!bFullColumnScrolling && scrollInfo.nPos < scrollInfo.nMax ||
				bFullColumnScrolling && nScrollPos < nScrollMax)
			{
				if (bFullColumnScrolling)
					pControl->SendMessage(WM_HSCROLL, SB_LINERIGHT);
				else
					pControl->SetLeftOffset(scrollInfo.nPos + nStep);

				KillTimer(1);
				SetTimer(1, uTimer, NULL);
				bScrolled = TRUE;
			}
		}
	}
	else
	{
		int nLeftBorderX = bLayoutRTL ? rcControlScreen.right : rcControlScreen.left;

		int nFreezCols = pControl->GetFreezeColumnsCount();
		if (nFreezCols && pControl->GetColumns())
		{
			CXTPReportColumn* pLastFCol = pControl->GetColumns()->GetVisibleAt(nFreezCols - 1);
			if (pLastFCol)
			{
				CRect rcLastFCol = pLastFCol->GetRect();
				pControl->ClientToScreen(&rcLastFCol);

				int nLastFCol_middleX = rcLastFCol.left + rcLastFCol.Width() / 2;
				if (rcDragScreen.left < rcLastFCol.right &&
					ptMouseScreen.x > nLastFCol_middleX )
				{
					nLeftBorderX = rcLastFCol.right;
				}
			}
		}

		int nDiffLeft = bLayoutRTL ? rcDragScreen.right - nLeftBorderX : nLeftBorderX - rcDragScreen.left;

		if (nDiffLeft > 0)
		{
			int nStep = max(min(7, nDiffLeft/10), CXTPReportHeader::s_nMinAutoScrollStep);
			UINT uTimer = bFullColumnScrolling ? max(30, 800 - nDiffLeft * 10) : max(10, 100 - nDiffLeft);
			SCROLLINFO scrollInfo;

			BOOL bRes = pControl->GetScrollInfo(SB_HORZ, &scrollInfo);
			if (bRes)
			{
				if (scrollInfo.nPos > scrollInfo.nMin)
				{
					if (bFullColumnScrolling)
						pControl->SendMessage(WM_HSCROLL, SB_LINELEFT);
					else
						pControl->SetLeftOffset(scrollInfo.nPos - nStep);

					SetTimer(1, uTimer, NULL);
					bScrolled = TRUE;
				}
			}
		}
	}

	//-------------------------------------------------------------------------
	if (bScrolled)
	{
		CPoint ptMouse = ptMouseScreen;
		pControl->ScreenToClient(&ptMouse);

		pControl->RedrawControl();
		pControl->UpdateWindow();

		m_pHeader->OnMouseMove(0, ptMouse);
	}
}