예제 #1
0
void CExtStatusControlBar::OnContextMenu(CWnd* pWnd, CPoint point) 
{
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeSite * pSite =
		CExtCustomizeSite::GetCustomizeSite( m_hWnd );
	if(		pSite != NULL
		&&	pSite->IsCustomizeMode()
		)
		return;
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)

	if( CExtControlBar::FindHelpMode(this) )
		return;

CFrameWnd * pFrame = _GetDockingFrameImpl();
	if( pFrame == NULL )
	{
		CStatusBar::OnContextMenu( pWnd, point );
		return;
	}

	ASSERT_VALID( pFrame );
HWND hWndTrack = GetOwner()->GetSafeHwnd();
	ASSERT( hWndTrack != NULL && ::IsWindow(hWndTrack) );
CExtPopupMenuWnd * pPopup =
		new CExtPopupMenuWnd;
	VERIFY( pPopup->CreatePopupMenu(hWndTrack) );

	if(	! CExtDockBar::_ConstructDockSiteControlBarPopupMenu(
			pFrame,
			pPopup,
			CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_STATUSBAR_CTX,
			this,
			WM_CONTEXTMENU,
			NULL
			)
		)
	{
		delete pPopup;
		return;
	}
	if( pPopup->ItemGetCount() == 0 )
	{
		delete pPopup;
		return;
	}
	::SetFocus( hWndTrack );
	if( ! pPopup->TrackPopupMenu(
			TPMX_OWNERDRAW_FIXED,
			point.x,
			point.y
			)
		)
	{
		delete pPopup;
	}
}
예제 #2
0
void CExtMiniDockFrameWnd::OnNcRButtonDown(UINT nHitTest, CPoint point)
{
	if( _ResizingIsInProgress() )
	{
		_ResizingEnd();
		return;
	}
	if( nHitTest == HTCAPTION )
	{
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
		CExtCustomizeSite * pSite =
			CExtCustomizeSite::GetCustomizeSite( m_hWnd );
		if(		pSite != NULL
			&&	pSite->IsCustomizeMode()
			)
			return;
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
		if( CExtControlBar::FindHelpMode(this) )
			return;
		CExtControlBar * pExtBar =
			GetControlBarExt();
		if( pExtBar != NULL )
		{
			ASSERT_VALID( pExtBar );
			
			CFrameWnd * pFrame = pExtBar->_GetDockingFrameImpl();
			ASSERT_VALID( pFrame );

			CPoint point;
			if( ! ::GetCursorPos(&point) )
				return;
			HWND hWndTrack = pFrame-> /*pExtBar->GetOwner()->*/ GetSafeHwnd();
			ASSERT( hWndTrack != NULL && ::IsWindow(hWndTrack) );
			CExtPopupMenuWnd * pPopup = new CExtPopupMenuWnd;
			VERIFY( pPopup->CreatePopupMenu(hWndTrack) );
			if(	! CExtDockBar::_ConstructDockSiteControlBarPopupMenu(
					pFrame,
					pPopup,
					CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_MINIFRAME_NC_CTX,
					pExtBar,
					WM_NCRBUTTONDOWN,
					NULL
					)
				)
			{
				delete pPopup;
				return;
			}
			if( pPopup->ItemGetCount() == 0 )
			{
				delete pPopup;
				return;
			}
			//::SetFocus( hWndTrack );
			if( ! pPopup->TrackPopupMenu(
					TPMX_OWNERDRAW_FIXED,
					point.x,
					point.y
					)
				)
			{
				delete pPopup;
			}
			return;
		} // if( pExtBar != NULL )
	} // if( nHitTest == HTCAPTION )
	CMiniDockFrameWnd::OnNcRButtonDown(nHitTest,point);
}
예제 #3
0
void CExtMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeSite * pSite =
		CExtCustomizeSite::GetCustomizeSite( m_hWnd );
	if(		pSite != NULL
		&&	pSite->IsCustomizeMode()
		)
		pSite->DropTargetPopupCancel();
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)

