Esempio n. 1
0
void CCoolMenuBarCtrl::UpdateWindowMenu(CMenu* pMenu)
{
	for ( UINT nItem = 0 ; nItem < pMenu->GetMenuItemCount() ; nItem++ )
	{
		UINT nID = pMenu->GetMenuItemID( nItem );
		
		if ( nID >= AFX_IDM_FIRST_MDICHILD )
		{
			for ( UINT nRemove = nItem ; nRemove < pMenu->GetMenuItemCount() ; )
				pMenu->RemoveMenu( nItem, MF_BYPOSITION );
			pMenu->RemoveMenu( nItem - 1, MF_BYPOSITION );
			break;
		}
	}
	
	CMDIFrameWnd* pFrame = (CMDIFrameWnd*)AfxGetMainWnd();
	if ( ! pFrame->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) ) ) return;
	
	for ( CWnd* pClient = pFrame->GetWindow( GW_CHILD ) ; pClient ; pClient = pClient->GetNextWindow() )
	{
		TCHAR szClass[64];
		GetClassName( pClient->GetSafeHwnd(), szClass, 64 );
		if ( _tcsicmp( szClass, _T("MDIClient") ) == 0 ) break;
	}
	
	if ( pClient == NULL ) return;
	
	CMDIChildWnd* pActive = pFrame->MDIGetActive();
	BOOL bSeparator = TRUE;
	
	for ( UINT nIndex = 1, nID = AFX_IDM_FIRST_MDICHILD ; nIndex <= 10 ; nIndex++, nID++ )
	{
		CWnd* pWnd = pClient->GetDlgItem( nID );
		if ( ! pWnd ) break;
		
#ifdef _SHAREAZA
		CChildWnd* pChildWnd = (CChildWnd*)pWnd;
		if ( pChildWnd->m_bTabMode )
		{
			nIndex--;
			continue;
		}
#endif
		
		if ( bSeparator )
		{
			pMenu->AppendMenu( MF_SEPARATOR, ID_SEPARATOR );
			bSeparator = FALSE;
		}
		
		CString strMenu, strWindow;
		pWnd->GetWindowText( strWindow );
		
		strMenu.Format( _T("&%i %s"), nIndex, (LPCTSTR)strWindow );
		
		pMenu->AppendMenu( MF_STRING | ( pWnd == pActive ? MF_CHECKED : 0 ),
			nID, strMenu );
	}
}
Esempio n. 2
0
void CModalDisplayPropSheet::OnApplyNow()
{
	CMDIFrameWnd* pMDIFrameWnd = (CMDIFrameWnd*)AfxGetMainWnd();
	ASSERT(pMDIFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd)));
	CView* pView = pMDIFrameWnd->MDIGetActive()->GetActiveView();
//	pView->SendMessage(WM_USER_CHANGE_OBJECT_PROPERTIES, 0, 0);
//	m_stylePage.SetModified(FALSE);
//	m_colorPage.SetModified(FALSE);
}
Esempio n. 3
0
CMDIFrameWnd *CMDIChildWnd::GetMDIFrame()
/***************************************/
{
    HWND hWndMDIClient = ::GetParent( m_hWnd );
    ASSERT( hWndMDIClient != NULL );
    HWND hWnd = ::GetParent( hWndMDIClient );
    ASSERT( hWnd != NULL );
    CMDIFrameWnd *pFrame = (CMDIFrameWnd *)CWnd::FromHandle( hWnd );
    ASSERT( pFrame->IsKindOf( RUNTIME_CLASS( CMDIFrameWnd ) ) );
    return( pFrame );
}
Esempio n. 4
0
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 );
}
Esempio n. 5
0
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();
}