| 517 | } |
| 518 | |
| 519 | BOOL _SpawnInplaceWindow(IProperty* prop, int iItem, int iSubItem) |
| 520 | { |
| 521 | ATLASSERT(prop); |
| 522 | ATLASSERT(iItem!=-1); |
| 523 | ATLASSERT(iSubItem!=-1); |
| 524 | // Destroy old in-place editor |
| 525 | _DestroyInplaceWindow(); |
| 526 | // Do we need an editor here? |
| 527 | if( iItem == -1 || iSubItem == -1 || iItem != GetSelectedIndex() ) return FALSE; |
| 528 | if( !prop->IsEnabled() ) return FALSE; |
| 529 | // Create a new editor window |
| 530 | RECT rcValue = { 0 }; |
| 531 | _GetSubItemRect(iItem, iSubItem, &rcValue); |
| 532 | rcValue.right--; // Let the borders |
| 533 | rcValue.bottom--; // ... display (right/bottom) |
| 534 | m_hwndInplace = prop->CreateInplaceControl(m_hWnd, rcValue); |
| 535 | if( m_hwndInplace ) { |
| 536 | // Activate the new editor window |
| 537 | ATLASSERT(::IsWindow(m_hwndInplace)); |
| 538 | ::SetWindowPos(m_hwndInplace, HWND_TOP, 0,0,0,0, SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); |
| 539 | ::SetFocus(m_hwndInplace); |
| 540 | m_iInplaceRow = iItem; |
| 541 | m_iInplaceCol = iSubItem; |
| 542 | return TRUE; |
| 543 | } |
| 544 | return m_hwndInplace != NULL; |
| 545 | } |
| 546 | |
| 547 | void _DestroyInplaceWindow() |
| 548 | { |
no test coverage detected