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 ); }
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 ); }
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 ); }
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; }