ExtToolControlBar.cpp
上传用户:sesekoo
上传日期:2020-07-18
资源大小:21543k
文件大小:409k
- if( pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) ) )
- dwTrackFlags |= TPMX_COMBINE_NONE|TPMX_RIBBON_MODE|TPMX_NO_HIDE_RARELY;
- else
- dwTrackFlags |= TPMX_COMBINE_DEFAULT;
- #else // (!defined __EXT_MFC_NO_RIBBON_BAR)
- dwTrackFlags |= TPMX_COMBINE_DEFAULT;
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( bForceNoAnimation )
- dwTrackFlags |= TPMX_FORCE_NO_ANIMATION;
- if( bSelectAny )
- dwTrackFlags |= TPMX_SELECT_ANY;
- pPopup->TrackFlagsSet( dwTrackFlags );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode();
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- VERIFY( pPopup->UpdateFromCmdTree( pWndCmdTarget->GetSafeHwnd(), pNode ) );
- } // if( pNode != NULL )
- else
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- {
- HMENU hMenu = GetMenu();
- ASSERT( hMenu != NULL );
- ASSERT( ::IsMenu(hMenu) );
- CMenu _menu;
- _menu.Attach( hMenu );
- VERIFY( pPopup->UpdateFromMenu( pWndCmdTarget->GetSafeHwnd(), &_menu, IsContainerOfPopupLikeMenu() ) );
- _menu.Detach();
- } // else from if( pNode != NULL )
- if( IsAppendMdiWindowsMenu() && (! pBar->_IsDockSiteCustomizeMode() ) )
- pPopup->UpdateMdiWindowsMenu( pWndCmdTarget );
- CExtToolControlBar::g_bMenuTracking = bPrevTBMT;
- CRect rcBtn = Rect();
- pBar->ClientToScreen( &rcBtn );
- pBar->ClientToScreen( &point );
- if( CExtToolControlBar::g_bMenuTrackingExpanded )
- dwTrackFlags |= TPMX_NO_HIDE_RARELY;
- pBar->_SwitchMenuTrackingIndex( pBar->_GetIndexOf( this ) );
- if( GetAutoChangeID()
- && (! CExtControlBar::FindHelpMode(GetBar()) )
- && (! pBar->GetParent()->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) ) )
- )
- {
- HWND hWndBar = pBar->GetSafeHwnd();
- CExtToolControlBar::g_bMenuTracking = true;
- UINT nResultCmdID = 0;
- pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
- if( GetSeparatedDropDown() )
- m_bDropDownHT = true;
- g_pTrackingMenuTBB = this;
- if( ! pPopup->TrackPopupMenu(
- dwTrackFlags|TPMX_NO_WM_COMMAND|TPMX_DO_MESSAGE_LOOP, point.x, point.y, &rcBtn, GetBar(),
- CExtToolControlBar::_CbPaintCombinedContent, &nResultCmdID, true
- )
- )
- {
- g_pTrackingMenuTBB = NULL;
- //delete pPopup;
- if( ! ::IsWindow( hWndBar ) )
- return UINT(-1L);
- CExtToolControlBar::_CloseTrackingMenus();
- return UINT(-1L);
- }
- g_pTrackingMenuTBB = NULL;
- if( ! ::IsWindow( hWndBar ) )
- return UINT(-1L);
- if( pBar->_GetIndexOf( this ) < 0 )
- return UINT(-1L);
- ModifyStyle( 0, TBBS_PRESSED );
- pBar->Invalidate();
- if( nResultCmdID == 0 )
- return UINT(-1L);
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- SetCmdID( nResultCmdID, true, false );
- CExtCustomizeCmdTreeNode * pNodeC = GetCmdNode( false );
- if( pNodeC != NULL )
- {
- ASSERT_VALID( pNodeC );
- CExtCmdItem * pCmdItem = g_CmdManager->CmdGetPtr( g_CmdManager->ProfileNameFromWnd( hWndBar ), nResultCmdID );
- LPCTSTR strText =
- ( pCmdItem != NULL )
- ? ( pCmdItem->m_sToolbarText.IsEmpty()
- ? ( pCmdItem->m_sMenuText.IsEmpty() ? _T("") : pCmdItem->m_sMenuText )
- : pCmdItem->m_sToolbarText
- )
- : _T("")
- ;
- pNodeC->SetTextInToolbar( strText );
- pNodeC->SetTextInMenu( strText );
- } // if( pNodeC != NULL )
- // pBar->Invalidate();
- CFrameWnd * pFrame = pBar->GetParentFrame();
- if( pFrame != NULL )
- pFrame->RecalcLayout();
- else
- pBar->_RecalcLayoutImpl();
- #else // (!defined __EXT_MFC_NO_CUSTOMIZE)
- SetCmdID( nResultCmdID, true, true );
- #endif // else from (!defined __EXT_MFC_NO_CUSTOMIZE)
- OnDeliverCmd();
- if( ::IsWindow(hWndBar) )
- pBar->_UpdateButton( pBar->_GetIndexOf(this) );
- } // if( GetAutoChangeID() )
- else
- {
- pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
- if( GetSeparatedDropDown() )
- m_bDropDownHT = true;
- g_pTrackingMenuTBB = this;
- if( ! pPopup->TrackPopupMenu(
- dwTrackFlags, point.x, point.y, &rcBtn, GetBar(),
- CExtToolControlBar::_CbPaintCombinedContent, NULL, true
- )
- )
- {
- g_pTrackingMenuTBB = NULL;
- //delete pPopup;
- CExtToolControlBar::_CloseTrackingMenus();
- return UINT(-1L);
- }
- CExtToolControlBar::g_bMenuTracking = true;
- pBar->_SwitchMenuTrackingIndex( pBar->_GetIndexOf( this ) );
- } // else from if( GetAutoChangeID() )
- return UINT(-1L);
- }
- void CExtBarButton::OnHover(
- CPoint point,
- bool bOn,
- bool & bSuspendTips
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- bSuspendTips = false;
- // TRACE2(
- // " >> OnHover(%s,%s)n",
- // bOn ? " on " : " off ",
- // CExtToolControlBar::g_bMenuTracking ? " on " : " off "
- // );
- CExtToolControlBar * pBar = GetBar();
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return;
- if( ( pBar->m_pDockSite == NULL
- || (! pBar->m_pDockSite->m_bHelpMode )
- )
- && (! CExtPopupMenuWnd::IsMenuTracking() )
- )
- {
- CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON _icn(
- NULL,
- this,
- bOn
- ? CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON::__EICN_SET
- : CExtPopupMenuWnd::ITEMCOVERINGNOTIFICATON::__EICN_CANCEL
- );
- HWND hWndOwn = pBar->GetSafeHwnd();
- _icn.Notify();
- bSuspendTips = _icn.m_bSuspendTips;
- if( ! ::IsWindow( hWndOwn ) )
- return;
- }
- if( bOn )
- {
- CExtBarButton * pTBB = this;
- for( ; pTBB != NULL; pTBB = pTBB->ParentButtonGet() )
- {
- pTBB->SetHover( true );
- pTBB->RedrawButton( false );
- }
- if( ! CExtPopupMenuWnd::IsMenuTracking() )
- {
- m_bDropDownHT = false;
- if( GetSeparatedDropDown() )
- {
- CRect rcBtnDropDownArea = RectDropDown();
- if( rcBtnDropDownArea.PtInRect(point) )
- m_bDropDownHT = true;
- }
- }
- /// if( CExtToolControlBar::g_bMenuTracking
- /// && CExtPopupMenuWnd::IsMenuTracking()
- /// && pBar->m_nBtnIdxHover != pBar->m_nBtnIdxMenuTracking
- /// )
- /// CExtPopupMenuWnd::CancelMenuTracking();
- if( CExtToolControlBar::g_bMenuTracking )
- {
- if( ! OnQueryHoverBasedMenuTracking() )
- return;
- OnTrackPopup( point, false, false );
- }
- else
- {
- CExtControlBar::stat_SetMessageString(
- GetCmdTargetWnd(),
- (UINT)(
- ( // ( ! pBar->IsKindOf(RUNTIME_CLASS(CExtMenuControlBar)) )
- ( ! pBar->_IsSimplifiedDropDownButtons() )
- && ( ! IsKindOf(RUNTIME_CLASS(CExtBarContentExpandButton)) )
- && CExtCmdManager::IsCommand( GetCmdID(false) )
- )
- ? GetCmdID(true)
- : AFX_IDS_IDLEMESSAGE
- )
- );
- }
- CWnd * pCtrl = CtrlGet();
- if( pCtrl == NULL
- || ( pCtrl->GetStyle() & WS_VISIBLE ) == 0
- )
- {
- CExtMouseCaptureSink * pMCS = (CExtMouseCaptureSink *)GetBar();
- if( pMCS != NULL )
- pMCS->SetCapture( pBar->GetSafeHwnd() );
- }
- } // if( bOn )
- else
- {
- if( ! CExtPopupMenuWnd::IsMenuTracking() )
- m_bDropDownHT = false;
- CExtControlBar::stat_SetMessageString( GetCmdTargetWnd() );
- if( ::GetCapture() == pBar->m_hWnd
- && pBar->_GetHoverButtonIndex() < 0
- )
- CExtMouseCaptureSink::ReleaseCapture();
- } // else from if( bOn )
- }
- void CExtBarButton::OnHovering(
- CPoint point,
- bool & bSuspendTips
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- point;
- bSuspendTips;
- }
- CExtBarButton * CExtBarButton::g_pTrackingMenuTBB = NULL;
- void CExtBarButton::OnClick(
- CPoint point,
- bool bDown
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- CExtToolControlBar * pBar = GetBar();
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return;
- bool bDropDownHT = false;
- if( GetSeparatedDropDown() )
- {
- CRect rcBtnDropDownArea = RectDropDown();
- if( rcBtnDropDownArea.PtInRect(point) )
- bDropDownHT = true;
- }
- if( IsDisabled()
- && ( (! CanBePressedInDisabledState() )
- || (! bDropDownHT )
- )
- )
- return;
- if( bDown )
- {
- bool bThisButtonTrackingMenu = ( g_pTrackingMenuTBB == this && CExtPopupMenuWnd::IsMenuTracking() ) ? true : false;
- CExtToolControlBar::_CloseTrackingMenus();
- bool bAllowTrackMenu = true;
- m_bDropDownHT = false;
- if( GetSeparatedDropDown() )
- {
- m_bDropDownHT = bDropDownHT;
- if( ! bDropDownHT )
- bAllowTrackMenu = false;
- }
- if( bAllowTrackMenu && IsAbleToTrackMenu() )
- {
- if( CExtToolControlBar::g_bMenuTracking
- && pBar->_GetIndexOf(this) == pBar->m_nBtnIdxMenuTracking
- )
- return;
- CExtToolControlBar::g_bMenuTrackingExpanded = false;
- if( ! bThisButtonTrackingMenu )
- OnTrackPopup( point, false, false );
- else
- {
- CExtPopupMenuWnd::CancelMenuTracking();
- CExtBarButton::g_pTrackingMenuTBB = NULL;
- }
- return;
- }
- CExtControlBar::stat_SetMessageString(
- GetCmdTargetWnd(),
- (UINT)GetCmdID(false)
- );
- return;
- } // if( bDown )
- CExtControlBar::stat_SetMessageString( GetCmdTargetWnd() );
- if( ! m_bDropDownHT )
- bDropDownHT = false;
- m_bDropDownHT = false;
- if( (IsAbleToTrackMenu() && (!GetSeparatedDropDown()))
- || bDropDownHT
- )
- return;
- CWnd * pCtrl = CtrlGet();
- if( pCtrl != NULL
- && ( pCtrl->GetStyle() & WS_VISIBLE ) != 0
- )
- {
- ASSERT_VALID( pCtrl );
- CExtToolControlBar * pBar = GetSafeBar();
- ASSERT_VALID( pBar );
- if( CWnd::GetCapture() == pBar )
- pBar->SendMessage( WM_CANCELMODE );
- //pCtrl->SetFocus();
- return;
- }
- OnDeliverCmd();
- }
- bool CExtBarButton::OnRClick(
- CPoint point,
- bool bDown
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- point;
- bDown;
- return false;
- }
- bool CExtBarButton::OnDblClick(
- CPoint point
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- point;
- if( g_pTrackingMenuTBB == this )
- {
- CExtPopupMenuWnd::CancelMenuTracking();
- CExtBarButton::g_pTrackingMenuTBB = NULL;
- }
- return false;
- }
- void CExtBarButton::OnDeliverCmd()
- {
- ASSERT_VALID( this );
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- if( pBar->OnDeliverCmd( this ) )
- return;
- if( ! CExtCmdManager::IsCommand( GetCmdID(false) ) )
- return;
- CExtCmdItem * pCmdItem =
- g_CmdManager->CmdGetPtr(
- g_CmdManager->ProfileNameFromWnd( pBar->GetSafeHwnd() ),
- GetCmdID(true)
- );
- // ASSERT( pCmdItem != NULL );
- if( pCmdItem == NULL )
- return;
- // the command may be undelivered (i.e. pCmdItem->Deliver() will
- // return "false") because no command handler found for it
- pCmdItem->Deliver(
- pBar,
- true
- );
- }
- __EXT_MFC_INT_PTR CExtBarButton::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
- point; // should be inside this button
- if( ! IsDisplayScreenTip() )
- return -1;
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- m_bDropDownHT = false;
- if( GetSeparatedDropDown() )
- {
- CRect rcBtnDropDownArea = RectDropDown();
- if( rcBtnDropDownArea.PtInRect(point) )
- m_bDropDownHT = true;
- }
- pBar->m_bLastDropDownHT = m_bDropDownHT;
- int nCmdID = (int)GetCmdID(true);
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode( true );
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- CExtCustomizeCmdScreenTip * pCCST = pNode->CmdScreenTipFindForDisplaying( ! m_bDropDownHT );
- if( pCCST != NULL )
- {
- ASSERT_VALID( pCCST );
- if( ! pCCST->IsEmpty() )
- {
- if( pTI != NULL )
- {
- CRect rcArea = m_bDropDownHT ? RectDropDown() : RectWithoutDropDown();
- ::CopyRect(
- &(pTI->rect),
- &rcArea
- );
- pTI->uId = (UINT)nCmdID;
- pTI->hwnd = GetSafeBar()->GetSafeHwnd();
- //pTI->lpszText = LPSTR_TEXTCALLBACK;
- pTI->lpszText = _tcsdup( _T("ScreenTip") );
- } // if( pTI != NULL )
- return (__EXT_MFC_INT_PTR)nCmdID;
- } // if( ! pCCST->IsEmpty() )
- } // if( pCCST != NULL )
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCmdItem * pCmdItem =
- g_CmdManager->CmdGetPtr(
- g_CmdManager->ProfileNameFromWnd( GetSafeBar()->GetSafeHwnd() ),
- nCmdID
- );
- if( pCmdItem == NULL )
- return -1;
- if( pCmdItem->m_sTipTool.IsEmpty() )
- return -1;
- if( pTI != NULL )
- {
- CRect rcArea = Rect();
- ::CopyRect(
- &(pTI->rect),
- &rcArea
- );
- CExtSafeString strTip = pCmdItem->m_sTipTool;
- if( IsDisplayShortcutKeysOnScreenTip()
- && ( ! pCmdItem->m_sAccelText.IsEmpty() )
- )
- {
- if( ! strTip.IsEmpty() )
- strTip += _T(" ");
- strTip += _T("(");
- strTip += pCmdItem->m_sAccelText;
- strTip += _T(")");
- }
- pTI->uId = (UINT)nCmdID;
- pTI->hwnd = GetSafeBar()->GetSafeHwnd();
- pTI->lpszText = (LPTSTR)
- ::calloc(
- (strTip.GetLength() + 1),
- sizeof(TCHAR)
- );
- if( pTI->lpszText != NULL )
- __EXT_MFC_STRCPY(
- pTI->lpszText,
- strTip.GetLength() + 1,
- strTip
- );
- else
- pTI->lpszText = LPSTR_TEXTCALLBACK;
- } // if( pTI != NULL )
- return (__EXT_MFC_INT_PTR)nCmdID;
- }
- LRESULT CExtBarButton::OnHelpHitTest(
- CPoint point
- )
- {
- ASSERT_VALID( this );
- point; // should be inside this button
- if( IsSeparator() )
- return -1;
- if( IsAbleToTrackMenu() )
- {
- CExtToolControlBar * pBar = GetBar();
- CFrameWnd * pDockSiteOrOther = pBar->m_pDockSite;
- if( pDockSiteOrOther == NULL
- || (! pDockSiteOrOther->m_bHelpMode )
- )
- {
- pDockSiteOrOther = pBar->GetParentFrame();
- if( pDockSiteOrOther != NULL
- && pDockSiteOrOther->IsKindOf( RUNTIME_CLASS(CExtMiniDockFrameWnd) )
- )
- pDockSiteOrOther = pDockSiteOrOther->GetParentFrame();
- if( pDockSiteOrOther == NULL
- || (! pDockSiteOrOther->m_bHelpMode )
- )
- return -3L;
- }
- OnTrackPopup( point, false, false );
- return CExtToolControlBar::_ContinueHelpHitTestMode( GetBar() );
- } // if( IsAbleToTrackMenu() )
- int nCmdID = (int)GetCmdID(false);
- CExtCmdItem * pCmdItem =
- g_CmdManager->CmdGetPtr(
- g_CmdManager->ProfileNameFromWnd( GetSafeBar()->GetSafeHwnd() ),
- nCmdID
- );
- if( pCmdItem == NULL
- //|| pCmdItem->m_sTipTool.IsEmpty()
- )
- return -1;
- return nCmdID;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarCheckBoxButton
- IMPLEMENT_DYNCREATE(CExtBarCheckBoxButton, CExtBarButton)
-
- CExtBarCheckBoxButton::CExtBarCheckBoxButton(
- CExtToolControlBar * pBar, // = NULL
- UINT nCmdID, // = ID_SEPARATOR
- UINT nStyle // = 0
- )
- : CExtBarButton( pBar, nCmdID, nStyle )
- {
- // m_bAcEnabled = false;
- }
- CExtBarCheckBoxButton::~CExtBarCheckBoxButton()
- {
- }
- INT CExtBarCheckBoxButton::_GetBoxState() const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- bool bPressedTracking =
- IsPressedTracking();
- bool bEnabled =
- ( IsDisabled() && (!bDockSiteCustomizeMode) )
- ? false : true;
- bool bHover =
- ( IsHover() && (!bDockSiteCustomizeMode) )
- ? true : false;
- bool bSelected = false;
- CExtMenuControlBar * pMenuBar =
- DYNAMIC_DOWNCAST( CExtMenuControlBar, pBar );
- if( pMenuBar != NULL )
- {
- INT nIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nIndex >= 0
- && nIndex == pMenuBar->_GetIndexOf( const_cast < CExtBarCheckBoxButton * > ( this ) )
- )
- bSelected = true;
- }
- if( bSelected )
- bHover = true;
- if( (! bDockSiteCustomizeMode )
- && (! GetBar()->IsForceHoverWhenMenuTracking() )
- )
- {
- if( CExtToolControlBar::g_bMenuTracking
- || CExtPopupMenuWnd::IsMenuTracking()
- )
- bHover = false;
- else if( !bHover )
- bHover = IsPressedTracking();
- } // if( ! bDockSiteCustomizeMode ...
- bool bChecked =
- ( (GetStyle()&TBBS_CHECKED) != 0 )
- ? true
- : false;
- bool bIndeterminate =
- ( IsIndeterminate() && (!bDockSiteCustomizeMode) )
- ? true : false;
- INT nCheck =
- bIndeterminate
- ? BST_INDETERMINATE
- : bChecked
- ? BST_CHECKED
- : BST_UNCHECKED;
- CExtPaintManager::eBoxState_t eState =
- CExtPaintManager::BOX_UNCHECKED;
- switch( nCheck )
- {
- case BST_UNCHECKED:
- if( bEnabled )
- {
- if( bHover && !bPressedTracking )
- eState = CExtPaintManager::BOX_MOUSE_HOVER_UNCHECKED;
- else if( bHover && bPressedTracking )
- eState = CExtPaintManager::BOX_LDOWN_UNCHECKED;
- else
- eState = CExtPaintManager::BOX_UNCHECKED;
- }
- else
- eState = CExtPaintManager::BOX_DISABLED_UNCHECKED;
- break;
-
- case BST_CHECKED:
- if( bEnabled )
- {
- if( bHover && !bPressedTracking )
- eState = CExtPaintManager::BOX_MOUSE_HOVER_CHECKED;
- else if( bHover && bPressedTracking )
- eState = CExtPaintManager::BOX_LDOWN_CHECKED;
- else
- eState = CExtPaintManager::BOX_CHECKED;
- }
- else
- eState = CExtPaintManager::BOX_DISABLED_CHECKED;
- break;
-
- case BST_INDETERMINATE:
- if( bEnabled )
- {
- if( bHover && !bPressedTracking )
- eState = CExtPaintManager::BOX_MOUSE_HOVER_INDETERMINATE;
- else if( bHover && bPressedTracking )
- eState = CExtPaintManager::BOX_LDOWN_INDETERMINATE;
- else
- eState = CExtPaintManager::BOX_INDETERMINATE;
- }
- else
- eState = CExtPaintManager::BOX_DISABLED_INDETERMINATE;
- break;
- } // switch( nCheck )
- return eState;
- }
- CSize CExtBarCheckBoxButton::_GetBoxSize(
- CDC & dc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- bool bHorz = IsHorzBarOrientation();
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- CExtPaintManager::PAINTCHECKRADIOBUTTONDATA _pcrbd;
- _pcrbd.m_pHelperSrc = (CObject*)pBar;
- _pcrbd.m_eState = (CExtPaintManager::eBoxState_t) _GetBoxState();
- _pcrbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- _pcrbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- CSize szBox =
- pBar->PmBridge_GetPM()->GetCheckButtonBoxSize( dc, _pcrbd );
- return szBox;
- }
- CSize CExtBarCheckBoxButton::CalculateLayout(
- CDC & dc,
- CSize sizePreCalc,
- BOOL bHorz
- )
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- CSize szButton =
- CExtBarButton::CalculateLayout(
- dc,
- sizePreCalc,
- bHorz
- );
- CSize szBox = _GetBoxSize( dc );
- if( bHorz )
- {
- szButton.cx += ( szBox.cx + 4 );
- szButton.cy = max( szBox.cy, szButton.cy );
- }
- else
- {
- szButton.cy += ( szBox.cy + 4 );
- szButton.cx = max( szBox.cx, szButton.cx );
- }
- return szButton;
- }
- void CExtBarCheckBoxButton::_PaintBox(
- CDC & dc,
- CRect & rcBox
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- bool bHorz = IsHorzBarOrientation();
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- CExtPaintManager::PAINTCHECKRADIOBUTTONDATA _pcrbd;
- _pcrbd.m_pHelperSrc = (CObject*)pBar;
- _pcrbd.m_rcClient = rcBox;
- _pcrbd.m_rcBox = rcBox;
- _pcrbd.m_eState = (CExtPaintManager::eBoxState_t) _GetBoxState();
- _pcrbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- _pcrbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- pBar->PmBridge_GetPM()->PaintCheckButtonBox(
- dc,
- _pcrbd
- );
- }
- void CExtBarCheckBoxButton::PaintCompound(
- CDC & dc,
- bool bPaintParentChain,
- bool bPaintChildren,
- bool bPaintOneNearestChildrenLevelOnly
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( (&dc) );
- ASSERT( ! IsSeparator() );
- if( ! IsPaintAble( dc ) )
- return;
- if( AnimationClient_StatePaint( dc ) )
- return;
- if( bPaintParentChain )
- PaintParentChain( dc );
- CWnd * pCtrl = CtrlGet();
- if( ( pCtrl != NULL )
- && ( ( ! m_bVertDocked )
- || GetCtrlVisibleVertically()
- )
- )
- return;
- CRect rcArea( m_ActiveRect );
- if( rcArea.right <= rcArea.left
- || rcArea.bottom <= rcArea.top
- )
- return;
- if( (! IsVisible() )
- || (GetStyle() & TBBS_HIDDEN) != 0
- || (! dc.RectVisible(&m_ActiveRect) )
- )
- return;
- CRect rcAreaInit( rcArea );
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bool bHorz = IsHorzBarOrientation();
- CRect rcBox( 0,0,0,0 );
- CSize szBox = _GetBoxSize( dc );
- rcBox.SetRect(
- 0, 0,
- szBox.cx, szBox.cy
- );
- rcBox.OffsetRect(
- rcArea.TopLeft()
- );
- if( bHorz )
- {
- rcBox.OffsetRect(
- 0,
- (rcArea.Height() - szBox.cy) / 2
- );
- rcArea.left += (szBox.cx + 4);
- }
- else
- {
- rcBox.OffsetRect(
- (rcArea.Width() - szBox.cx) / 2,
- 0
- );
- rcArea.top += (szBox.cy + 4);
- }
- _PaintBox(
- dc,
- rcBox
- );
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- bool bPushed =
- ( IsPressed() && (!bDockSiteCustomizeMode) )
- ? true : false;
- bool bEnabled =
- ( IsDisabled() && (!bDockSiteCustomizeMode) )
- ? false : true;
- bool bHover =
- ( IsHover() && (!bDockSiteCustomizeMode) )
- ? true : false;
- if( (! bDockSiteCustomizeMode )
- && (! GetBar()->IsForceHoverWhenMenuTracking() )
- )
- {
- if( CExtToolControlBar::g_bMenuTracking
- || CExtPopupMenuWnd::IsMenuTracking()
- )
- bHover = false;
- else if( !bHover )
- bHover = IsPressedTracking();
- //if( bPushed && bHover && IsPressedTracking() )
- //bHover = false;
- } // if( ! bDockSiteCustomizeMode ...
- bool bIndeterminate =
- ( IsIndeterminate() && (!bDockSiteCustomizeMode) )
- ? true : false;
- bool bSelected = false;
- CExtMenuControlBar * pMenuBar =
- DYNAMIC_DOWNCAST( CExtMenuControlBar, pBar );
- if( pMenuBar != NULL )
- {
- INT nIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nIndex >= 0
- && nIndex == pMenuBar->_GetIndexOf( this )
- )
- bSelected = true;
- }
- CExtCmdIcon * pIcon = GetIconPtr();
- CExtCmdIcon * pIconLarge = NULL;
- if( pIcon != NULL
- && (! pIcon->IsEmpty() )
- && IsLargeIcon()
- )
- {
- CSize _sizeIcon = pIcon->GetSize();
- _sizeIcon.cx *= 2;
- _sizeIcon.cy *= 2;
- pIconLarge = new CExtCmdIcon;
- if( pIconLarge->CreateScaledCopy(
- *pIcon,
- _sizeIcon
- )
- )
- pIcon = pIconLarge;
- #ifdef _DEBUG
- else
- {
- ASSERT( FALSE );
- }
- #endif // _DEBUG
- }
- CExtSafeString sText = GetText();
- HFONT hFont =
- (HFONT) pBar
- -> OnGetToolbarFont( ! bHorz, false )
- -> GetSafeHandle();
- CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(
- this,
- bHorz,
- rcArea,
- sText,
- pIcon,
- true, // bFlat
- false, // bHover,
- false, // bPushed,
- bIndeterminate,
- bEnabled,
- false, // bDrawBorder
- bSelected, // bDrawFocusRect
- false, // bDefaultPushButton
- 0,
- hFont,
- ( IsAbleToTrackMenu()
- && (! pBar->_IsSimplifiedDropDownButtons() )
- ) ? true : false,
- 0,
- true // bTransparentBackground
- );
- _ppbd.m_rcBorderSizes = OnQueryBorderSizes( bHorz );
- _ppbd.m_nIconAlignment = OnQueryAlignmentIcon( bHorz );
- _ppbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- _ppbd.m_rcIconMargins = OnQueryMarginsIcon( bHorz );
- _ppbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- if( GetSeparatedDropDown() )
- {
- _ppbd.m_bSeparatedDropDown = true;
- if( m_bDropDownHT
- && bPushed
- && ( ! bDockSiteCustomizeMode )
- )
- _ppbd.m_bPushedDropDown = true;
- }
- _ppbd.m_clrCustomAccentEffectForIcon =
- OnQueryCustomAccentEffectForIcon( dc );
- pBar->PmBridge_GetPM()->PaintPushButton( dc, _ppbd );
- // CExtPaintManager::PAINTCHECKRADIOBUTTONDATA _pcrbd(
- // this,
- // (CExtPaintManager::eBoxState_t) _GetBoxState(),
- // false,
- // OnQueryMaxButtonWidth( bHorz ) >= 0 ? true : false,
- // rcArea,
- // (LPCTSTR) sText,
- // bHover,
- // bPushed,
- // bEnabled,
- // bSelected,
- // 0,
- // hFont,
- // true
- // );
- // _pcrbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- // _pcrbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- //
- // pBar->PmBridge_GetPM()->PaintCheckButton( dc, _pcrbd );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = pBar->GetCustomizeSite();
- if( pSite != NULL
- && pSite->IsCustomizeMode()
- && pSite->CustomizedNodeGet() != NULL
- && pSite->CustomizedNodeGet() == GetCmdNode( false )
- )
- {
- pBar->PmBridge_GetPM()->PaintDragSourceRect(
- dc,
- rcAreaInit
- );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( pIconLarge != NULL )
- delete pIconLarge;
- if( bPaintChildren )
- PaintChildren( dc, bPaintOneNearestChildrenLevelOnly );
- }
- CExtCmdIcon * CExtBarCheckBoxButton::GetIconPtr()
- {
- ASSERT_VALID( this );
- return NULL;
- }
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- bool CExtBarCheckBoxButton::IsNoRibbonLayout() const
- {
- ASSERT_VALID( this );
- return true;
- }
- INT CExtBarCheckBoxButton::RibbonILV_Get(
- INT nType // = 0 // -1 min, 0 current, 1 - max
- ) const
- {
- ASSERT_VALID( this );
- nType;
- return __EXT_RIBBON_ILV_SIMPLE_NORMAL;
- }
- CSize CExtBarCheckBoxButton::RibbonILV_CalcSize(
- CDC & dc,
- INT nILV // = -1 // -1 use current visual level
- ) const
- {
- ASSERT_VALID( this );
- nILV;
- return
- ( const_cast < CExtBarCheckBoxButton * > ( this ) )
- -> CalculateLayout( dc, CSize(0,0), IsHorzBarOrientation() );
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarRadioBoxButton
- IMPLEMENT_DYNCREATE(CExtBarRadioBoxButton, CExtBarCheckBoxButton)
- CExtBarRadioBoxButton::CExtBarRadioBoxButton(
- CExtToolControlBar * pBar, // = NULL
- UINT nCmdID, // = ID_SEPARATOR
- UINT nStyle // = 0
- )
- : CExtBarCheckBoxButton( pBar, nCmdID, nStyle )
- {
- }
- CExtBarRadioBoxButton::~CExtBarRadioBoxButton()
- {
- }
- INT CExtBarRadioBoxButton::_GetBoxState() const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( !IsSeparator() );
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- bool bPressedTracking =
- IsPressedTracking();
- bool bEnabled =
- ( IsDisabled() && (!bDockSiteCustomizeMode) )
- ? false : true;
- bool bHover =
- ( IsHover() && (!bDockSiteCustomizeMode) )
- ? true : false;
- bool bSelected = false;
- CExtMenuControlBar * pMenuBar =
- DYNAMIC_DOWNCAST( CExtMenuControlBar, pBar );
- if( pMenuBar != NULL )
- {
- INT nIndex = pMenuBar->_FlatTrackingIndexGet();
- if( nIndex >= 0
- && nIndex == pMenuBar->_GetIndexOf( const_cast < CExtBarRadioBoxButton * > ( this ) )
- )
- bSelected = true;
- }
- if( bSelected )
- bHover = true;
- if( (! bDockSiteCustomizeMode )
- && (! GetBar()->IsForceHoverWhenMenuTracking() )
- )
- {
- if( CExtToolControlBar::g_bMenuTracking
- || CExtPopupMenuWnd::IsMenuTracking()
- )
- bHover = false;
- else if( !bHover )
- bHover = IsPressedTracking();
- } // if( ! bDockSiteCustomizeMode ...
- bool bChecked =
- ( (GetStyle()&TBBS_CHECKED) != 0 )
- ? true
- : false;
- bool bIndeterminate =
- ( IsIndeterminate() && (!bDockSiteCustomizeMode) )
- ? true : false;
- INT nCheck =
- (bChecked || bIndeterminate)
- ? BST_CHECKED
- : BST_UNCHECKED;
- CExtPaintManager::eBoxState_t eState =
- CExtPaintManager::BOX_UNCHECKED;
- switch( nCheck )
- {
- case BST_UNCHECKED:
- if( bEnabled )
- {
- if( bHover && !bPressedTracking )
- eState = CExtPaintManager::BOX_MOUSE_HOVER_UNCHECKED;
- else if( bHover && bPressedTracking )
- eState = CExtPaintManager::BOX_LDOWN_UNCHECKED;
- else
- eState = CExtPaintManager::BOX_UNCHECKED;
- }
- else
- eState = CExtPaintManager::BOX_DISABLED_UNCHECKED;
- break;
-
- case BST_CHECKED:
- if( bEnabled )
- {
- if( bHover && !bPressedTracking )
- eState = CExtPaintManager::BOX_MOUSE_HOVER_CHECKED;
- else if( bHover && bPressedTracking )
- eState = CExtPaintManager::BOX_LDOWN_CHECKED;
- else
- eState = CExtPaintManager::BOX_CHECKED;
- }
- else
- eState = CExtPaintManager::BOX_DISABLED_CHECKED;
- break;
- } // switch( nCheck )
- return eState;
- }
- CSize CExtBarRadioBoxButton::_GetBoxSize(
- CDC & dc
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- bool bHorz = IsHorzBarOrientation();
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- CExtPaintManager::PAINTCHECKRADIOBUTTONDATA _pcrbd;
- _pcrbd.m_pHelperSrc = (CObject*)pBar;
- _pcrbd.m_eState = (CExtPaintManager::eBoxState_t) _GetBoxState();
- _pcrbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- _pcrbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- CSize szBox =
- pBar->PmBridge_GetPM()->GetRadioButtonBoxSize( dc, _pcrbd );
- return szBox;
- }
- void CExtBarRadioBoxButton::_PaintBox(
- CDC & dc,
- CRect & rcBox
- ) const
- {
- ASSERT_VALID( this );
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- bool bHorz = IsHorzBarOrientation();
- const CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- CExtPaintManager::PAINTCHECKRADIOBUTTONDATA _pcrbd;
- _pcrbd.m_pHelperSrc = (CObject*)pBar;
- _pcrbd.m_rcClient = rcBox;
- _pcrbd.m_rcBox = rcBox;
- _pcrbd.m_eState = (CExtPaintManager::eBoxState_t) _GetBoxState();
- _pcrbd.m_nTextAlignment = OnQueryAlignmentText( bHorz );
- _pcrbd.m_rcTextMargins = OnQueryMarginsText( bHorz );
- pBar->PmBridge_GetPM()->PaintRadioButtonBox(
- dc,
- _pcrbd
- );
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarLabelButton
- IMPLEMENT_DYNCREATE(CExtBarLabelButton, CExtBarButton)
-
- CExtBarLabelButton::CExtBarLabelButton(
- CExtToolControlBar * pBar, // = NULL
- UINT nCmdID, // = ID_SEPARATOR
- UINT nStyle // = 0
- )
- : CExtBarButton( pBar, nCmdID, nStyle )
- {
- m_bAcEnabled = false;
- }
- CExtBarLabelButton::~CExtBarLabelButton()
- {
- }
- CExtCmdIcon * CExtBarLabelButton::GetIconPtr()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return NULL;
- }
- void CExtBarLabelButton::OnUpdateCmdUI(
- CWnd * pTarget,
- BOOL bDisableIfNoHndler,
- int nIndex
- )
- {
- ASSERT_VALID( this );
- pTarget;
- bDisableIfNoHndler;
- nIndex;
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- UINT nOldStyle = pBar->GetButtonStyle( nIndex );
- UINT nNewStyle = nOldStyle & (~(TBBS_DISABLED));
- if( nOldStyle != nNewStyle )
- pBar->SetButtonStyle( nIndex, nNewStyle );
- }
- bool CExtBarLabelButton::IsHover() const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return false;
- }
- bool CExtBarLabelButton::IsPressed() const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return false;
- }
- bool CExtBarLabelButton::IsPressedTracking() const
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return false;
- }
- bool CExtBarLabelButton::AnimationClient_OnQueryEnabledState(
- INT eAPT // __EAPT_*** animation type
- ) const
- {
- ASSERT_VALID( this );
- eAPT;
- return false;
- }
- void CExtBarLabelButton::SetHover(
- bool bHover // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- bHover;
- }
- void CExtBarLabelButton::OnHover(
- CPoint point,
- bool bOn,
- bool & bSuspendTips
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- point;
- bOn;
- bSuspendTips;
- }
- void CExtBarLabelButton::OnClick(
- CPoint point,
- bool bDown
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- point;
- bDown;
- }
- BOOL CExtBarLabelButton::PutToPopupMenu(
- CExtPopupMenuWnd * pPopup
- )
- {
- ASSERT_VALID( this );
- ASSERT( pPopup != NULL );
- ASSERT( pPopup->GetSafeHwnd() == NULL );
- pPopup;
- return TRUE;
- }
- bool CExtBarLabelButton::OnQueryFlatTrackingEnabled() const
- {
- ASSERT_VALID( this );
- return false;
- }
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- bool CExtBarLabelButton::IsNoRibbonLayout() const
- {
- ASSERT_VALID( this );
- return true;
- }
- INT CExtBarLabelButton::RibbonILV_Get(
- INT nType // = 0 // -1 min, 0 current, 1 - max
- ) const
- {
- ASSERT_VALID( this );
- nType;
- return __EXT_RIBBON_ILV_SIMPLE_NORMAL;
- }
- CSize CExtBarLabelButton::RibbonILV_CalcSize(
- CDC & dc,
- INT nILV // = -1 // -1 use current visual level
- ) const
- {
- ASSERT_VALID( this );
- nILV;
- return
- ( const_cast < CExtBarLabelButton * > ( this ) )
- -> CalculateLayout( dc, CSize(0,0), IsHorzBarOrientation() );
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarColorButton
- IMPLEMENT_DYNCREATE(CExtBarColorButton, CExtBarButton)
- void CExtBarColorButton::OnSyncIcon()
- {
- ASSERT_VALID( this );
- CExtToolControlBar * pBar = GetSafeBar();
- if( pBar->GetSafeHwnd() == NULL )
- return;
- LPCTSTR strCommandProfileName = g_CmdManager->ProfileNameFromWnd( pBar->GetSafeHwnd() );
- if( strCommandProfileName == NULL )
- return;
- CExtCmdIcon icon;
- OnGenerateColorIcon( icon );
- g_CmdManager->CmdSetIcon( strCommandProfileName, GetCmdID(true), icon );
- }
- CSize CExtBarColorButton::CalculateLayout(
- CDC & dc,
- CSize sizePreCalc,
- BOOL bHorz
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( (&dc) );
- ASSERT( dc.GetSafeHdc() != NULL );
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- CExtToolControlBar * pBar = GetBar();
- if( pBar != NULL
- && pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) )
- )
- {
- CSize _size = RibbonILV_CalcSize( dc );
- return _size;
- }
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- return CExtBarButton::CalculateLayout( dc, sizePreCalc, bHorz );
- }
- void CExtBarColorButton::OnGenerateColorIcon(
- CExtCmdIcon & icon
- )
- {
- ASSERT_VALID( this );
- icon.Empty();
- CExtToolControlBar * pBar = GetBar();
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode(false);
- if( pNode != NULL
- && pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- )
- {
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( pNode );
- CExtCustomizeSite * pSite = pBar->GetCustomizeSite();
- if( pSite != NULL )
- {
- pSite->OnColorItemGenerateIcon( this, pNode, ColorGet(true), icon );
- if( ! icon.IsEmpty() )
- return;
- } // if( pSite != NULL )
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
-
- // switch( m_eDIT )
- // {
- // case __DIT_FRAME:
- // icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconFrame( ColorGet(true) ), false );
- // break;
- // case __DIT_CHAR:
- // {
- // LOGFONT lf;
- // ::memset( &lf, 0 , sizeof(LOGFONT) );
- // pBar->PmBridge_GetPM()->m_FontBold.GetLogFont( &lf );
- // __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Times New Roman") );
- // lf.lfHeight = ::MulDiv( lf.lfHeight, 3, 2 );
- // lf.lfWeight = 900;
- // CFont fontForLetter;
- // VERIFY( fontForLetter.CreateFontIndirect( &lf ) );
- // ASSERT( fontForLetter.GetSafeHandle() != NULL );
- // icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconChar( ColorGet(true), (HFONT)fontForLetter.GetSafeHandle() ), false );
- // }
- // break;
- // //IDB_EXT_TBB_FILL_BOX_TOOL
- // //case __DIT_BOX:
- // default:
- // icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconBox( ColorGet(true) ), false );
- // break;
- // } // switch( m_eDIT )
- CExtPaintManager * pPM = pBar->PmBridge_GetPM();
- COLORREF clr = ColorGet( true );
- if( clr == COLORREF(-1L) )
- {
- VERIFY( icon.m_bmpNormal.FromColor( RGB(0,0,0), CSize(16,16), BYTE(0) ) );
- return;
- }
- CExtBarColorButton::e_def_icon_type_t eDIT = CExtBarColorButton::IconTypeGet();
- switch( eDIT )
- {
- case CExtBarColorButton::__DIT_FRAME:
- icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconFrame( clr ), false );
- break;
- case CExtBarColorButton::__DIT_CHAR:
- {
- LOGFONT lf;
- ::memset( &lf, 0 , sizeof(LOGFONT) );
- pPM->m_FontBold.GetLogFont( &lf );
- __EXT_MFC_STRCPY( lf.lfFaceName, LF_FACESIZE, _T("Times New Roman") );
- lf.lfHeight = ::MulDiv( lf.lfHeight, 3, 2 );
- lf.lfWeight = 900;
- CFont fontForLetter;
- VERIFY(
- fontForLetter.CreateFontIndirect( &lf )
- );
- ASSERT( fontForLetter.GetSafeHandle() != NULL );
- icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconChar( clr, (HFONT)fontForLetter.GetSafeHandle() ), false );
- }
- break;
- case CExtBarColorButton::__DIT_FILL_2007:
- case CExtBarColorButton::__DIT_CHAR_2007:
- {
- icon.Empty();
- icon.m_dwFlags = __EXT_ICON_FLAGS_DEFAULT;
- if( icon.m_bmpNormal.LoadBMP_Resource(
- ( eDIT == CExtBarColorButton::__DIT_FILL_2007 )
- ? ( MAKEINTRESOURCE( IDB_EXT_TBB_COLOR_TOOL_2007_FILL ) )
- : ( MAKEINTRESOURCE( IDB_EXT_TBB_COLOR_TOOL_2007_CHAR ) )
- )
- && icon.m_bmpNormal.Make32( false )
- )
- {
- icon.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), BYTE(0) );
- CRect rcFill( 1, 12, 14, 15 );
- INT nX, nY;
- for( nY = rcFill.top; nY <= rcFill.bottom; nY ++ )
- {
- for( nX = rcFill.left; nX <= rcFill.right; nX ++ )
- icon.m_bmpNormal.SetPixel( nX, nY, clr, 255 );
- }
- }
- }
- break;
- //case CExtBarColorButton::__DIT_BOX:
- default:
- icon.AssignFromHICON( CExtPaintManager::stat_GenerateColorIconBox( clr ), false );
- break;
- } // switch( switch( eDIT ) )
- }
- __EXT_MFC_SAFE_LPCTSTR CExtBarColorButton::BtnTextDefaultGet() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- const CExtToolControlBar * pBar = GetBar();
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL
- && pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- )
- {
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( pNode );
- CExtCustomizeSite * pSite =
- ((CExtToolControlBar *)GetBar())->GetCustomizeSite();
- if( pSite != NULL )
- pSite->OnColorItemGetBtnTextDefault(
- (CExtBarColorButton*)this,
- pNode,
- (CExtSafeString &)m_sBtnTextColorDefault
- );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return
- m_sBtnTextColorDefault.IsEmpty()
- ? _T("")
- : m_sBtnTextColorDefault
- ;
- }
- void CExtBarColorButton::BtnTextDefaultSet(
- __EXT_MFC_SAFE_LPCTSTR sText // = NULL
- )
- {
- ASSERT_VALID( this );
- m_sBtnTextColorDefault =
- (sText == NULL)
- ? _T("")
- : sText
- ;
- }
- __EXT_MFC_SAFE_LPCTSTR CExtBarColorButton::BtnTextCustomGet() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- const CExtToolControlBar * pBar = GetBar();
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL
- && pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- )
- {
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( pNode );
- CExtCustomizeSite * pSite =
- ((CExtToolControlBar *)GetBar())->GetCustomizeSite();
- if( pSite != NULL )
- pSite->OnColorItemGetBtnTextCustom(
- (CExtBarColorButton*)this,
- pNode,
- (CExtSafeString &)m_sBtnTextColorCustom
- );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return
- m_sBtnTextColorCustom.IsEmpty()
- ? _T("")
- : m_sBtnTextColorCustom
- ;
- }
- void CExtBarColorButton::BtnTextCustomSet(
- __EXT_MFC_SAFE_LPCTSTR sText // = NULL
- )
- {
- ASSERT_VALID( this );
- m_sBtnTextColorCustom =
- (sText == NULL)
- ? _T("")
- : sText
- ;
- }
- CExtCmdIcon * CExtBarColorButton::GetIconPtr()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return CExtBarButton::GetIconPtr();
- }
- BOOL CExtBarColorButton::PutToPopupMenu(
- CExtPopupMenuWnd * pPopup
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( CtrlGet() == NULL );
- ASSERT( IsAbleToTrackMenu() );
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( pBar->m_pDockSite != NULL )
- {
- ASSERT_VALID( pBar->m_pDockSite );
- if( !pPopup->ItemInsert( GetCmdID(true) ) )
- {
- ASSERT( FALSE );
- return FALSE;
- }
- CExtPopupMenuWnd::MENUITEMDATA & mi =
- pPopup->ItemGetInfo( pPopup->ItemGetCount() - 1 );
- VERIFY(
- mi.UpdateFromCmdTree(
- pBar->m_pDockSite->m_hWnd,
- GetCmdNode(false),
- GetCmdNode(false)->GetOwnIndex(),
- pPopup
- )
- );
- pPopup->ItemGetInfo(
- pPopup->ItemGetCount() - 1
- ).SetCmdNode( GetCmdNode() );
- if( (pPopup->TrackFlagsGet()&TPMX_PALETTE) != 0 )
- mi.SetChildCombine();
- return TRUE;
- } // if( pBar->m_pDockSite != NULL )
- #endif
- CExtCmdItem * pCmdItem =
- g_CmdManager->CmdGetPtr(
- g_CmdManager->ProfileNameFromWnd( GetSafeBar()->GetSafeHwnd() ),
- GetCmdID(false)
- );
-
- CExtCmdIcon icon;
- CExtCmdIcon * pIcon = GetIconPtr();
- if( pIcon != NULL
- && (!pIcon->IsEmpty())
- )
- icon = *pIcon;
- CExtPopupColorMenuWnd * pColorPopup =
- STATIC_DOWNCAST(
- CExtPopupColorMenuWnd,
- CExtPopupMenuWnd::InstantiatePopupMenu(
- pBar->GetSafeHwnd(),
- RUNTIME_CLASS(CExtPopupColorMenuWnd),
- this
- )
- );
- VERIFY(
- pPopup->ItemInsertSpecPopup(
- pColorPopup,
- -1,
- pCmdItem->m_sMenuText,
- icon
- )
- );
- pColorPopup->m_lParamCookie = LParamCookieGet();
- pColorPopup->m_bEnableBtnColorDefault = IsEnabledBtnColorDefault();
- pColorPopup->m_bEnableBtnColorCustom = IsEnabledBtnColorCustom();
- pColorPopup->m_clrDefault = ColorGet( false );
- pColorPopup->m_clrInitial = ColorGet( true );
- CExtSafeString _s( BtnTextDefaultGet() );
- if( !_s.IsEmpty() )
- pColorPopup->m_sBtnTextColorDefault = _s;
- _s = BtnTextCustomGet();
- if( !_s.IsEmpty() )
- pColorPopup->m_sBtnTextColorCustom = _s;
-
- CExtPopupMenuWnd::MENUITEMDATA & mi =
- pPopup->ItemGetInfo( pPopup->ItemGetCount() - 1 );
- mi.Enable( IsEnabled() ? true : false );
- if( (pPopup->TrackFlagsGet()&TPMX_PALETTE) != 0 )
- mi.SetChildCombine();
- return TRUE;
- }
- bool CExtBarColorButton::CanBePressedInDisabledState()
- {
- return false;
- }
- bool CExtBarColorButton::IsAbleToTrackMenu(
- bool bCustomizeMode // = false
- ) const
- {
- ASSERT_VALID( this );
- if( bCustomizeMode )
- return false;
- return true;
- }
- UINT CExtBarColorButton::OnTrackPopup(
- CPoint point,
- bool bSelectAny,
- bool bForceNoAnimation
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( CtrlGet() == NULL );
- ASSERT( IsAbleToTrackMenu() );
- CExtToolControlBar * pBar = GetBar();
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return UINT(-1L);
- if( !IsEnabled() )
- return UINT(-1L);
- bool bPrevTBMT = CExtToolControlBar::g_bMenuTracking;
- if( CExtToolControlBar::g_bMenuTracking
- //&& CExtPopupMenuWnd::IsMenuTracking()
- && pBar->_GetIndexOf(this) ==
- pBar->GetMenuTrackingButton()
- )
- return UINT(-1L);
- CExtToolControlBar::_CloseTrackingMenus();
- if( pBar->IsFloating() )
- {
- pBar->ActivateTopParent();
- CFrameWnd * pFrame =
- pBar->GetDockingFrame();
- ASSERT_VALID( pFrame );
- pFrame->BringWindowToTop();
- }
- CWnd * pWndCmdTarget = GetCmdTargetWnd();
- ASSERT_VALID( pWndCmdTarget );
- CExtPopupColorMenuWnd * pPopup =
- STATIC_DOWNCAST(
- CExtPopupColorMenuWnd,
- CExtPopupMenuWnd::InstantiatePopupMenu(
- pBar->GetSafeHwnd(),
- RUNTIME_CLASS(CExtPopupColorMenuWnd),
- this
- )
- );
- VERIFY(
- pPopup->CreatePopupMenu(
- GetCmdTargetWnd()->GetSafeHwnd()
- )
- );
- pPopup->m_lParamCookie = LParamCookieGet();
- pPopup->m_bEnableBtnColorDefault = IsEnabledBtnColorDefault();
- pPopup->m_bEnableBtnColorCustom = IsEnabledBtnColorCustom();
- pPopup->m_clrDefault = ColorGet( false );
- pPopup->m_clrInitial = ColorGet( true );
- CExtSafeString _s( BtnTextDefaultGet() );
- if( !_s.IsEmpty() )
- pPopup->m_sBtnTextColorDefault = _s;
- _s = BtnTextCustomGet();
- if( !_s.IsEmpty() )
- pPopup->m_sBtnTextColorCustom = _s;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- pPopup->_CmdNodeSet( GetCmdNode(false) );
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtToolControlBar::g_bMenuTracking = bPrevTBMT;
- CRect rcBtn = Rect();
- pBar->ClientToScreen( &rcBtn );
- pBar->ClientToScreen( &point );
- DWORD dwTrackFlags = OnGetTrackPopupFlags() | TPMX_OWNERDRAW_FIXED;
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) ) )
- dwTrackFlags |= TPMX_COMBINE_NONE|TPMX_RIBBON_MODE|TPMX_NO_HIDE_RARELY;
- else
- dwTrackFlags |= TPMX_COMBINE_DEFAULT;
- #else // (!defined __EXT_MFC_NO_RIBBON_BAR)
- dwTrackFlags |= TPMX_COMBINE_DEFAULT;
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( bSelectAny )
- dwTrackFlags |= TPMX_SELECT_ANY;
- if( CExtToolControlBar::g_bMenuTrackingExpanded )
- dwTrackFlags |= TPMX_NO_HIDE_RARELY;
- if( bForceNoAnimation )
- dwTrackFlags |= TPMX_FORCE_NO_ANIMATION;
- pBar->_SwitchMenuTrackingIndex(
- pBar->_GetIndexOf( this )
- );
- UINT nResultCmdID = (UINT)-1L;
- pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
- if( GetSeparatedDropDown() )
- m_bDropDownHT = true;
- g_pTrackingMenuTBB = this;
- if( ! pPopup->TrackPopupMenu(
- dwTrackFlags,
- point.x,
- point.y,
- &rcBtn,
- GetBar(),
- CExtToolControlBar::_CbPaintCombinedContent,
- &nResultCmdID,
- true
- )
- )
- {
- g_pTrackingMenuTBB = NULL;
- //delete pPopup;
- CExtToolControlBar::_CloseTrackingMenus();
- return UINT(-1L);
- }
- CExtToolControlBar::g_bMenuTracking = true;
- pBar->_SwitchMenuTrackingIndex(
- pBar->_GetIndexOf( this )
- );
- return UINT(-1L);
- }
- __EXT_MFC_INT_PTR CExtBarColorButton::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
- return CExtBarButton::OnToolHitTest( point, pTI );
- }
- LRESULT CExtBarColorButton::OnHelpHitTest(
- CPoint point
- )
- {
- ASSERT_VALID( this );
- // return
- // CExtBarButton::OnHelpHitTest( point );
- point;
- return GetCmdID();
- }
- void CExtBarColorButton::OnUpdateCmdUI(
- CWnd * pTarget,
- BOOL bDisableIfNoHndler,
- int nIndex
- )
- {
- ASSERT_VALID( this );
- CExtBarButton::OnUpdateCmdUI(
- pTarget,
- bDisableIfNoHndler,
- nIndex
- );
- }
- bool CExtBarColorButton::CanStartCommandDrag()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( GetCmdNode() == NULL )
- return false;
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return true;
- }
- LPARAM CExtBarColorButton::LParamCookieGet() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- return pNode->GetLParam();
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return m_lParamCookie;
- }
- void CExtBarColorButton::LParamCookieSet(
- LPARAM lParamCookie // = 0L
- )
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- pNode->SetLParam( lParamCookie );
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- m_lParamCookie = lParamCookie;
- }
- bool CExtBarColorButton::IsEnabledBtnColorDefault() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- return ( (pNode->GetFlags() & __ECTN_TBB_MCB_DEFAULT) != 0 ) ? true : false;
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return m_bEnableBtnColorDefault;
- }
- void CExtBarColorButton::EnableBtnColorDefault(
- bool bEnable // = true
- )
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- pNode->ModifyFlags(
- bEnable ? __ECTN_TBB_MCB_DEFAULT : 0,
- bEnable ? 0 : __ECTN_TBB_MCB_DEFAULT
- );
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- m_bEnableBtnColorDefault = bEnable;
- }
- bool CExtBarColorButton::IsEnabledBtnColorCustom() const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- return ( (pNode->GetFlags() & __ECTN_TBB_MCB_CUSTOM) != 0 ) ? true : false;
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return m_bEnableBtnColorCustom;
- }
- void CExtBarColorButton::EnableBtnColorCustom(
- bool bEnable // = true
- )
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode(false);
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- pNode->ModifyFlags(
- bEnable ? __ECTN_TBB_MCB_CUSTOM: 0,
- bEnable ? 0 : __ECTN_TBB_MCB_CUSTOM
- );
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- m_bEnableBtnColorCustom = bEnable;
- }
- COLORREF CExtBarColorButton::ColorGet( bool bSelected ) const
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- const CExtToolControlBar * pBar = GetBar();
- CExtCustomizeCmdTreeNode * pNode = ((CExtBarButton*)this)->GetCmdNode(false);
- if( pNode != NULL
- && pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- )
- {
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( pNode );
- CExtCustomizeSite * pSite =
- ((CExtToolControlBar *)GetBar())->GetCustomizeSite();
- if( pSite != NULL )
- {
- COLORREF clr = bSelected ? m_clrSelected : m_clrDefault;
- if( pSite->OnColorItemValueGet(
- (CExtBarColorButton*)this,
- pNode,
- clr,
- bSelected
- )
- )
- return clr;
- } // if( pSite != NULL )
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- return bSelected ? m_clrSelected : m_clrDefault;
- }
- void CExtBarColorButton::ColorSet( COLORREF clr, bool bSelected )
- {
- ASSERT_VALID( this );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtToolControlBar * pBar = GetBar();
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode(false);
- if( pNode != NULL
- && pBar->GetSafeHwnd() != NULL
- && ::IsWindow( pBar->GetSafeHwnd() )
- )
- {
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( pNode );
- CExtCustomizeSite * pSite =
- pBar->GetCustomizeSite();
- if( pSite != NULL )
- pSite->OnColorItemValueSet(
- this,
- pNode,
- clr,
- bSelected
- );
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( bSelected )
- {
- if( m_clrSelected != clr )
- {
- m_clrSelected = clr;
- OnSyncIcon();
- }
- }
- else
- {
- if( m_clrDefault != clr )
- {
- m_clrDefault = clr;
- OnSyncIcon();
- }
- }
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- int CExtBarColorButton::CalculateDropOverEffect(
- CPoint point,
- CExtCustomizeSite::CCmdDragInfo & _dragInfo,
- bool bAllowTrackNodePopup // = true
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( !_dragInfo.IsEmpty() );
- bAllowTrackNodePopup;
- return
- CExtBarButton::CalculateDropOverEffect(
- point,
- _dragInfo,
- false
- );
- }
- CExtCustomizeCmdTreeNode * CExtBarColorButton::GetCmdNode(
- bool bInitial // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- return CExtBarButton::GetCmdNode( bInitial );
- }
- void CExtBarColorButton::SetBasicCmdNode(
- CExtCustomizeCmdTreeNode * pNode
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- CExtBarButton::SetBasicCmdNode( pNode );
- }
- void CExtBarColorButton::SetCustomizedCmdNode(
- CExtCustomizeCmdTreeNode * pNode
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- CExtBarButton::SetCustomizedCmdNode( pNode );
- }
- CExtCustomizeCmdTreeNode * CExtBarColorButton::OnCustomizeNodeInit(
- CExtCustomizeSite * pSite,
- CExtCustomizeCmdTreeNode * pParentNode // toolbar node
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- CExtCustomizeCmdTreeNode * pNode =
- CExtBarButton::OnCustomizeNodeInit( pSite, pParentNode );
- ASSERT_VALID( pNode );
- return pNode;
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- void CExtBarColorButton::OnDeliverCmd()
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- if( GetBar()->OnDeliverCmd( this ) )
- return;
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * pNode = GetCmdNode( false );
- if( pNode != NULL )
- {
- ASSERT_VALID( pNode );
- CExtToolControlBar * pBar = GetBar();
- CExtCustomizeSite * pSite = pBar->GetCustomizeSite();
- if( pSite != NULL
- && pSite->OnColorItemChanged(
- this,
- pNode,
- true,
- ColorGet(true),
- LParamCookieGet()
- )
- )
- return;
- } // if( pNode != NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- GetCmdTargetWnd()->SendMessage(
- CExtPopupColorMenuWnd::g_nMsgNotifyColorChangedFinally,
- (WPARAM)ColorGet(true),
- LParamCookieGet()
- );
- }
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarContentExpandButton
- IMPLEMENT_DYNCREATE(CExtBarContentExpandButton, CExtBarButton)
- CExtBarContentExpandButton::CExtBarContentExpandButton(
- CExtToolControlBar * pBar // = NULL
- )
- : CExtBarButton( pBar )
- {
- SetCmdID( __ID_TOOLBAR_RIGHT_BUTTON__ );
- AnimationClient_EnabledSet( false );
- }
- CExtBarContentExpandButton::~CExtBarContentExpandButton()
- {
- }
- CSize CExtBarContentExpandButton::CalculateLayout(
- CDC & dc,
- CSize sizePreCalc,
- BOOL bHorz
- )
- {
- dc;
- ASSERT( CtrlGet() == NULL );
- ASSERT( ! IsSeparator() );
- ASSERT( GetCmdID(false) == __ID_TOOLBAR_RIGHT_BUTTON__ );
- SIZE sizeReal = { 0, 0 };
- CExtToolControlBar * pBar = GetBar();
- if( pBar->PmBridge_GetPM()->Toolbar_GetSizeOfCEB(
- sizeReal,
- sizePreCalc,
- dc,
- bHorz,
- this
- )
- )
- {
- m_ActiveSize = sizeReal;
- return m_ActiveSize;
- }
- CSize _size(
- bHorz ? __RIGHT_BUTTON_HORZ_DX__ : sizePreCalc.cx,
- bHorz ? sizePreCalc.cy : __RIGHT_BUTTON_VERT_DY__
- );
- m_ActiveSize = _size;
- return m_ActiveSize;
- }
- void CExtBarContentExpandButton::PaintCompound(
- CDC & dc,
- bool bPaintParentChain,
- bool bPaintChildren,
- bool bPaintOneNearestChildrenLevelOnly
- )
- {
- ASSERT( CtrlGet() == NULL );
- ASSERT_VALID( (&dc) );
- ASSERT( ! IsSeparator() );
- ASSERT( GetCmdID(false) == __ID_TOOLBAR_RIGHT_BUTTON__ );
- if( ! IsPaintAble( dc ) )
- return;
- if( AnimationClient_StatePaint( dc ) )
- return;
- if( bPaintParentChain )
- PaintParentChain( dc );
- CRect rcArea( m_ActiveRect );
- if( rcArea.right <= rcArea.left
- || rcArea.bottom <= rcArea.top
- )
- return;
- CExtToolControlBar * pBar = GetBar();
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- bool bEnabled =
- ( (!IsDisabled()) || bDockSiteCustomizeMode )
- ? true : false;
- bool bBarIsCompletelyVisible =
- (GetButtons().GetSize() == 0) ? true : false;
- bool bEmpty =
- ( (!pBar->m_bRightButtonDisplayBarsList)
- && bBarIsCompletelyVisible
- ) ? true : false;
- bool bPushed =
- ( (!bEmpty) && bEnabled && IsPressed() && (!bDockSiteCustomizeMode) )
- ? true : false;
- bool bHover =
- ( (!bEmpty)
- && bEnabled
- && (!bDockSiteCustomizeMode)
- && IsHover()
- && !CExtToolControlBar::g_bMenuTracking
- && !CExtPopupMenuWnd::IsMenuTracking()
- ) ? true : false;
- bool bHorz = IsHorzBarOrientation();
- pBar->PmBridge_GetPM()->PaintToolbarExpandButton(
- dc,
- rcArea,
- bHorz,
- bBarIsCompletelyVisible,
- bEnabled && !bEmpty,
- bPushed,
- bHover,
- this,
- 0L,
- ( (!bHover) && (!bPushed) )
- );
- if( bPaintChildren )
- PaintChildren( dc, bPaintOneNearestChildrenLevelOnly );
- }
- BOOL CExtBarContentExpandButton::PutToPopupMenu(
- CExtPopupMenuWnd * pPopup
- )
- {
- pPopup;
- ASSERT( FALSE );
- return FALSE;
- }
- UINT CExtBarContentExpandButton::OnGetTrackPopupFlags()
- {
- ASSERT_VALID( this );
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- DWORD dwTrackFlags = CExtBarButton::OnGetTrackPopupFlags();
- if( pBar->IsPaletteChevronMenu() )
- dwTrackFlags |= TPMX_PALETTE;
- else
- dwTrackFlags &= ~TPMX_PALETTE;
- dwTrackFlags &= ~(TPMX_COMBINE_MASK);
- if( pBar->PmBridge_GetPM()->IsToolBarChevronMenuCombined() )
- dwTrackFlags |= TPMX_COMBINE_DEFAULT;
- return dwTrackFlags;
- }
- UINT CExtBarContentExpandButton::OnTrackPopup(
- CPoint point,
- bool bSelectAny,
- bool bForceNoAnimation
- )
- {
- ASSERT_VALID( this );
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return UINT(-1L);
- if( !IsEnabled() )
- return UINT(-1L);
- bool bPrevTBMT = CExtToolControlBar::g_bMenuTracking;
- if( CExtToolControlBar::g_bMenuTracking
- //&& CExtPopupMenuWnd::IsMenuTracking()
- && pBar->_GetIndexOf(this) ==
- pBar->m_nBtnIdxMenuTracking
- )
- return UINT(-1L);
- bool bBarIsCompletelyVisible =
- (GetButtons().GetSize() == 0) ? true : false;
- bool bEmpty =
- ( !pBar->m_bRightButtonDisplayBarsList
- && bBarIsCompletelyVisible
- ) ? true : false;
- if( bEmpty )
- return UINT(-1L);
- CExtToolControlBar::_CloseTrackingMenus();
- CExtToolControlBar::g_bMenuTracking = bPrevTBMT;
- if( pBar->IsFloating() )
- {
- pBar->ActivateTopParent();
- CFrameWnd * pFrame =
- pBar->GetParentFrame();
- if( pFrame != NULL )
- pFrame->BringWindowToTop();
- }
- HWND hWndTrack = GetCmdTargetWnd()->GetSafeHwnd();
- ASSERT(
- hWndTrack != NULL
- && ::IsWindow(hWndTrack)
- );
- DWORD dwTrackFlags =
- OnGetTrackPopupFlags()
- | TPMX_OWNERDRAW_FIXED
- ;
- #if (!defined __EXT_MFC_NO_RIBBON_BAR)
- if( pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) ) )
- dwTrackFlags |= TPMX_COMBINE_NONE|TPMX_RIBBON_MODE|TPMX_NO_HIDE_RARELY;
- #endif // (!defined __EXT_MFC_NO_RIBBON_BAR)
- CExtPopupMenuWnd * pPopup = OnCreatePopupMenuWnd();
- ASSERT_VALID( pPopup );
- VERIFY( pPopup->CreatePopupMenu(hWndTrack) );
- pPopup->TrackFlagsSet( dwTrackFlags );
- CExtControlBar::POPUP_MENU_EVENT_DATA _pmed(
- CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CTXEXPBTN_TOP,
- pPopup,
- GetBar(),
- CPoint( -1, -1 ),
- WM_NCLBUTTONDOWN,
- this
- );
- if( !_pmed.NotifyTarget( false ) )
- {
- // append hidden buttons
- __EXT_MFC_INT_PTR nCount = GetButtons().GetSize();
- if( nCount != 0 )
- {
- ASSERT( nCount > 0 );
- int nCountBefore = pPopup->ItemGetCount();
- for( int i=0; i < nCount; i++ )
- {
- CExtBarButton * pTBB = GetButtons() [i];
- ASSERT( pTBB != NULL );
- if( i==0 && pTBB->IsSeparator() )
- continue;
- ASSERT( ! pTBB->IsKindOf(RUNTIME_CLASS(CExtBarContentExpandButton)) );
- VERIFY( pTBB->PutToPopupMenu(pPopup) );
- } // for( int i=0; i< nCount; i++ )
- if( (dwTrackFlags&TPMX_PALETTE) != NULL )
- {
- pPopup->ItemRemoveAllSeparators();
- pPopup->ResetPaletteWrapping( true );
- }
- int nCountAfter = pPopup->ItemGetCount();
- ASSERT( nCountAfter >= nCountBefore );
- if( nCountAfter != nCountBefore
- && (! (pBar->m_bPresubclassDialogMode) )
- && pBar->m_bRightButtonDisplayBarsList
- )
- {
- // append separator
- VERIFY(
- pPopup->ItemInsert(
- CExtPopupMenuWnd::TYPE_SEPARATOR
- )
- );
- }
- } // if( nCount != 0 )
- // append show/hide popup
- if( (! (pBar->m_bPresubclassDialogMode) )
- && pBar->m_bRightButtonDisplayBarsList
- )
- {
- CFrameWnd * pFrame = pBar->_GetDockingFrameImpl();
- if( pFrame != NULL )
- {
- ASSERT_VALID( pFrame );
- CExtSafeString sShowHidePanels;
- if( ! g_ResourceManager->LoadString( sShowHidePanels, IDS_SHOW_HIDE_PANELS ) )
- sShowHidePanels = _T("&Show/hide panels");
- CExtControlBar::POPUP_MENU_EVENT_DATA _pmed(
- CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CTXEXPBTN_APPEND,
- pPopup,
- GetBar(),
- CPoint( -1, -1 ),
- WM_NCLBUTTONDOWN,
- this
- );
-
- if( ! _pmed.NotifyTarget( false ) )
- {
- VERIFY(
- pPopup->ItemInsert(
- (UINT)CExtPopupMenuWnd::TYPE_POPUP,
- -1,
- sShowHidePanels
- )
- );
- CExtPopupMenuWnd::MENUITEMDATA & mi =
- pPopup->ItemGetInfo( pPopup->ItemGetCount() - 1 );
- mi.SetChildCombine();
- mi.SetToolButton();
- mi.SetToolWrap();
- CExtPopupMenuWnd * pPopupBars = mi.GetPopup();
- ASSERT( pPopupBars != NULL );
- if( ! CExtDockBar::_ConstructDockSiteControlBarPopupMenu(
- pFrame,
- pPopupBars,
- CExtControlBar::POPUP_MENU_EVENT_DATA::__PMED_CTXEXPBTN_BARS,
- GetBar(),
- WM_NCLBUTTONDOWN,
- this
- )
- )
- {
- VERIFY(
- pPopup->ItemRemove(
- pPopup->ItemGetCount() - 1
- )
- );
- }
- } // if( !_pmed.NotifyTarget( false ) )
- _pmed.NotifyTarget( true );
-
- } // if( pFrame != NULL )
- } // if( (!pBar->m_bPresubclassDialogMode) ...
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( pBar->m_bCustomizationAllowed
- && pBar->GetCustomizeSite() != NULL
- )
- { // if customization allowed
- VERIFY(
- CExtDockBar::_AppendAddRemoveButtonsCustomizeMenu(
- pPopup,
- GetBar()
- )
- );
- } // if customization allowed
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- } // if( !_pmed.NotifyTarget( false ) )
- _pmed.NotifyTarget( true );
-
- if( pPopup->ItemGetCount() == 0 )
- {
- delete pPopup;
- return UINT(-1L);
- }
- CRect rcBtn = Rect();
- pBar->ClientToScreen( &rcBtn );
- pBar->ClientToScreen( &point );
- if( bSelectAny )
- dwTrackFlags |= TPMX_SELECT_ANY;
- if( CExtToolControlBar::g_bMenuTrackingExpanded )
- dwTrackFlags |= TPMX_NO_HIDE_RARELY;
- if( bForceNoAnimation )
- dwTrackFlags |= TPMX_FORCE_NO_ANIMATION;
- pBar->_SwitchMenuTrackingIndex(
- pBar->_GetIndexOf( this )
- );
- pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
- if( GetSeparatedDropDown() )
- m_bDropDownHT = true;
- g_pTrackingMenuTBB = this;
- if( ! pPopup->TrackPopupMenu(
- dwTrackFlags,
- point.x,
- point.y,
- &rcBtn,
- GetBar(),
- CExtToolControlBar::_CbPaintCombinedContent,
- NULL,
- true
- )
- )
- {
- g_pTrackingMenuTBB = NULL;
- //delete pPopup;
- CExtToolControlBar::_CloseTrackingMenus();
- return UINT(-1L);
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeSite * pSite = pBar->GetCustomizeSite();
- if( pSite != NULL )
- pSite->BarDefCmdTargetSet( GetBar() );
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtToolControlBar::g_bMenuTracking = true;
- pBar->_SwitchMenuTrackingIndex(
- pBar->_GetIndexOf( this )
- );
- return UINT(-1L);
- }
- void CExtBarContentExpandButton::OnHover(
- CPoint point,
- bool bOn,
- bool & bSuspendTips
- )
- {
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bSuspendTips = false;
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return;
- CExtBarButton::OnHover(
- point,
- bOn,
- bSuspendTips
- );
- }
- void CExtBarContentExpandButton::OnClick(
- CPoint point,
- bool bDown
- )
- {
- CExtToolControlBar * pBar = GetBar();
- ASSERT_VALID( pBar );
- bool bDockSiteCustomizeMode =
- pBar->_IsDockSiteCustomizeMode();
- if( bDockSiteCustomizeMode )
- return;
- if( !bDown )
- return;
- CExtToolControlBar::g_bMenuTrackingExpanded = false;
- bool bThisButtonTrackingMenu = ( g_pTrackingMenuTBB == this ) ? true : false;
- if( ! bThisButtonTrackingMenu )
- OnTrackPopup( point, false, false );
- else
- {
- CExtPopupMenuWnd::CancelMenuTracking();
- CExtBarButton::g_pTrackingMenuTBB = NULL;
- }
- }
- __EXT_MFC_INT_PTR CExtBarContentExpandButton::OnToolHitTest(
- CPoint point,
- TOOLINFO * pTI
- )
- {
- ASSERT_VALID( this );
- point; // should be inside this button
- if( pTI != NULL )
- {
- CRect rcArea = Rect();
- ::CopyRect(
- &(pTI->rect),
- &rcArea
- );
- __EXT_MFC_INT_PTR nCmdID = AFX_IDS_IDLEMESSAGE; //(int)pBar->GetDlgCtrlID();
-
- pTI->uId = (UINT)nCmdID;
- pTI->hwnd = GetSafeBar()->GetSafeHwnd();
- CExtSafeString sExpandTip;
- if( ! g_ResourceManager->LoadString( sExpandTip, IDS_CONTENT_EXPAND_TIP ) )
- sExpandTip = _T("Where are buttons?");
- pTI->lpszText = (LPTSTR)
- ::calloc(
- (sExpandTip.GetLength() + 1),
- sizeof(TCHAR)
- );
- if( pTI->lpszText != NULL )
- __EXT_MFC_STRCPY(
- pTI->lpszText,
- sExpandTip.GetLength() + 1,
- sExpandTip
- );
- else
- pTI->lpszText = LPSTR_TEXTCALLBACK;
- return (__EXT_MFC_INT_PTR)nCmdID;
- } // if( pTI != NULL )
-
- return -1;
- }
- LRESULT CExtBarContentExpandButton::OnHelpHitTest(
- CPoint point
- )
- {
- ASSERT_VALID( this );
- return
- CExtBarButton::OnHelpHitTest( point );
- }
- bool CExtBarContentExpandButton::CanStartCommandDrag()
- {
- ASSERT_VALID( this );
- return false;
- }
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- CExtCustomizeCmdTreeNode * CExtBarContentExpandButton::GetCmdNode(
- bool bInitial // = false
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- bInitial;
- ASSERT( m_pCmdNodeI == NULL );
- ASSERT( m_pCmdNodeC == NULL );
- return NULL;
- }
- void CExtBarContentExpandButton::SetBasicCmdNode(
- CExtCustomizeCmdTreeNode * pNode
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( m_pCmdNodeI == NULL );
- ASSERT( m_pCmdNodeC == NULL );
- ASSERT( FALSE ); // should be never called
- pNode;
- }
- void CExtBarContentExpandButton::SetCustomizedCmdNode(
- CExtCustomizeCmdTreeNode * pNode
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( m_pCmdNodeI == NULL );
- ASSERT( m_pCmdNodeC == NULL );
- ASSERT( FALSE ); // should be never called
- pNode;
- }
- CExtCustomizeCmdTreeNode * CExtBarContentExpandButton::OnCustomizeNodeInit(
- CExtCustomizeSite * pSite,
- CExtCustomizeCmdTreeNode * pParentNode // toolbar node
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT( pSite != NULL );
- ASSERT_VALID( pParentNode );
- pSite;
- pParentNode;
- return NULL; // no customization support
- }
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- /////////////////////////////////////////////////////////////////////////////
- // CExtBarSliderButton
- IMPLEMENT_DYNCREATE(CExtBarSliderButton, CExtBarButton)
- ULONG CExtBarSliderButton::ScrollLimitGet() const
- {
- ASSERT_VALID( this );
- ULONG nScrollPageSize = ScrollPageSizeGet();
- ULONG nScrollTotalRange = ScrollTotalRangeGet();
- ULONG nScrollLimit = nScrollTotalRange;
- if( nScrollLimit > nScrollPageSize )
- {
- const CExtToolControlBar * pBar = GetBar();
- bool bHorz = pBar->IsDockedVertically() ? false : true;
- INT nExtentBtn = bHorz
- ? ScrollButtonExtentHorzGet()
- : ScrollButtonExtentVertGet();
- if( nExtentBtn > 0 )
- nScrollLimit -= nScrollPageSize;
- } // if( nScrollLimit > nScrollPageSize )
- else
- nScrollLimit = 0L;
-
- return nScrollLimit;
- }
- ULONG CExtBarSliderButton::ScrollTotalRangeGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollTotalRange;
- }
- ULONG CExtBarSliderButton::ScrollTotalRangeSet( ULONG nScrollTotalRange )
- {
- ASSERT_VALID( this );
- ULONG nScrollPosOld = ScrollPosGet();
- if( nScrollPosOld > nScrollTotalRange )
- ScrollPosSet( nScrollTotalRange );
- ULONG nScrollTotalRangeOld = ScrollTotalRangeGet();
- m_nScrollTotalRange = nScrollTotalRange;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollTotalRangeOld;
- }
- ULONG CExtBarSliderButton::ScrollPosGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollPos;
- }
- ULONG CExtBarSliderButton::ScrollPosSet( ULONG nScrollPos )
- {
- ASSERT_VALID( this );
- ULONG nScrollPosOld = ScrollPosGet();
- m_nScrollPos = nScrollPos;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollPosOld;
- }
- ULONG CExtBarSliderButton::ScrollPageSizeGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollPageSize;
- }
- ULONG CExtBarSliderButton::ScrollPageSizeSet( ULONG nScrollPageSize )
- {
- ASSERT_VALID( this );
- ULONG nScrollPageSizeOld = ScrollPageSizeGet();
- m_nScrollPageSize = nScrollPageSize;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollPageSizeOld;
- }
- INT CExtBarSliderButton::ScrollButtonExtentHorzGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollButtonExtentH;
- }
- INT CExtBarSliderButton::ScrollButtonExtentHorzSet( INT nScrollButtonExtent )
- {
- ASSERT_VALID( this );
- INT nScrollButtonExtentOld = ScrollButtonExtentHorzGet();
- m_nScrollButtonExtentH = nScrollButtonExtent;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollButtonExtentOld;
- }
- INT CExtBarSliderButton::ScrollButtonExtentVertGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollButtonExtentV;
- }
- INT CExtBarSliderButton::ScrollButtonExtentVertSet( INT nScrollButtonExtent )
- {
- ASSERT_VALID( this );
- INT nScrollButtonExtentOld = ScrollButtonExtentVertGet();
- m_nScrollButtonExtentV = nScrollButtonExtent;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollButtonExtentOld;
- }
- INT CExtBarSliderButton::ScrollControlExtentHorzGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollControlExtentH;
- }
- INT CExtBarSliderButton::ScrollControlExtentHorzSet( INT nScrollControlExtent )
- {
- ASSERT_VALID( this );
- INT nScrollControlExtentOld = ScrollControlExtentHorzGet();
- m_nScrollControlExtentH = nScrollControlExtent;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollControlExtentOld;
- }
- INT CExtBarSliderButton::ScrollControlExtentVertGet() const
- {
- ASSERT_VALID( this );
- return m_nScrollControlExtentV;
- }
- INT CExtBarSliderButton::ScrollControlExtentVertSet( INT nScrollControlExtent )
- {
- ASSERT_VALID( this );
- INT nScrollControlExtentOld = ScrollControlExtentVertGet();
- m_nScrollControlExtentV = nScrollControlExtent;
- ASSERT_VALID( this );
- RecalcSliderLayout();
- return nScrollControlExtentOld;
- }
- #ifdef _DEBUG
- void CExtBarSliderButton::AssertValid() const
- {
- CExtBarButton::AssertValid();
- ASSERT( m_nScrollPos <= m_nScrollTotalRange );
- ASSERT( m_nScrollButtonExtentH >= 0 );
- ASSERT( m_nScrollButtonExtentV >= 0 );
- ASSERT( m_nScrollControlExtentH >= 0 );
- ASSERT( m_nScrollControlExtentV >= 0 );
- ASSERT( m_pCtrl == NULL );
- }
- void CExtBarSliderButton::Dump(CDumpContext& dc) const
- {
- CExtBarButton::Dump( dc );
- }
- #endif
- void CExtBarSliderButton::SetMenu(
- HMENU hMenu,
- bool bPopupMenu,
- bool bAutoDestroyMenu
- )
- {
- ASSERT_VALID( this );
- ASSERT( FALSE ); // should not be used with text-field button
- hMenu;
- bPopupMenu;
- bAutoDestroyMenu;
- }
- HMENU CExtBarSliderButton::GetMenu()
- {
- ASSERT_VALID( this );
- return NULL;
- }
- //bool CExtBarSliderButton::IsLargeIcon() const
- //{
- // ASSERT_VALID( this );
- // return false;
- //}
- //
- //bool CExtBarSliderButton::IsDisplayScreenTip() const
- //{
- // ASSERT_VALID( this );
- // return false;
- //}
- //
- //bool CExtBarSliderButton::IsDisplayShortcutKeysOnScreenTip() const
- //{
- // ASSERT_VALID( this );
- // return false;
- //}
- void CExtBarSliderButton::SetRect( const RECT & rectButton )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- GetBar()->AnimationSite_ClientProgressStop(
- this
- );
- AnimationClient_StateGet( false ).Empty();
- AnimationClient_StateGet( true ).Empty();
- AnimationClient_TargetRectSet( rectButton );
- m_ActiveRect = rectButton;
- RecalcSliderLayout();
- }
- bool CExtBarSliderButton::CanBePressedInDisabledState()
- {
- return false;
- }
- bool CExtBarSliderButton::IsAbleToTrackMenu(
- bool bCustomizeMode // = false
- ) const
- {
- ASSERT_VALID( this );
- bCustomizeMode;
- return false;
- }
- bool CExtBarSliderButton::IsContainerOfPopupLikeMenu()
- {
- ASSERT_VALID( this );
- return false;
- }
- //CExtCmdIcon * CExtBarSliderButton::GetIconPtr()
- //{
- // ASSERT_VALID( this );
- // return NULL; // no icon at all for text-fields
- //}
- CSize CExtBarSliderButton::CalculateLayout(
- CDC & dc,
- CSize sizePreCalc,
- BOOL bHorz
- )
- {
- ASSERT_VALID( this );
- ASSERT_VALID( GetBar() );
- ASSERT_VALID( (&dc) );
- if( GetNoRotateVerticalLayout() )
- bHorz = TRUE;
- m_ActiveSize = sizePreCalc;
- ASSERT( ! IsSeparator() );
- #if (!defined __EXT_MFC_NO_CUSTOMIZE)
- if( GetCmdNode() == NULL )
- #endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
- {
- CExtToolControlBar * pBar = GetBar();
- CExtCmdItem * pCmdItem =
- g_CmdManager->CmdGetPtr(
- g_CmdManager->ProfileNameFromWnd( pBar->GetSafeHwnd() ),
- GetCmdID( true )
- );
- if( pCmdItem == NULL )
- return m_ActiveSize; // shutdown mode
- } // if( GetCmdNode() == NULL )
- CSize _size( 0, 0 );
- // update size for icon
- bool bIconEmpty = true;
- CExtCmdIcon * pIcon = GetIconPtr();
- if( pIcon != NULL && (! pIcon->IsEmpty() ) )
- {
- bIconEmpty = false;
- _size = pIcon->GetSize();
- if( IsLargeIcon() )
- {
- _size.cx *= 2;
- _size.cy *= 2;
- }
- }
- // update size for text
- bool bTextEmpty = true;
- CExtSafeString sMeasureText = GetText();
- if( sMeasureText.IsEmpty() )
- {
- CSize sizeAlign = m_pBar->_GetDefButtonSize();
- if( bHorz )
- {
- sizeAlign.cy -= 7;
- _size.cy = max( _size.cy, sizeAlign.cy );
- } // if( bHorz )
- else
- {
- sizeAlign.cx -= 7;
- _size.cx = max( _size.cx, sizeAlign.cx );
- } // else from if( bHorz )
- } // if( sMeasureText.IsEmpty() )
- else
- {
- bTextEmpty = false;
- static TCHAR stat_strDummyAmpSeq[] = _T("