void CCoolBarCtrl::OnTimer(UINT nIDEvent) { if ( m_bRecalc ) { CMDIFrameWnd* pOwner = (CMDIFrameWnd*)GetOwner(); if ( pOwner != NULL && pOwner->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) { if ( ! pOwner->IsIconic() ) { pOwner->RecalcLayout(); m_bRecalc = FALSE; } } } if ( nIDEvent == 1 && ( ! m_bMenuGray || m_pDown == NULL ) ) { CRect rcWindow; CPoint point; GetCursorPos( &point ); ScreenToClient( &point ); GetClientRect( &rcWindow ); if ( rcWindow.PtInRect( point ) && GetTopLevelParent()->IsWindowEnabled() ) { CCoolBarItem* pItem = HitTest( point ); if ( m_pDown && m_pDown != pItem ) pItem = NULL; if ( pItem != m_pHot ) { m_pHot = pItem; Invalidate(); } } else { KillTimer( nIDEvent ); m_bTimer = FALSE; if ( m_pHot ) { m_pHot = NULL; Invalidate(); } } } CControlBar::OnTimer( nIDEvent ); }
void CCoolBarCtrl::OnUpdated() { if ( ! m_bStretch ) { CSize czLast = m_czLast; if ( CalcFixedLayout( FALSE, TRUE ) != czLast ) { CMDIFrameWnd* pOwner = (CMDIFrameWnd*)GetOwner(); if ( pOwner && pOwner->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) { if ( pOwner->IsIconic() ) m_bRecalc = TRUE; else pOwner->RecalcLayout(); } } } Invalidate(); }