本文整理汇总了C++中CCoolBarItem类的典型用法代码示例。如果您正苦于以下问题:C++ CCoolBarItem类的具体用法?C++ CCoolBarItem怎么用?C++ CCoolBarItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCoolBarItem类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
void CCoolMenuBarCtrl::SetMenu(HMENU hMenu)
{
m_hMenu = hMenu;
Clear();
if ( ! m_hMenu ) return;
CMenu pMenu;
pMenu.Attach( m_hMenu );
for ( UINT nItem = 0 ; nItem < pMenu.GetMenuItemCount() ; nItem++ )
{
CString strMenu;
pMenu.GetMenuString( nItem, strMenu, MF_BYPOSITION );
int nAmp = strMenu.Find( '&' );
if ( nAmp >= 0 ) strMenu = strMenu.Left( nAmp ) + strMenu.Mid( nAmp + 1 );
CCoolBarItem* pItem = new CCoolBarItem( this, nItem + 1 );
pItem->SetText( _T(" ") + strMenu + _T(" ") );
m_pItems.AddTail( pItem );
}
pMenu.Detach();
}
示例2: OnUpdateSearchPanel
void CSearchWnd::OnUpdateSearchPanel(CCmdUI* /*pCmdUI*/)
{
CCoolBarItem* pItem = m_wndToolBar.GetID( ID_SEARCH_PANEL );
CString strText;
LoadString( strText, m_bPanel ? IDS_SEARCH_PANEL_HIDE : IDS_SEARCH_PANEL_SHOW );
pItem->SetTip( strText );
pItem->SetCheck( m_bPanel );
}
示例3: OnNetworkDisconnect
void CPlayerWnd::OnNetworkDisconnect()
{
m_wndPlayer.Setup();
m_bPlaying = FALSE;
CCoolBarItem* pItem = m_wndHeaderBar.GetID( ID_NETWORK_CONNECT );
if ( pItem ) pItem->Show( TRUE );
pItem = m_wndHeaderBar.GetID( ID_NETWORK_DISCONNECT );
if ( pItem ) pItem->Show( FALSE );
ResyncStream( RenderPayload(PayloadMask_Audio | PayloadMask_Video) );
}
示例4: OnUpdate
BOOL CPlugins::OnUpdate(CChildWnd* pActiveWnd, CCmdUI* pCmdUI)
{
UINT nCommandID = pCmdUI->m_nID;
TRISTATE bVisible = TRI_TRUE;
TRISTATE bEnabled = TRI_TRUE;
TRISTATE bChecked = TRI_UNKNOWN;
CCoolBarItem* pCoolUI = CCoolBarItem::FromCmdUI( pCmdUI );
if ( pActiveWnd != NULL && pActiveWnd->IsKindOf( RUNTIME_CLASS(CPluginWnd) ) )
{
CPluginWnd* pPluginWnd = (CPluginWnd*)pActiveWnd;
if ( pPluginWnd->m_pOwner )
{
if ( pPluginWnd->m_pOwner->OnUpdate( nCommandID, &bVisible, &bEnabled, &bChecked ) == S_OK )
{
if ( bVisible != TRI_UNKNOWN && pCoolUI != NULL )
pCoolUI->Show( bVisible == TRI_TRUE );
if ( bEnabled != TRI_UNKNOWN )
pCmdUI->Enable( bEnabled == TRI_TRUE );
if ( bChecked != TRI_UNKNOWN )
pCmdUI->SetCheck( bChecked == TRI_TRUE );
return TRUE;
}
}
}
for ( POSITION pos = GetIterator() ; pos ; )
{
CPlugin* pPlugin = GetNext( pos );
if ( pPlugin->m_pCommand )
{
if ( pPlugin->m_pCommand->OnUpdate( nCommandID, &bVisible, &bEnabled, &bChecked ) == S_OK )
{
if ( bVisible != TRI_UNKNOWN && pCoolUI != NULL )
pCoolUI->Show( bVisible == TRI_TRUE );
if ( bEnabled != TRI_UNKNOWN )
pCmdUI->Enable( bEnabled == TRI_TRUE );
if ( bChecked != TRI_UNKNOWN )
pCmdUI->SetCheck( bChecked == TRI_TRUE );
return TRUE;
}
}
}
return FALSE;
}
示例5: CCoolBarItem
CCoolBarItem* CCoolBarCtrl::Add(UINT nID, LPCTSTR pszText, int nPosition)
{
CCoolBarItem* pItem = new CCoolBarItem( this, nID );
if ( nPosition == -1 )
{
m_pItems.AddTail( pItem );
}
else
{
POSITION pos = m_pItems.FindIndex( nPosition );
if ( pos ) m_pItems.InsertBefore( pos, pItem ); else m_pItems.AddTail( pItem );
}
pItem->m_nImage = CoolInterface.ImageForID( nID );
if ( pszText ) pItem->SetText( pszText );
return pItem;
}
示例6: UnsyncStream
void CPlayerWnd::OnNetworkConnect()
{
CWaitCursor pCursor;
CString strUrl;
m_wndHistory.GetWindowText( strUrl );
strUrl.TrimLeft(); strUrl.TrimRight();
m_wndPlayer.Setup();
m_wndPlayer.InstallCapture( (CComBSTR)Settings.Audio.Render, L"Audio Renderer" );
IBaseFilter* pCapture;
if ( FAILED(m_wndPlayer.RenderUrl( (CComBSTR)strUrl, &pCapture )) ) return;
UnsyncStream( RenderPayload(PayloadMask_Audio | PayloadMask_Video) );
// m_wndPlayer.ResizeConfig( pCapture );
IBaseFilter* pInfTee[2];
m_wndPlayer.BranchStream( L"Audio Renderer", &pInfTee[0] );
m_wndPlayer.BranchStream( L"Video Renderer", &pInfTee[1] );
m_bPlaying = SUCCEEDED(m_wndPlayer.StartPreview( rectDefault, m_hWnd ));
OnSize( SIZE_INTERNAL, 0, 0 );
int nItem = m_wndHistory.FindStringExact( -1, strUrl );
if ( nItem != -1 ) m_wndHistory.DeleteString( nItem );
if ( m_wndHistory.GetCount() >= MAX_ITEM ) m_wndHistory.DeleteString( MAX_ITEM - 1 );
m_wndHistory.SetCurSel( m_wndHistory.InsertString( 0, strUrl ) );
CCoolBarItem* pItem = m_wndHeaderBar.GetID( ID_NETWORK_CONNECT );
if ( pItem ) pItem->Show( FALSE );
pItem = m_wndHeaderBar.GetID( ID_NETWORK_DISCONNECT );
if ( pItem ) pItem->Show( TRUE );
SaveXML();
}
示例7: OnUpdateCmdUI
void CCoolBarCtrl::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
{
UINT nIndex = 0;
BOOL bDirty = FALSE;
BOOL bLocked = FALSE;
if ( m_pSyncObject != NULL )
{
bLocked = m_pSyncObject->Lock( 200 );
}
for ( POSITION pos = m_pItems.GetHeadPosition() ; pos ; )
{
CCoolBarItem* pItem = (CCoolBarItem*)m_pItems.GetNext( pos );
if ( pItem->m_nID == ID_SEPARATOR ) continue;
if ( pItem->m_nCtrlID ) continue;
pItem->m_pOther = this;
pItem->m_nIndex = nIndex++;
pItem->m_nIndexMax = m_pItems.GetCount();
pItem->m_bDirty = FALSE;
BOOL bEnabled = pItem->m_bEnabled;
if ( ! CWnd::OnCmdMsg( pItem->m_nID, CN_UPDATE_COMMAND_UI, pItem, NULL ) )
{
pItem->DoUpdate( pTarget, bDisableIfNoHndler );
}
pItem->m_bDirty |= ( pItem->m_bEnabled != bEnabled );
bDirty |= pItem->m_bDirty;
}
if ( bLocked ) m_pSyncObject->Unlock();
if ( bDirty ) OnUpdated();
}
示例8: AfxGetResourceHandle
void CMonitorWnd::OnUpdateMediaRecord(CCmdUI* pCmdUI)
{
pCmdUI->Enable( m_wndChild.m_pSelected != 0 );
HINSTANCE hPrevInst = AfxGetResourceHandle();
AfxSetResourceHandle( m_hInstance );
CCoolBarItem* pItem = m_wndBottom.GetID( ID_MEDIA_RECORD );
UINT nTextID = 0;
UINT nTipID = 0;
CNetworkThumb* pWindow = m_wndChild.m_pSelected;
if ( pWindow && pWindow->IsRecording() )
{
if ( pItem ) pItem->SetTextColour( RGB( 255, 0, 0 ) );
nTextID = IDS_MEDIA_RECORDING;
nTipID = ID_MEDIA_REC_STOP;
}
else if ( pItem )
{
if ( pItem->m_bEnabled )
pItem->SetTextColour( CoolInterface.m_crCmdText );
else
pItem->SetTextColour( CoolInterface.m_crDisabled );
nTextID = IDS_MEDIA_RECORD;
nTipID = ID_MEDIA_RECORD;
}
CString strText;
LoadString( strText, nTextID );
if ( pItem ) pItem->SetText( strText );
LoadString( strText, nTipID );
if ( pItem ) pItem->SetTip( strText );
if ( pItem ) pItem->SetImage( nTipID );
AfxSetResourceHandle( hPrevInst );
}
示例9: AfxGetResourceHandle
void CPlayerWnd::OnUpdateNetworkConnect(CCmdUI* pCmdUI)
{
HINSTANCE hPrevInst = AfxGetResourceHandle();
AfxSetResourceHandle( m_hInstance );
CCoolBarItem* pItem = m_wndHeaderBar.GetID( ID_NETWORK_CONNECT );
UINT nTextID = 0;
UINT nTipID = 0;
if ( FALSE )
{
if ( pItem ) pItem->SetCheck( TRUE );
if ( pItem ) pItem->SetTextColour( CoolInterface.m_crCmdText == 0 ? RGB( 255, 0, 0 ) : CoolInterface.m_crCmdText );
nTextID = IDS_NETWORK_DISCONNECT;
nTipID = ID_NETWORK_DISCONNECT;
}
else
{
if ( pItem ) pItem->SetCheck( FALSE );
if ( pItem ) pItem->SetTextColour( CoolInterface.m_crCmdText == 0 ? RGB( 0, 127, 0 ) : CoolInterface.m_crCmdText );
nTextID = IDS_NETWORK_CONNECT;
nTipID = ID_NETWORK_CONNECT;
}
CString strText;
LoadString( strText, nTextID );
if ( pItem ) pItem->SetText( strText );
LoadString( strText, nTipID );
if ( pItem ) pItem->SetTip( strText );
if ( pItem ) pItem->SetImage( nTipID );
AfxSetResourceHandle( hPrevInst );
}
示例10: rcItem
void CCoolBarCtrl::DoPaint(CDC* pDC, CRect& rcClient, BOOL bTransparent)
{
CRect rcItem( rcClient.left + MARGIN_WIDTH, rcClient.top + 1, rcClient.right - MARGIN_WIDTH, rcClient.bottom - 1 );
CRect rcCopy;
if ( m_bGripper )
{
if ( bTransparent )
{
for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 )
{
pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 1,
CoolInterface.m_crDisabled, CoolInterface.m_crDisabled );
}
}
else
{
for ( int nY = rcClient.top + 4 ; nY < rcClient.bottom - 4 ; nY += 2 )
{
pDC->Draw3dRect( rcClient.left + 3, nY, GRIPPER_WIDTH, 2,
CoolInterface.m_crDisabled, CoolInterface.m_crMidtone );
}
pDC->ExcludeClipRect( rcClient.left + 3, rcClient.top + 4, rcClient.left + GRIPPER_WIDTH + 2, rcClient.bottom - 4 );
}
rcItem.left += GRIPPER_WIDTH;
}
if ( m_pItems.GetCount() == 0 ) return;
CFont* pOldFont = (CFont*)pDC->SelectObject( m_bBold ? &CoolInterface.m_fntBold : &CoolInterface.m_fntNormal );
BOOL bRight = FALSE;
for ( POSITION pos = m_pItems.GetHeadPosition() ; pos ; )
{
CCoolBarItem* pItem = (CCoolBarItem*)m_pItems.GetNext( pos );
if ( pItem->m_nID == ID_RIGHTALIGN && ! bRight )
{
int nRight = 0;
bRight = TRUE;
for ( POSITION pos2 = pos ; pos2 ; )
{
CCoolBarItem* pRight = (CCoolBarItem*)m_pItems.GetNext( pos2 );
if ( pRight->m_bVisible ) nRight += pRight->m_nWidth;
}
if ( rcClient.right - rcItem.left >= nRight + MARGIN_WIDTH )
{
rcItem.left = rcClient.right - nRight - MARGIN_WIDTH;
}
}
else if ( pItem->m_bVisible )
{
rcItem.right = rcItem.left + pItem->m_nWidth;
rcCopy.CopyRect( &rcItem );
CWnd* pCtrl = ( pItem->m_nCtrlID ) ? GetDlgItem( pItem->m_nCtrlID ) : NULL;
pItem->Paint( pDC, rcCopy, m_pDown == pItem,
m_pHot == pItem || ( pCtrl && pCtrl == GetFocus() ),
m_bMenuGray, bTransparent );
if ( ! bTransparent ) pDC->ExcludeClipRect( &rcItem );
if ( pCtrl ) SmartMove( pCtrl, &rcCopy );
rcItem.OffsetRect( rcItem.Width(), 0 );
}
else if ( pItem->m_nCtrlID )
{
CWnd* pCtrl = GetDlgItem( pItem->m_nCtrlID );
if ( pCtrl && pCtrl->IsWindowVisible() ) pCtrl->ShowWindow( SW_HIDE );
}
}
pDC->SelectObject( pOldFont );
}
示例11: CCoolBarCtrl
BOOL CSkin::CreateToolBar(CXMLElement* pBase)
{
CCoolBarCtrl* pBar = new CCoolBarCtrl();
for ( POSITION pos = pBase->GetElementIterator() ; pos ; )
{
CXMLElement* pXML = pBase->GetNextElement( pos );
if ( pXML->IsNamed( _T("button") ) )
{
if ( UINT nID = LookupCommandID( pXML ) )
{
CCoolBarItem* pItem = pBar->Add( nID, pXML->GetAttributeValue( _T("text") ) );
CString strTemp = pXML->GetAttributeValue( _T("colour") );
if ( strTemp.GetLength() == 6 )
{
int nRed, nGreen, nBlue;
_stscanf( strTemp.Mid( 0, 2 ), _T("%x"), &nRed );
_stscanf( strTemp.Mid( 2, 2 ), _T("%x"), &nGreen );
_stscanf( strTemp.Mid( 4, 2 ), _T("%x"), &nBlue );
pItem->m_crText = RGB( nRed, nGreen, nBlue );
}
strTemp = pXML->GetAttributeValue( _T("tip") );
if ( strTemp.GetLength() ) pItem->SetTip( strTemp );
strTemp = pXML->GetAttributeValue( _T("visible") );
if ( strTemp.GetLength() ) pItem->Show( FALSE );
}
}
else if ( pXML->IsNamed( _T("separator") ) )
{
pBar->Add( ID_SEPARATOR );
}
else if ( pXML->IsNamed( _T("rightalign") ) )
{
pBar->Add( ID_RIGHTALIGN );
}
else if ( pXML->IsNamed( _T("control") ) )
{
UINT nID, nWidth, nHeight = 0;
CString strTemp;
strTemp = pXML->GetAttributeValue( _T("id") );
if ( _stscanf( strTemp, _T("%lu"), &nID ) == 1 )
{
strTemp = pXML->GetAttributeValue( _T("width") );
if ( _stscanf( strTemp, _T("%lu"), &nWidth ) == 1 )
{
strTemp = pXML->GetAttributeValue( _T("height") );
_stscanf( strTemp, _T("%lu"), &nHeight );
pBar->Add( nID, nWidth, nHeight );
}
}
}
else if ( pXML->IsNamed( _T("label") ) )
{
CCoolBarItem* pItem = pBar->Add( 1, pXML->GetAttributeValue( _T("text") ) );
pItem->m_crText = 0;
pItem->SetTip( pXML->GetAttributeValue( _T("tip") ) );
}
}
CString strName = pBase->GetAttributeValue( _T("name") );
CCoolBarCtrl* pOld = NULL;
if ( m_pToolbars.Lookup( strName, (void*&)pOld ) && pOld ) delete pOld;
m_pToolbars.SetAt( strName, pBar );
return TRUE;
}