/*************************************************************************************************************************************************************\
*
* void OnFormatSelect( NMHDR *pNMHDR, LRESULT *pResult )
*
* DESCRIPTION:
* Called when users change the gallery selection
* Changes the current selected Format
*
\*************************************************************************************************************************************************************/
void
CMainFrame::OnFormatSelect( NMHDR *pNMHDR, LRESULT *pResult )
{
NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL *)pNMHDR;
CXTPControlGallery *pGroup = DYNAMIC_DOWNCAST( CXTPControlGallery, tagNMCONTROL->pControl );
if ( pGroup )
{
CXTPControlGalleryItem *pSelectedItem = pGroup->GetItem( pGroup->GetSelectedItem() );
if ( pSelectedItem )
{
int nIndex = pSelectedItem->GetID();
m_RibbonFormat.SelectFormat( m_RibbonFormat.m_FormatGalleryControl.GetName( nIndex ) );
}
*pResult = TRUE;
return;
}
*pResult = FALSE;
}
/*************************************************************************************************************************************************************\
*
* void OnUpdateFormatSelect(CCmdUI *pCmdUI)
*
* DESCRIPTION:
* Update selected gallery state (selected Format)
*
\*************************************************************************************************************************************************************/
void
CMainFrame::OnUpdateFormatSelect( CCmdUI *pCmdUI )
{
CXTPControlGallery *pGallery = DYNAMIC_DOWNCAST( CXTPControlGallery, CXTPControl::FromUI( pCmdUI ) );
if ( pGallery )
{
CString cs = pGallery->GetCaption();
int nSel = m_nSelectedFormatPopupGallery;
TRACE2 (" Selected pop-up gallery: %s = %d \n\r", cs, nSel);
//if ( m_nSelectedFormatPopupGallery != -1 )
//{
// int nSel = m_nSelectedFormatPopupGallery;
// TRACE1 (" Selected pop-up gallery: %d \n\r", nSel);
// //
// pGallery->SetCheckedItem( m_nSelectedFormatPopupGallery );
// pGallery->EnsureVisible( m_nSelectedFormatPopupGallery );
// m_nSelectedFormatPopupGallery = -1;
//}
}
pCmdUI->Enable( TRUE );
}
/*************************************************************************************************************************************************************\
*
* void OnFormatSelectGallery( NMHDR *pNMHDR, LRESULT *pResult )
*
* DESCRIPTION:
* Called when users change the Format selection
* Changes the current selected Format
*
\*************************************************************************************************************************************************************/
void
CMainFrame::OnFormatSelectGallery( NMHDR *pNMHDR, LRESULT *pResult )
{
NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL *)pNMHDR;
CXTPControlGallery *pGroup = DYNAMIC_DOWNCAST( CXTPControlGallery, tagNMCONTROL->pControl );
if ( pGroup )
{
int Idx = pGroup->GetSelectedItem();
CXTPControlGalleryItem *pSelectedItem = pGroup->GetItem( Idx );
if ( pSelectedItem )
{
int nID = pSelectedItem->GetID();
m_RibbonFormat.SelectFormat( m_RibbonFormat.m_FormatGalleryControl.GetName( nID ) );
m_nSelectedFormatPopupGallery = Idx;
}
*pResult = TRUE;
return;
}
*pResult = FALSE;
}
/*************************************************************************************************************************************************************\
*
* void OnUpdateFormatSelectGallery( CCmdUI *pCmdUI )
*
* DESCRIPTION:
* Update selected gallery state (selected Format)
*
\*************************************************************************************************************************************************************/
void
CMainFrame::OnUpdateFormatSelectGallery( CCmdUI *pCmdUI )
{
CXTPControlGallery *pGallery = DYNAMIC_DOWNCAST( CXTPControlGallery, CXTPControl::FromUI( pCmdUI ) );
if ( pGallery )
{
int nIndex = m_RibbonFormat.m_FormatGalleryControl.Find( m_RibbonFormat.GetSelectedFormat() );
pGallery->SetCheckedItem( nIndex );
pGallery->EnsureVisible( nIndex );
}
pCmdUI->Enable( TRUE );
}