Example #1
0
void CXTPRibbonGroup::RepositionControls(CDC* pDC)
{
    CXTPRibbonPaintManager* pPaintManager = GetRibbonBar()->GetRibbonPaintManager();

    int x = m_rcGroup.left + 4;
    int y = m_rcGroup.top + pPaintManager->GetGroupCaptionHeight();

    for (int i = 0; i < GetCount(); i++)
    {
        CXTPControl* pControl = GetAt(i);
        if (!pControl->IsVisible())
            continue;

        CSize sz = pControl->GetSize(pDC);
        pControl->SetRect(CRect(x, y, x + sz.cx, y + sz.cy));

        x += sz.cx;
    }
}
Example #2
0
CXTPControl* CXTPRibbonGroup::FindControl(XTPControlType type, int nId, BOOL bVisible, BOOL bRecursive) const
{
    for (int nIndex = 0; nIndex < GetCount(); nIndex++)
    {
        CXTPControl* pControl = GetAt(nIndex);
        if ((type == xtpControlError || pControl->GetType() == type) &&
                (!bVisible || pControl->IsVisible()) &&
                (nId == -1 || nId == pControl->GetID()))
            return pControl;

        if (bRecursive)
        {
            CXTPCommandBar* pBar = pControl->GetCommandBar();
            if (pBar)
            {
                pControl = pBar->GetControls()->FindControl(type, nId, bVisible, bRecursive);
                if (pControl != NULL) return pControl;
            }
        }
    }
    return NULL;
}
void CXTPRibbonTabPopupToolBar::OnKeyboardTip(CXTPCommandBarKeyboardTip* pTip)
{
	CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pTip->m_pOwner);
	if (pControl)
	{

		if (pTip->m_bVisible == FALSE && pControl->GetHideFlags() == xtpHideWrap)
		{
			CXTPRibbonGroup* pGroup = pControl->GetRibbonGroup();
			if (pGroup && pGroup->GetControlGroupPopup())
			{
				EnsureVisible(pGroup->GetControlGroupPopup());
				pGroup->GetControlGroupPopup()->OnUnderlineActivate();

				int nIndex = pGroup->IndexOf(pControl);

				CXTPCommandBar* pPopupToolBar = pGroup->GetControlGroupPopup()->GetCommandBar();
				if (pPopupToolBar && pPopupToolBar->IsTrackingMode() && nIndex >= 0 &&
					nIndex < pPopupToolBar->GetControlCount())
				{
					pPopupToolBar->GetControl(nIndex)->OnUnderlineActivate();

				}
			}

			return;
		}

		if (pControl->IsVisible())
		{
			pControl->OnUnderlineActivate();
		}

		return;
	}
}
Example #4
0
void CXTPRibbonGroup::Draw(CDC* pDC, CRect rcClipBox)
{
    GetRibbonBar()->GetRibbonPaintManager()->DrawGroup(pDC, this);

    BOOL bFirst = TRUE;

    for (int i = 0; i < GetCount(); i++)
    {
        CXTPControl* pControl = GetAt(i);
        if (!pControl->IsVisible())
            continue;

        if (!m_bControlsGrouping && pControl->GetBeginGroup() && !bFirst)
        {
            GetRibbonBar()->GetPaintManager()->
            DrawCommandBarSeparator(pDC, GetRibbonBar(), pControl);
        }

        if (CRect().IntersectRect(rcClipBox, pControl->GetRect()))
        {
            pControl->Draw(pDC);
        }

        bFirst = FALSE;
    }

    if (m_pControlGroupPopup->IsVisible())
    {
        m_pControlGroupPopup->Draw(pDC);
    }

    if (m_pControlGroupOption->IsVisible())
    {
        m_pControlGroupOption->Draw(pDC);
    }
}