CExtControlBar * pExtBar = GetControlBarExt();
CPoint p(point);
CRect rcWnd;
	GetWindowRect( &rcWnd );
	p.Offset( -rcWnd.left, -rcWnd.top );
	if( m_rcBtnHideBar.PtInRect( p ) )
		return;
	if( nHitTest == HTCAPTION )
	{
		ActivateTopParent();
		if(		pExtBar != NULL
			&&	(! pExtBar->_IsDockSiteCustomizeMode() )
			)
			BringWindowToTop();
		if( (m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0 )
		{
			int nPos = 1;
			CControlBar* pBar = NULL;
			while(
				pBar == NULL
				&& nPos < m_wndDockBar.m_arrBars.GetSize()
				)
				pBar =
					reinterpret_cast < CExtDockBar & >
						(m_wndDockBar). GetDockedControlBar(nPos++);
			ASSERT(pBar != NULL);
			ASSERT_KINDOF( CControlBar, pBar );
			ASSERT( pBar->m_pDockContext != NULL );
			if( pExtBar == NULL
				|| (	pExtBar != NULL
					&&	pExtBar->IsFixedMode()
					&&	!pExtBar->_IsShowContentWhenDragging()
					)
				)
			{
				pBar->m_pDockContext->StartDrag(point);
				return;
			}
			int nCyGripper =
				min(
					pExtBar->m_rcGrip.Width(),
					pExtBar->m_rcGrip.Height()
					);
			pExtBar->_DraggingStart(
				point,
				point
					- rcWnd.TopLeft()
					- CPoint( nCyGripper, nCyGripper/2 )
				);
			return;
		}
	}
	else if( nHitTest >= HTSIZEFIRST && nHitTest <= HTSIZELAST )
	{
		ActivateTopParent();
		int nPos = 1;
		CControlBar * pBar = NULL;
		while(
			pBar == NULL
			&& nPos < m_wndDockBar.m_arrBars.GetSize()
			)
			pBar =
				reinterpret_cast < CExtDockBar & >
					(m_wndDockBar).GetDockedControlBar(nPos++);
		ASSERT(pBar != NULL);
		ASSERT_KINDOF(CControlBar, pBar);
		ASSERT(pBar->m_pDockContext != NULL);
		ASSERT( (m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0 );
		if(	!pBar->IsKindOf(RUNTIME_CLASS(CExtControlBar)) )
			CMiniDockFrameWnd::OnNcLButtonDown( nHitTest, point);
		else
		{
			CExtControlBar * pExtBar =
				(CExtControlBar *)pBar;
			if( !pExtBar->_IsShowContentWhenDragging()
				&&	pExtBar->IsFixedMode()
				)
			{
				pBar->m_pDockContext->StartResize(nHitTest,point);
				return;
			}
			ClientToScreen( &point );
			_ResizingStart( nHitTest, point );
		}
		return;
	}
	else if( nHitTest == HTMINBUTTON
		|| nHitTest == HTMAXBUTTON
		|| nHitTest == HTGROWBOX
		)
		return;
	
	CMiniFrameWnd::OnNcLButtonDown( nHitTest, point );
}
예제 #4
0
BOOL CExtThemeSwitcherToolControlBar::PreTranslateMessage( MSG * pMsg )
{
	if(		m_bCommandProfileInitialized
		&&	GetSafeHwnd() != NULL
		&&	pMsg->message == CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel
		)
	{
		CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
			reinterpret_cast
			< CExtPopupMenuWnd::MsgPrepareMenuData_t * >
			( pMsg->wParam );
		ASSERT( pData != NULL );
		CExtPopupMenuWnd * pPopup = pData->m_pPopup;
		ASSERT( pPopup != NULL );
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
		bool bCustomizeMode = false;
		CExtPopupMenuWnd * pTestPopup = pPopup;
		for( ; pTestPopup != NULL ; pTestPopup = pTestPopup->GetParentMenuWnd() )
		{
			if( (pPopup->TrackFlagsGet()&TPMX_CUSTOMIZE_MODE) != 0 )
			{
				bCustomizeMode = true;
				break;
			}
		}
		if( ! bCustomizeMode )
		{
			CExtCustomizeSite * pSite =
				CExtCustomizeSite::GetCustomizeSite( m_hWnd );
			if( pSite != NULL )
			{
				bCustomizeMode = pSite->IsCustomizeMode();
				if( ! bCustomizeMode )
					bCustomizeMode = ( pSite->DraggedNodeGet() != NULL ) ? true : false;
			}
		}
		if( ! bCustomizeMode )
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
		{
			for( ; true; )
			{
				INT nReplacePos =
					pPopup->ItemFindPosForCmdID( m_nMenuMarkerID );
				if( nReplacePos < 0 )
					break;
				pData->m_bMenuChanged = true;
				pPopup->ItemRemove( nReplacePos );
				INT nIndex, nCount = GetButtonsCount();
				for( nIndex = 0; nIndex < nCount; nIndex++ )
				{
					CExtBarButton * pQueueTBB = GetButton( nIndex );
					ASSERT_VALID( pQueueTBB );
					CExtThemeSwitcherToolButton * pTBB =
						DYNAMIC_DOWNCAST(
							CExtThemeSwitcherToolButton,
							pQueueTBB
							);
					if( pTBB == NULL )
						continue;
					ThemeSwitcher_OnButtonUpdate( pTBB );
					pTBB->PutToPopupMenu( pPopup );
				} // for( nIndex = 0; nIndex < nCount; nIndex++ )
			}
		}
	}
	return FALSE;
}