EPropWnd::EPropWnd() { m_cPane = ::GetSysColor( COLOR_3DFACE ); m_cLigh = ::GetSysColor( COLOR_3DHILIGHT ); m_cDark = ::GetSysColor( COLOR_3DSHADOW ); m_cOuts = m_cPane - 0x505050; m_PenLigh.CreatePen( PS_SOLID , 0 , m_cLigh ); m_PenDark.CreatePen( PS_SOLID , 0 , m_cDark ); m_pChangeListener = NULL; SetActiveProperty(NULL); m_nFontHeight = 13; m_Font.DeleteObject(); m_Font.CreateFont( m_nFontHeight , 0, 0, 0, FW_MEDIUM, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH , _T("tahoma") ); m_nEdgeWidth = 1; m_bApplyOnKillFocus = true; m_bCloseOnKillFocus = true; m_pCommentPane = NULL; }
void EPropWnd::OnDoPropClose() { // if( m_pActiveProperty != NULL ) // { // m_pActiveProperty->OnPropClose(); // m_pActiveProperty = NULL; SetActiveProperty(NULL); // Invalidate(); // } }
void EPropWnd::CloseActiveProperty() { TR( _T("EPropWnd::CloseActiveProperty()"),(GetActiveProperty()==NULL)?(_T("NULL")):(GetActiveProperty()->GetName())); if( GetActiveProperty()!=NULL ) { m_bApplyOnKillFocus = false; m_bCloseOnKillFocus = false; GetActiveProperty()->OnPropClose(); //causes killfocus on properties with cedit control! SetActiveProperty(NULL); } }
void EGridCtrl::OnLButtonDown(UINT nFlags, CPoint point) { SetCapture(); m_MouseDownCP = point; bool bOnHeaderRow = ( 0<=point.y && point.y<GetHeaderRowHeight() ); if( bOnHeaderRow ) { m_pDragColumn = GetColumn(point.x,true); if( m_pDragColumn!=NULL ) { SetCursor( LoadCursor(NULL,IDC_SIZEWE) ); } } else { int nCol=-1; int nRow=-1; EProperty* pProperty = GetProperty( point , nCol , nRow ); m_SeletectPropertyIndex.x = nCol; m_SeletectPropertyIndex.y = nRow; SetActiveProperty(pProperty); if( m_pActiveProperty != NULL ) { if( m_pActiveProperty->OnLButtonDown( this , point ) ) { NotifyPropertyChanged(); Invalidate(); } } } }
void EGridCtrl::StepPropertySelection( int nStepx , int nStepy ) { int nCol = m_SeletectPropertyIndex.x; int nRow = m_SeletectPropertyIndex.y; while( true ) { nCol += nStepx; nRow += nStepy; int nNumCols = m_vCols.size(); int nNumRows = m_vRows.size(); nCol %= nNumCols; nRow %= nNumRows; if( nCol<0 ) nCol += nNumCols; if( nRow<0 ) nRow += nNumRows; EProperty* pNewActive = m_ppPropertyMap[ nCol + nRow * m_vCols.size() ]; if( pNewActive != NULL ) { if( pNewActive == m_pActiveProperty ) //the same (there was probably only one..) { SetActiveProperty( NULL ); break; } if( pNewActive->IsSelectable() ) { SetActiveProperty( pNewActive ); break; } } } m_SeletectPropertyIndex.x = nCol; m_SeletectPropertyIndex.y = nRow; //-------- // std::list<Row*>::iterator iter = m_vRows.begin(); // std::list<Row*>::iterator iend = m_vRows.end(); // // while( iter != iend ) // { // Row* pRow = *iter; // // int nNumProperties = pRow->Size(); // // for( int i=0 ; i<nNumProperties ; i++ ) // { // EProperty* pProperty = pRow->Get(i); // // if( pProperty == m_pActiveProperty ) // { // while( true ) // { // i++; // // EProperty* pNewActive = pRow->Get(i); // // if( pNewActive == m_pActiveProperty ) //the same (there was probably only one..) // { // SetActiveProperty( NULL ); // break; // } // // if( pNewActive->IsSelectable() ) // { // SetActiveProperty( pNewActive ); // break; // } // } // } // } // // iter++; // } //-------- }
bool EPropWnd::SetActiveProperty( EProperty* pNewActiveProperty , bool bApply , bool bVetoClosure ) { TR( _T("EPropWnd::SetActiveProperty()"),(pNewActiveProperty==NULL)?( _T("NULL")):(pNewActiveProperty->GetName())); bool bSuccess = true; if( pNewActiveProperty != GetActiveProperty() ) { // // apply old // if( GetActiveProperty() != NULL ) { if( bApply ) { if( bVetoClosure ) { bSuccess = GetActiveProperty()->CanApply(); //dont apply and dont close } if( bSuccess ) { ApplyActiveProperty(); } } } // // close old // if( bSuccess ) { CloseActiveProperty(); } else { MessageBeep( MB_ICONASTERISK ); } // // set new active property // if( bSuccess ) { SetActiveProperty(pNewActiveProperty); if( GetActiveProperty() != NULL ) { GetActiveProperty()->OnPropActivate(this); EnsureVisibility( GetActiveProperty() ); } Invalidate(); //only update this view (selection changed) if( m_pCommentPane != NULL ) { m_pCommentPane->Invalidate(); } } } return bSuccess; }