Beispiel #1
0
void CExtDockBar::_ContextMenuBuild(
	CFrameWnd * pFrame,
	CExtPopupMenuWnd * pPopup
	)
{
	ASSERT_VALID( pFrame );
	ASSERT( pPopup != NULL );
ExtControlBarVector_t vBars;
	CExtControlBar::_GetFrameControlBars(
		pFrame,
		vBars
		);
bool bOleInplaceItemActivated =
	CExtControlBar::IsOleIpObjActive( pFrame );

int nBarsCount = vBars.GetSize();
CExtControlBar * pPrevBar = NULL;
	for( int i=0; i<nBarsCount; i++ )
	{
		CExtControlBar * pBar = vBars[i];
		ASSERT_VALID( pBar );
		if( pBar->GetSafeHwnd() == NULL )
			continue;
		// do not include temporary hidden bars
		if( pBar->m_nStateFlags &
				(CControlBar::delayHide | CControlBar::tempHide)
			)
			continue;
		// do not include some bars when OLE inplace object active
		if( bOleInplaceItemActivated &&
				(pBar->m_dwStyle & CBRS_HIDE_INPLACE)
			)
			continue;

		// do not include bars without caption
		CString sBarText;
		pBar->GetWindowText( sBarText );
		if( sBarText.IsEmpty() )
		{
			ASSERT( FALSE );
			continue;
		}

		if( pPrevBar != NULL
			&&
			pPrevBar->m_bFixedMode != pBar->m_bFixedMode
			)
		{
			VERIFY(
				pPopup->ItemInsert(
					CExtPopupMenuWnd::TYPE_SEPARATOR
					)
				);
		}
		pPrevBar = pBar;


		int nBarID = pBar->GetDlgCtrlID();
		ASSERT( CExtCmdManager::IsCommand(nBarID) );
		
		CExtCmdManager::cmd_t cmd;
		cmd.m_nCmdID = nBarID;
		cmd.m_sMenuText = sBarText;
		cmd.TipsLoad();
		g_CmdManager->CmdSetup(
			g_CmdManager->ProfileNameFromWnd( pFrame->GetSafeHwnd() ),
			cmd
			);

		VERIFY(
			pPopup->ItemInsert(
				nBarID
				)
			);
	} // for( int i=0; i<nBarsCount; i++ )
}
void CExtMiniDockFrameWnd::OnTimer( UINT nIDEvent )
{
CExtControlBar * pExtBar = GetControlBarExt();
	if( nIDEvent == 1 )
	{
		if( pExtBar == NULL )
			return;
		KillTimer(1);
		SetWindowPos(
			NULL,0,0,0,0,
			SWP_NOMOVE|SWP_NOACTIVATE // |SWP_NOSIZE
				|SWP_NOZORDER|SWP_NOOWNERZORDER 
				|SWP_FRAMECHANGED
			);
		return;
	}
	if( nIDEvent == 2 )
	{
		_AnalyzeButtonsHover();
		return;
	}
	if( nIDEvent == 3 )
	{
		if( pExtBar == NULL
			|| _ResizingIsInProgress()
			)
		return;
		RecalcLayout();
		KillTimer(3);
		return;
	}

	if( pExtBar == NULL )
		return;
	ASSERT_VALID( pExtBar );
	if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
	{
		if( _ResizingIsInProgress() )
			return;
		CPoint pt;
		VERIFY( GetCursorPos( &pt ) );
		CWnd * pTempWnd = WindowFromPoint( pt );
		int IsMouseInsideTheWindow =
			IsChild( pTempWnd ) || pTempWnd->m_hWnd == m_hWnd;

		if(	IsMouseInsideTheWindow
			|| IsChild(GetFocus())  
			|| (GetCapture() && pExtBar->m_hWnd == GetCapture()->m_hWnd) 
			|| CExtPopupMenuWnd::IsMenuTracking()
			) 
		{

			if(	IsMouseInsideTheWindow 
				&& !CExtPopupMenuWnd::IsMenuTracking()
				&& IsWindowEnabled()
				&& GetFocus()
				) 
				BringWindowToTop();
		}
	} // if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
}
void CExtMiniDockFrameWnd::OnTimer( UINT nIDEvent )
{
CExtControlBar * pExtBar = GetControlBarExt();
	if( nIDEvent == 1 )
	{
		if( pExtBar == NULL )
			return;
		KillTimer( 1 );
		pExtBar->OnNcAreaButtonsReposition();
//		SetWindowPos(
//			NULL,
//			0, 0, 0, 0,
//			SWP_NOREDRAW|SWP_NOSIZE
//				|SWP_NOMOVE|SWP_NOACTIVATE
//				|SWP_NOZORDER|SWP_NOOWNERZORDER 
//				|SWP_FRAMECHANGED
//			);
		return;
	}
	if( nIDEvent == 2 )
	{
		_AnalyzeButtonsHover();
		return;
	}
	if( nIDEvent == 3 )
	{
		if(		pExtBar == NULL
			//|| _ResizingIsInProgress()
			)
			return;
		KillTimer( 3 );
		RecalcLayout();
		pExtBar->OnNcAreaButtonsReposition();
		SendMessage( WM_NCPAINT );
		return;
	}
	if( nIDEvent == 4 )
	{
		if( pExtBar != NULL )
		{
			ASSERT_VALID( pExtBar );
			CPoint point;
			if( ! ::GetCursorPos(&point) )
				return;
			UINT nHT = pExtBar->NcButtons_HitTest( point );
			if( nHT == HTCLIENT )
			{
				PostMessage( WM_NCPAINT );
				pExtBar->m_bNcAreaBtnTracking = false;
			}
		}
		if( !pExtBar->m_bNcAreaBtnTracking )
			KillTimer( 4 );
		return;
	}

	if( pExtBar == NULL )
		return;
	ASSERT_VALID( pExtBar );
	if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
	{
		if( _ResizingIsInProgress() )
			return;
		CPoint pt;
		if( ! ::GetCursorPos( &pt ) )
			return;
		CWnd * pTempWnd = WindowFromPoint( pt );
		int IsMouseInsideTheWindow =
			IsChild( pTempWnd ) || pTempWnd->m_hWnd == m_hWnd;

		if(	IsMouseInsideTheWindow
			|| IsChild(GetFocus())  
			|| (CExtMouseCaptureSink::GetCapture() && pExtBar->m_hWnd == CExtMouseCaptureSink::GetCapture()) 
			|| CExtPopupMenuWnd::IsMenuTracking()
			) 
		{

			if(	IsMouseInsideTheWindow 
				&& !CExtPopupMenuWnd::IsMenuTracking()
				&& IsWindowEnabled()
				&& GetFocus()
				) 
				BringWindowToTop();
		}
	} // if( nIDEvent == (UINT)pExtBar->GetDlgCtrlID() )
}