LRESULT CCustomStatusBar::OnUpdateIndicator(WPARAM wParam, LPARAM lParam) { //Lock(); if (wParam<(WORD)iNoOfIndicators) SetPaneText(wParam+1, (const char*)Indicators[wParam], TRUE); //Unlock(); return TRUE; }
LRESULT CStatusBar::OnSetText( WPARAM wParam, LPARAM lParam ) /***********************************************************/ { UNUSED_ALWAYS( wParam ); int n = CommandToIndex( ID_SEPARATOR ); if( n < 0 ) { return( FALSE ); } SetPaneText( n, (LPCTSTR)lParam ); return( TRUE ); }
void MPCStatusBar::RemovePane(int nPaneID) { SetRedraw(FALSE); CWnd * pwnd = NULL; int i; for( i = 0; i < m_aPans.GetSize(); i++ ) { if( m_aPans[i]->m_nPaneID == nPaneID ) { if( m_aPans[i]->m_bAutodelete ) pwnd = m_aPans[i]->m_hWnd; delete m_aPans[i]; m_aPans.RemoveAt(i); break; } } if( pwnd ) { pwnd->DestroyWindow(); delete pwnd; } CArray<MPCStatusBarPane,MPCStatusBarPane> arPanes; MPCStatusBarPane statusPane; i = 0; while( GetStatusPane(i,statusPane) ) { if( statusPane.nID != (UINT)nPaneID ) arPanes.Add( statusPane ); i++; } // Now remove the indicator UINT * pIndicators = new UINT[arPanes.GetSize()]; for(i=0;i<arPanes.GetSize();i++) pIndicators[i]=arPanes[i].nID; SetIndicators(pIndicators,arPanes.GetSize()); // Replace infos of indicators .. for(i = 0; i < arPanes.GetSize(); i++ ) { SetPaneInfo(i,arPanes[i].nID,arPanes[i].nStyle,arPanes[i].cxText); SetPaneText(i,arPanes[i].strText); } delete pIndicators; SetRedraw(TRUE); PositionControls(); Invalidate(TRUE); }
//------------------------------------------------------------------------------ void CNetscapeStatusBar::SetupMode() { switch( m_enStatBarMode ) { case eSBM_Simple: { if (!CNetscapeStatusBarBase::SetIndicators(pSimpleIndicators, 1)) return; SetPaneInfo( 0, ID_SEPARATOR, SBPS_STRETCH | SBPS_NOBORDERS, 0 ); // Hide the task bar window (if docked) #ifdef MOZ_TASKBAR ShowTaskBar( SW_HIDE ); #endif /* MOZ_TASKBAR */ break; } case eSBM_Panes: { if (!m_anIDSaved) return; if (!CNetscapeStatusBarBase::SetIndicators(m_anIDSaved, m_iSavedCount)) return; #ifdef _WIN32 int iFudge = 4; #else int iFudge = 2; #endif RECT rcTool; int idx = CommandToIndex(IDS_SECURITY_STATUS); if (idx > -1) { SetPaneInfo(idx, IDS_SECURITY_STATUS, SBPS_DISABLED, sm_sizeSecure.cx - iFudge); if (m_pTooltip) { GetItemRect(idx, &rcTool); m_pTooltip->SetToolRect(this, IDS_SECURITY_STATUS, &rcTool); } } idx = CommandToIndex(IDS_SIGNED_STATUS); if (idx > -1) { SetPaneInfo(idx, IDS_SIGNED_STATUS, SBPS_DISABLED, sm_sizeSecure.cx - iFudge); if (m_pTooltip) { GetItemRect(idx, &rcTool); m_pTooltip->SetToolRect(this, IDS_SIGNED_STATUS, &rcTool); } } // // Set common pane info (size, style, etc). // WHS -- I'm assuming we'll always have these, probably not good in the long term // SetPaneInfo( CommandToIndex( ID_SEPARATOR ), ID_SEPARATOR, SBPS_STRETCH, 0 ); SetPaneInfo( CommandToIndex( IDS_TRANSFER_STATUS ), IDS_TRANSFER_STATUS, SBPS_NORMAL, 90 ); // Note the taskbar mgr sets the width of the taskbar pane // Also note we must call these SetPaneXXX methods even if m_bTaskbar is FALSE because // pPaneIndicators specifies the IDS_TASKBAR. If we don't, the default CStatusBar // implementation is to display the IDS_TASKBAR string resource in the status - not good. #ifdef MOZ_TASKBAR idx = CommandToIndex( IDS_TASKBAR ); if (idx > -1) { SetPaneInfo( idx, IDS_TASKBAR, SBPS_NOBORDERS, m_iStatBarPaneWidth ); SetPaneText( idx, "", FALSE ); // Show the task bar window (if docked) if( m_iStatBarPaneWidth ) ShowTaskBar( SW_SHOWNA ); if( m_pTaskBar ) { CRect rc; GetItemRect( CommandToIndex( IDS_TASKBAR ), &rc ); //Get Item Rect is returning us the wrong dimensions. It's off by 6 pixels //Eventually figure out what's going wrong rc.right -= 6; m_pTaskBar->MoveWindow( &rc ); m_pTaskBar = NULL; } } #endif /* MOZ_TASKBAR */ break; } default: { break; } } }
BOOL MPCStatusBar::AddIndicator( int position, UINT paneID ) { CArray<MPCStatusBarPane,MPCStatusBarPane> arPanes; MPCStatusBarPane statusPane; int i; i = 0; while( GetStatusPane(i,statusPane) ) { arPanes.Add( statusPane ); i++; } if( position < 0 ) position = 0; if( position > arPanes.GetSize() ) position = arPanes.GetSize()-1; for(i = 0; i < arPanes.GetSize(); i ++ ) { if( paneID == arPanes[i].nID ) { TRACE(_T("XFXStatusBar::AddIndicator(): Pane ID already exists \n")); return FALSE; } } MPCStatusBarPane new_statusPane; new_statusPane.nID = paneID; if( arPanes.GetSize() ) arPanes.InsertAt(position,new_statusPane); else arPanes.Add(new_statusPane); UINT * pIndicators = new UINT[arPanes.GetSize()]; for(i=0;i<arPanes.GetSize();i++) pIndicators[i]=arPanes[i].nID; SetRedraw(FALSE); SetIndicators(pIndicators,arPanes.GetSize()); // Replace infos of indicators .. for(i = 0; i < arPanes.GetSize(); i++ ) { if( arPanes[i].nID != paneID ) { SetPaneInfo(i,arPanes[i].nID,arPanes[i].nStyle,arPanes[i].cxText); SetPaneText(i,arPanes[i].strText); } else { SetPaneWidth(i,50); SetPaneText(i,arPanes[i].strText); } } delete pIndicators; SetRedraw(TRUE); PositionControls(); Invalidate(TRUE); return TRUE; }