示例#1
0
void CXTPPopupControl::OnLButtonUp(UINT /*nFlags*/, CPoint point)
{
	//if there is pressed control
	if (m_pPressed)
	{
		//store popup pointer
		CXTPPopupItem* pPressed = m_pPressed;
		m_pPressed = NULL;

		//free mouse event
		ReleaseCapture();
		RedrawControl();

		//if selected pointer equal pressed pointer - it is clik on item
		if (pPressed == m_pSelected)
		{
			//redraw all valid items
			OnClick(pPressed);
		}
		else
		{
			OnMouseMove(0, point);
		}
	}
}
void CXTPCoreTreeControl::RecalcLayout()
{
	if (!GetSafeHwnd())
		return;

	if (m_nLockRedraw > 0)
		return;


	CXTPClientRect rc(this);

	m_rcControl = rc;
	CRect rcMargin(0, 0, 0, 0);

	{
		CClientDC dc(this);

		int nPos = RecalcTreeItems(m_pItems, &dc, 0, rcMargin);

		m_nClientHeight = nPos;
	}

	UpdateScrollBar();

	RedrawControl();
}
void CXTPCoreTreeControl::OnSysColorChange()
{
	CWnd::OnSysColorChange();

	m_pPaintManager->RefreshMetrics();
	RedrawControl();
}
示例#4
0
void CXTPPopupControl::OnLButtonDown(UINT nFlags, CPoint point)
{

	if ((GetPopupState() == xtpPopupStateExpanding) && !m_bSplashScreenMode)
	{
		m_nStep = 0;
		Animate(0);
		//kill timer event
		KillTimer(TID_EXPANDING);
		OnShow();
	}

	//test point to pressed controll
	CXTPPopupItem* pPressed = HitTest(point);

	if (m_bAllowMove && (!pPressed || (!pPressed->GetID() && !pPressed->IsButton() && (pPressed->GetCaption().IsEmpty() || !pPressed->IsHyperLink()))))
	{
		TrackMove();
		return;
	}

	//if success test
	if (pPressed)
	{
		m_pPressed = pPressed;
		//set capture
		SetCapture();
		//redraw all valide controls
		RedrawControl();
	}


	CWnd::OnLButtonDown(nFlags, point);
}
示例#5
0
void CXTPPopupControl::RemoveItem(int nIndex)
{
	if (nIndex < 0 || nIndex >= GetItemCount())
		return;

	CXTPPopupItem* pCurrItem = m_arrItems[nIndex];
	ASSERT(pCurrItem);
	if (!pCurrItem)
		return;

	//remove pointer from item's queue
	m_arrItems.RemoveAt(nIndex);

	//deallocate memory
	pCurrItem->InternalRelease();

	//if pointer was selected - reset selected pointer
	if (m_pSelected == pCurrItem)
		m_pSelected = NULL;

	//if pointer was pressed - reset pressed pointer
	if (m_pPressed == pCurrItem)
		m_pPressed = NULL;

	//redraw all valid items
	RedrawControl();
}
void CXTPCoreTreeControl::OnSetFocus(CWnd* pOldWnd)
{
	CWnd::OnSetFocus(pOldWnd);

	if (m_pFocusedItem)
	{
		RedrawControl(m_pFocusedItem->GetScreenRect());
	}
}
void CXTPCoreTreeControl::OnKillFocus(CWnd* pNewWnd)
{
	CWnd::OnKillFocus(pNewWnd);

	if (m_pFocusedItem)
	{
		RedrawControl(m_pFocusedItem->GetScreenRect());
	}
}
示例#8
0
void CXTPPopupControl::SetImageManager(CXTPImageManager* pImageManager)
{
	if (m_pImageManager)
		m_pImageManager->InternalRelease();

	m_pImageManager = pImageManager;

	RedrawControl();
}
示例#9
0
void CXTPPopupItem::SetTextFont(PLOGFONT pLogfText)
{
    ASSERT(pLogfText);

    m_fntText.DeleteObject();
    m_fntText.CreateFontIndirect(pLogfText);

    RedrawControl();
}
void CXTPCoreTreeControl::SetDragOverItem(CXTPCoreTreeItem* pDragOverItem, XTPCoreTreeDropPosition nDropPosition)
{
	if (m_pDragOverItem != pDragOverItem || nDropPosition != m_nDropPosition)
	{
		m_pDragOverItem = pDragOverItem;
		m_nDropPosition = nDropPosition;

		RedrawControl();
	}

};
示例#11
0
void CXTPPopupControl::OnCaptureChanged(CWnd* pWnd)
{
	//if m_pPressed - reset pointer
	if (m_pPressed)
	{
		m_pPressed = NULL;
		RedrawControl();
	}

	CWnd::OnCaptureChanged(pWnd);
}
示例#12
0
void CXTPPopupControl::SetTheme(CXTPPopupPaintManager* pPaintManager)
{
	//delete old theme object
	delete m_pPaintManager;

	//store point to new theme object
	m_pPaintManager = pPaintManager;

	m_pPaintManager->RefreshMetrics();

	//redraw all controls
	RedrawControl();
}
示例#13
0
void CXTPPopupItem::SetCaption(LPCTSTR str)
{
    m_strCaption = str;

    XTPMarkupReleaseElement(m_pUIElement);

    if (m_pControl->GetMarkupContext())
    {
        m_pUIElement = XTPMarkupParseText(m_pControl->GetMarkupContext(), str);
    }

    RedrawControl();
}
void CXTPCoreTreeControl::SetFocusedItem(CXTPCoreTreeItem* pItem)
{
	if (m_pFocusedItem == pItem)
		return;

	if (pItem && pItem->IsLabel())
		return;

	m_pFocusedItem = pItem;

	EnsureVisible(m_pFocusedItem);

	RedrawControl();

	SendMessageToParent(TVN_SELCHANGED);
}
BOOL CXTPCoreTreeControl::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint /*point*/)
{
	if (!m_pDragOverItem)
		return FALSE;

	CXTPCoreTreeItem* pDragOverItem = m_pDragOverItem;
	m_pDragOverItem = NULL;

	RedrawControl();

	if (dropEffect != DROPEFFECT_COPY && dropEffect != DROPEFFECT_MOVE)
		return FALSE;

	if (!pDataObject || !pDataObject->IsDataAvailable(GetClipboardFormat()))
		return FALSE;


	CXTPCoreTreeItem* pItemDrop = CXTPCoreTreeItem::CreateFromOleData(pDataObject);
	if (!pItemDrop)
		return FALSE;


	if (m_nDropPosition == xtpCoreTreeDropAfter)
	{
		pDragOverItem->GetParentItems()->AddItemAfter(pItemDrop, pDragOverItem);
	}
	else if (m_nDropPosition == xtpCoreTreeDropBefore)
	{
		pDragOverItem->GetParentItems()->AddItemBefore(pItemDrop, pDragOverItem);
	}
	else if (m_nDropPosition == xtpCoreTreeDropChild)
	{
		pDragOverItem->GetChildren()->AddItemBefore(pItemDrop, NULL);
		pDragOverItem->SetExpanded();
	}
	else
	{
		ASSERT(FALSE);
	}

	SetFocusedItem(pItemDrop);

	return TRUE;
}
示例#16
0
void CXTPPopupControl::UpdateState(BOOL /*bInit*/)
{
	//Get current popup wnd rect
	CRect rc = m_stateCurrent.rcPopup;

	//set current pos and size
	SetWindowPos(NULL, rc.left, rc.top, rc.Width(), rc.Height(),
		SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOACTIVATE |
		SWP_NOSENDCHANGING | SWP_SHOWWINDOW);

	//redraw all items
	RedrawControl();

	//if mouse is capture - window is opaque (return from UpdateState proc)
	//else, will be need to set current transparent value
	if (!m_bCapture)
		SetLayeredWindowAttributes(m_stateCurrent.nTransparency);

	UpdateWindow();
}
BOOL CXTPCoreTreeControl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
	if (m_bScrollVisible)
	{
		int nCurPos = GetScrollPos(SB_VERT);

		int nDelta = 3 * m_pPaintManager->GetItemHeight();

		if (zDelta > 0) nCurPos = max(nCurPos - nDelta, 0);
		else nCurPos = min(nCurPos + nDelta, GetScrollLimit(SB_VERT));

		OnScrollChanged(nCurPos);

		RedrawControl();

		return TRUE;
	}

	return CWnd::OnMouseWheel(nFlags, zDelta, pt);
}
void CXTPReportControl::SetFullColumnScrolling(BOOL bSet)
{
	if (bSet)
	{
		m_scrollModeH = xtpReportScrollModeBlock;
	}
	else
	{
		m_scrollModeH = xtpReportScrollModeSmooth;
	}

	if (m_hWnd)
	{
		CXTPReportControl::OnHScroll(SB_TOP, 0, NULL);

		RedrawControl();
		UpdateWindow();

		AdjustScrollBars();
	}
}
示例#19
0
void CXTPPopupControl::OnMouseMove(UINT nFlags, CPoint point)
{
	if (!m_bSplashScreenMode)
	{
		CXTPClientRect rc(this);

		//test client rect if no-pressed
		BOOL bInRect = rc.PtInRect(point) || m_pPressed != NULL;

		//if test successfull and already not capture
		if (bInRect && !m_bCapture)
		{
			//set capture
			m_bCapture = TRUE;

			//opaque window
			SetLayeredWindowAttributes(255);

			//capture mouse leave event
			TRACKMOUSEEVENT tme =
			{
				sizeof(TRACKMOUSEEVENT), TME_LEAVE, m_hWnd, 0
			};
			_TrackMouseEvent(&tme);
		}
		//else if test fail and there is pressed and selected control
		if (!bInRect && m_bCapture && m_pPressed == NULL)
		{
			//free capture
			m_bCapture = FALSE;
			//set current transparent
			SetLayeredWindowAttributes(m_nTransparency);
		}

		//if collapsing state - expand popup window
		if (m_popupState == xtpPopupStateCollapsing)
		{
			//kill collapsing timer
			KillTimer(TID_COLLAPSING);

			if (m_popupAnimation == xtpPopupAnimationFade)
			{
				OnShow();
			}
			else
			{
				OnExpanding(FALSE);
			}
		}
	}

	//test point to controled items
	CXTPPopupItem* pSelected = HitTest(point);

	//if detect new selected item ore lose selection (NULL)
	if (pSelected != m_pSelected)
	{
		//select new item ore set NULL
		m_pSelected = (m_pPressed == 0 || m_pPressed == pSelected || pSelected == NULL) ? pSelected : NULL;

		//redraw all items
		RedrawControl();
	}

	CWnd::OnMouseMove(nFlags, point);
}
void CXTPCoreTreeControl::OnScrollChanged(int nScrollOffset)
{
	SetScrollPos(SB_VERT, nScrollOffset);
	RedrawControl();
}
示例#21
0
void CXTPTabManager::TrackClick(HWND hWnd, CPoint pt, CXTPTabManagerItem* pItem)
{
	if (GetPaintManager()->m_bHotTracking)
		m_pHighlighted = pItem;

	m_pPressed = pItem;
	BOOL bHighlighted = TRUE;

	Reposition();
	BOOL bAccept = FALSE;

	::SetCapture(hWnd);

	while (::GetCapture() == hWnd)
	{
		MSG msg;
		VERIFY(::GetMessage(&msg, NULL, 0, 0));

		if (::GetCapture() != hWnd)
		{
			DispatchMessage (&msg);
			break;
		}
		switch (msg.message)
		{
			case WM_MOUSEMOVE:
				{
					pt = CPoint((short signed)LOWORD(msg.lParam), (short signed)HIWORD(msg.lParam));

					bHighlighted = pItem->GetRect().PtInRect(pt);

					if (GetPaintManager()->m_bHotTracking)
					{
						CXTPTabManagerItem* pHighlighted = bHighlighted ? pItem : NULL;
						if (pHighlighted != m_pHighlighted)
						{
							m_pHighlighted = pHighlighted;
							RedrawControl(pItem->GetRect(), TRUE);
						}
					}

				}

				break;

			case WM_KEYDOWN:
				if (msg.wParam != VK_ESCAPE)
					break;
			case WM_CANCELMODE:
			case WM_RBUTTONDOWN:
				goto ExitLoop;

			case WM_LBUTTONUP:
				bAccept = TRUE;
				goto ExitLoop;

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

ExitLoop:
	ReleaseCapture();

	m_pPressed = FALSE;

	PerformMouseMove(hWnd, pt);

	RedrawControl(NULL, FALSE);

	if (bAccept && bHighlighted)
	{
		OnItemClick(pItem);
	}
}
示例#22
0
void CXTPTabManager::PerformMouseMove(HWND hWnd, CPoint pt)
{
	CXTPTabPaintManager::CAppearanceSet* pAppearance = GetPaintManager()->GetAppearanceSet();

	if (!CXTPDrawHelpers::IsTopParentActive(hWnd) || IsMouseLocked())
	{
		if (m_pHighlighted)
		{
			CRect rcRedraw(pAppearance->GetButtonDrawRect(m_pHighlighted));
			m_pHighlighted = NULL;

			RedrawControl(rcRedraw, TRUE);
		}
		return;
	}

	if (GetPaintManager()->m_bHotTracking)
	{
		CXTPTabManagerItem* pItem = HitTest(pt);

		if (pItem != m_pHighlighted)
		{
			if (m_pHighlighted)
			{
				CRect rcRedraw(pAppearance->GetButtonDrawRect(m_pHighlighted));
				m_pHighlighted = NULL;

				RedrawControl(rcRedraw, TRUE);
			}

			m_pHighlighted = pItem;

			if (m_pHighlighted)
			{
				RedrawControl(pAppearance->GetButtonDrawRect(m_pHighlighted), FALSE);
			}

			if (pItem)
			{
				TRACKMOUSEEVENT tme =
				{
					sizeof(TRACKMOUSEEVENT), TME_LEAVE, hWnd
				};
				_TrackMouseEvent(&tme);
			}
		}
	}

	CXTPTabManagerNavigateButton* pNavigateButton = HitTestNavigateButton(pt, FALSE);

	if (pNavigateButton != m_pHighlightedNavigateButton)
	{
		if (m_pHighlightedNavigateButton)
		{
			RedrawControl(m_pHighlightedNavigateButton->GetRect(), TRUE);
		}

		m_pHighlightedNavigateButton = pNavigateButton;

		if (m_pHighlightedNavigateButton)
		{
			RedrawControl(m_pHighlightedNavigateButton->GetRect(), FALSE);
		}

		if (pNavigateButton)
		{
			TRACKMOUSEEVENT tme =
			{
				sizeof(TRACKMOUSEEVENT), TME_LEAVE, hWnd
			};
			_TrackMouseEvent(&tme);
		}
	}
}
void CXTPCalendarController::CXTPDayInfoCache::OnRefreshDays(int nDaysCountToRefresh)
{
    ASSERT(m_pOwner);

    if (!XTP_SAFE_GET1(m_pOwner, m_pResourcesNf, NULL))
    {
        if (!m_dwWaitingDataTime)
        {
            m_dwWaitingDataTime = GetTickCount();
            DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - OnRefreshDays, Start Wait for data\n"));
        }

        if (abs((long)(GetTickCount() - m_dwWaitingDataTime)) >= 5000)
        {
            m_dwWaitingDataTime = 0;

            if (m_uTimerID)
            {
                DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - OnRefreshDays, KillTimer (ID = %d) \n"), m_uTimerID);
                DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - OnRefreshDays, end Wait for data\n"));

                KillTimer();

                OnSelfClearOld();
            }
        }
        return;
    }
    else
    {
        if (m_dwWaitingDataTime)
        {
            DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - OnRefreshDays, end Wait for data\n"));
        }
        m_dwWaitingDataTime = 0;
    }

    //***************************************************
    for (int i = 0; i < nDaysCountToRefresh; i++)
    {
        long nDay_min = LONG_MAX;
        UINT uPriority_max = 0;

        POSITION pos = m_mapDaysToRefresh.GetStartPosition();
        while (pos)
        {
            long nDay = 0;
            UINT uPriority = 0;
            m_mapDaysToRefresh.GetNextAssoc(pos, nDay, uPriority);

            if (uPriority == uPriority_max && nDay < nDay_min ||
                    uPriority > uPriority_max)
            {
                uPriority_max = uPriority;
                nDay_min = nDay;
            }
        }

        if (nDay_min < LONG_MAX)
        {
            m_mapDaysToRefresh.RemoveKey(nDay_min);

            COleDateTime dtDay((DATE)nDay_min);
            BOOL bHasEvents = XTP_SAFE_GET1(m_pOwner, _HasEvents(dtDay), FALSE);

            UpdateDayInfo(dtDay, bHasEvents);
        }
    }
    //***************************************************

    if (m_mapDaysToRefresh.GetCount() == 0 && m_uTimerID)
    {
        DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - OnRefreshDays, KillTimer (ID = %d) \n"), m_uTimerID);
        DBG_TRACE_DP_TIMER(_T("XTPCalendarController::DayInfoCache - Days In Cache %d \n"), m_mapDaysInfo.GetCount());

        KillTimer();

        OnSelfClearOld();
    }

    if (abs((long)(GetTickCount() - m_dwLastRedrawTime)) >= 500 || m_uTimerID == 0)
    {
        XTP_SAFE_CALL2(m_pOwner, m_pDatePickerCtrl, RedrawControl());
        m_dwLastRedrawTime = GetTickCount();
    }
}