Esempio n. 1
0
BOOL COrnament::UpdateSelf(void)
{
	ASSERT(m_pContext != NULL);

	if (UpdateNeeded())
	{
		// Size the ornament base on position and extent.
			
		// NOTE: The Bounds property is not up to date at this
		// point and should not be used is the SizeContent() method.
		// Furthermore, SizeContent() should not set the Bounds
		// rectangle. Its definition is fixed: Extent+Position-Origin.
		// The bounds rectangle is used as the position where the
		// actual image will be drawn.
			
		SizeContent();
			
		// Update the bounds from the position and extent.
			
		CurrentState()->m_crBounds = CRect(0, 0, CurrentState()->m_czExtent.cx, CurrentState()->m_czExtent.cx)+CurrentState()->m_cpPosition-CurrentState()->m_cpOrigin;
		
		// The size information is now valid for the current properties.
	}
	return TRUE;
}
Esempio n. 2
0
int CGridContainerNode::ClickContent(MSWindows::HDC hDC, LDraw::PointD point, UINT nFlags, bool bDblClk, CGridItem** pVal)
{
	ASSERT(0);
#if 0
	if (point.x >= 0 && point.y >= 0 && point.x < m_size.cx+2 && point.y < m_size.cy+2)
	{
		if (!bDblClk)
		{
			if (abs(m_size.cx-point.x) <= 2)
			{
				POINT org;
				GetViewportOrgEx(hDC, &org);

				HWND hwnd = m_pUI->m_hWnd;

				m_pUI->SetCapture();

				BOOL bLoop = TRUE;
				MSG msg;
				while (bLoop && GetMessage(&msg, hwnd, 0, 0))
				{
					TranslateMessage(&msg);

					switch (msg.message)
					{
					case WM_LBUTTONUP:
						{
							bLoop = FALSE;
						}
						break;

					case WM_MOUSEMOVE:
						{
							POINT pt;
							pt.x = (short)LOWORD(msg.lParam);
							pt.y = (short)HIWORD(msg.lParam);

							pt.x += org.x;
							pt.y += org.y;

							SizeContent(hDC, pt.x);
							m_pUI->Invalidate();
							m_pUI->OnSize();
						}
						break;

					default:
						DispatchMessage(&msg);
						break;
					}
				}

				ReleaseCapture();

				*pVal = this;
				return 0;
			}
		}
	}

	int y = 0;

// Children
	UPOSITION pos = m_childList.GetHeadPosition();
	while (pos)
	{
		CGridItem* pChild = (CGridItem*)m_childList.GetNext(pos);

		POINT childpoint = point;
		childpoint.y -= y;
		childpoint.x -= 0;

		POINT oldOrg;
		OffsetViewportOrgEx(hDC, 0, y, &oldOrg);

		int nClick = pChild->Click(hDC, childpoint, nFlags, bDblClk, pVal);

		SetViewportOrgEx(hDC, oldOrg.x, oldOrg.y, NULL);

		if (*pVal)
			return nClick;

		y += pChild->m_size.cy;
	}

	*pVal = NULL;
#endif
	return 0;
}