virtual void OnDraw (CDC* pDC) { ASSERT_VALID (pDC); CBCGPBaseRibbonElement* pElement = (CBCGPBaseRibbonElement*) m_dwData; ASSERT_VALID (pElement); CBCGPToolbarMenuButton dummy; dummy.m_strText = m_strText; CString strValue = pElement->GetText (); if (strValue.GetLength () > nMaxValueLen) { strValue = strValue.Left (nMaxValueLen - 1); } if (!strValue.IsEmpty ()) { dummy.m_strText += _T('\t'); dummy.m_strText += strValue; } dummy.m_bMenuMode = TRUE; dummy.m_pWndParent = GetParentWnd (); if (pElement->IsVisible ()) { dummy.m_nStyle |= TBBS_CHECKED; } dummy.OnDraw (pDC, m_rect, NULL, TRUE, FALSE, m_bIsHighlighted); }
virtual void OnClick (CPoint /*point*/) { CBCGPBaseRibbonElement* pElement = (CBCGPBaseRibbonElement*) m_dwData; ASSERT_VALID (pElement); pElement->SetVisible (!pElement->IsVisible ()); Redraw (); CBCGPRibbonBar* pRibbonStatusBar = pElement->GetParentRibbonBar (); ASSERT_VALID (pRibbonStatusBar); pRibbonStatusBar->RecalcLayout (); pRibbonStatusBar->RedrawWindow (); CFrameWnd* pParentFrame = pRibbonStatusBar->GetParentFrame (); ASSERT_VALID (pParentFrame); pParentFrame->RedrawWindow (NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); CRect rectScreen; pRibbonStatusBar->GetWindowRect (&rectScreen); CBCGPPopupMenu::UpdateAllShadows (rectScreen); }