CXTPMarkupInputElement* CXTPMarkupVisual::InputHitTest(CPoint point) const
{
	CPoint ptVisualPoint = point - m_ptVisualOffset;

	if (!m_rcBoundRect.PtInRect(ptVisualPoint))
		return NULL;

	CRect rcClip;
	if (GetLayoutClip(rcClip))
	{
		if (!rcClip.PtInRect(ptVisualPoint))
			return NULL;
	}

	int nVisualCount = GetVisualChildrenCount();
	for (int i = nVisualCount - 1; i >= 0; i--)
	{
		CXTPMarkupInputElement* pObject = GetVisualChild(i)->InputHitTest(ptVisualPoint);
		if (pObject)
			return pObject;
	}

	CRect rcRender(0, 0, m_szRenderSize.cx, m_szRenderSize.cy);
	if (!rcRender.PtInRect(ptVisualPoint))
		return NULL;

	return InputHitTestOverride(ptVisualPoint);
}
void CXTPMarkupVisual::RenderClipped(CXTPMarkupDrawingContext* drawingContext)
{
	int nVisualCount = GetVisualChildrenCount();
	for (int i = 0; i < nVisualCount; i++)
	{
		GetVisualChild(i)->RenderClipped(drawingContext);
	}
}
Beispiel #3
0
void TreeViewItem::OnRender(suic::DrawingContext * drawing)
{
    TreeItemHeaderPtr itemHead(_header);
    int count = GetVisualChildrenCount();

    // 绘制树的连接线
    if (_showDotLine)
    {
        ;
    }
}
void CXTPMarkupVisual::UpdateBoundRect()
{
	m_rcBoundRect.SetRect(0, 0, m_szRenderSize.cx, m_szRenderSize.cy);

	int nVisualCount = GetVisualChildrenCount();
	for (int i = 0; i < nVisualCount; i++)
	{
		CXTPMarkupVisual* pVisual = GetVisualChild(i);
		pVisual->UpdateBoundRect();

		CRect rcBoundRect = pVisual->m_rcBoundRect;
		rcBoundRect.OffsetRect(pVisual->m_ptVisualOffset);

		m_rcBoundRect.UnionRect(m_rcBoundRect, rcBoundRect);
	}
}
void CXTPMarkupVisual::Render(CXTPMarkupDrawingContext* drawingContext)
{
	CRect rcClipBox = drawingContext->GetClipBox();
	rcClipBox.OffsetRect(-m_ptVisualOffset);

	RECT rcIntersect;
	if (!::IntersectRect(&rcIntersect, GetBoundRect(), &rcClipBox))
	{
		RenderClipped(drawingContext);
		return;
	}

	CRect rcLayoutClip(0, 0, 0, 0);
	BOOL bClipLayout = FALSE;

	if (GetLayoutClip(rcLayoutClip))
	{
		if (rcLayoutClip.IsRectEmpty())
		{
			RenderClipped(drawingContext);
			return;
		}

		rcClipBox.IntersectRect(rcClipBox, rcLayoutClip);

		if (!::IntersectRect(&rcIntersect, GetBoundRect(), &rcClipBox))
		{
			RenderClipped(drawingContext);
			return;
		}

		bClipLayout = TRUE;
	}

	drawingContext->OffsetViewport(m_ptVisualOffset);

	HRGN hrgnClip = 0;

	if (bClipLayout)
	{
		hrgnClip = drawingContext->SaveClipRegion();

		drawingContext->IntersectClipRect(rcLayoutClip);
	}

	OnRender(drawingContext);

	int nVisualCount = GetVisualChildrenCount();
	for (int i = 0; i < nVisualCount; i++)
	{
		GetVisualChild(i)->Render(drawingContext);
	}

	if (IsKeyboardFocused())
	{
		OnRenderFocusVisual(drawingContext);

	}

	if (hrgnClip != NULL)
	{
		drawingContext->RestoreClipRegion(hrgnClip);
	}

	drawingContext->OffsetViewport(-m_ptVisualOffset);
}
int CXTPMarkupVisual::GetLogicalChildrenCount() const
{
	return GetVisualChildrenCount();
}