| 1082 | } |
| 1083 | |
| 1084 | LRESULT OnChangedProperty(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/) |
| 1085 | { |
| 1086 | // Updates a property value. |
| 1087 | // A property class uses this message to make sure the corresponding editor window |
| 1088 | // is updated as well. |
| 1089 | // Parameters: |
| 1090 | // WPARAM = New value (VARIANT*) |
| 1091 | // LPARAM = Property (IProperty*) |
| 1092 | IProperty* prop = reinterpret_cast<IProperty*>(lParam); |
| 1093 | VARIANT* pVariant = reinterpret_cast<VARIANT*>(wParam); |
| 1094 | ATLASSERT(prop && pVariant); |
| 1095 | if( prop == NULL || pVariant == NULL ) return 0; |
| 1096 | // Ask owner about change |
| 1097 | NMPROPERTYITEM nmh = { m_hWnd, GetDlgCtrlID(), PIN_ITEMCHANGING, prop }; |
| 1098 | if( ::SendMessage(GetParent(), WM_NOTIFY, nmh.hdr.idFrom, (LPARAM) &nmh) == 0 ) { |
| 1099 | // Set new value. |
| 1100 | // NOTE: Do not call this from IProperty::SetValue(VARIANT*) = endless loop |
| 1101 | if( !prop->SetValue(*pVariant) ) { |
| 1102 | ::MessageBeep((UINT)-1); |
| 1103 | return 0; |
| 1104 | } |
| 1105 | // Let owner know |
| 1106 | nmh.hdr.code = PIN_ITEMCHANGED; |
| 1107 | ::SendMessage(GetParent(), WM_NOTIFY, nmh.hdr.idFrom, (LPARAM) &nmh); |
| 1108 | } |
| 1109 | // Locate the updated list item |
| 1110 | int iItem = -1, iSubItem = -1; |
| 1111 | if( !FindProperty(prop, iItem, iSubItem) ) return 0; |
| 1112 | // Repaint item |
| 1113 | _InvalidateItem(iItem, iSubItem); |
| 1114 | // Recycle in-place control so it displays the new value |
| 1115 | if( (iItem != -1) && (iItem == m_iInplaceRow) ) _SpawnInplaceWindow(prop, m_iInplaceRow, m_iInplaceCol); |
| 1116 | return 0; |
| 1117 | } |
| 1118 | |
| 1119 | // Header messages |
| 1120 |
nothing calls this directly
no test coverage detected