// Get the value of the OMObjectVector at position index. AAFRESULT STDMETHODCALLTYPE ImplAAFRefArrayValue::GetElementAt( aafUInt32 index, ImplAAFPropertyValue** ppPropertyValue) const { AAFRESULT result = AAFRESULT_SUCCESS; if (NULL == ppPropertyValue) return AAFRESULT_NULL_PARAM; *ppPropertyValue = NULL; ImplAAFStorableSP pObject; result = GetObjectAt(index, &pObject); if (AAFRESULT_FAILED(result)) return result; ImplAAFTypeDefObjectRef *pElementType = GetElementType(); ASSERTU(NULL != pElementType); if (NULL == pElementType) return AAFRESULT_INVALID_OBJ; result = pElementType->CreateValue((ImplAAFStorable *)pObject, ppPropertyValue); if (AAFRESULT_FAILED(result)) return result; return result; }
//-------------------------------------------------------------------------- // 功能:捡起某个位置上的对象 //-------------------------------------------------------------------------- int KWndObjectMatrix::PickUpObjectAt(int x, int y) { int nPicked = GetObjectAt(x, y); if (nPicked >= 0) { ITEM_PICKDROP_PLACE Pick; Pick.pWnd = this; Pick.h = m_pObjects[nPicked].DataX; Pick.v = m_pObjects[nPicked].DataY; m_pParentWnd->WndProc(WND_N_ITEM_PICKDROP, (unsigned int)&Pick, NULL); return true; } return false; }
//-------------------------------------------------------------------------- // 功能:窗口函数 //-------------------------------------------------------------------------- int KWndObjectMatrix::WndProc(unsigned int uMsg, unsigned int uParam, int nParam) { int nStallState = g_pCoreShell->GetGameData(GDI_IS_STALL, -1, -1); switch(uMsg) { case WM_LBUTTONDOWN: if (!nStallState && (m_Style & OBJCONT_S_DISABLE_PICKPUT)== 0) { if (Wnd_GetDragObj(NULL)) DropObject(GET_X_LPARAM(nParam), GET_Y_LPARAM(nParam), false); else PickUpObjectAt(GET_X_LPARAM(nParam), GET_Y_LPARAM(nParam)); } break; case WM_LBUTTONUP: if ((nStallState || (m_Style & OBJCONT_S_DISABLE_PICKPUT)) && m_pParentWnd) { m_nPutPosX = NO_MATCHED_PUT_POS; int nObj = GetObjectAt(GET_X_LPARAM(nParam), GET_Y_LPARAM(nParam)); if (nObj >= 0) { KUiDraggedObject Obj; Obj = m_pObjects[nObj]; m_pParentWnd->WndProc(WND_N_LEFT_CLICK_ITEM, (unsigned int)&Obj, (int)(KWndWindow*)this); } } break; case WM_RBUTTONUP: m_nPutPosX = NO_MATCHED_PUT_POS; if (m_pParentWnd) { int nObj = GetObjectAt(GET_X_LPARAM(nParam), GET_Y_LPARAM(nParam)); if (nObj >= 0) { KUiDraggedObject Obj; Obj = m_pObjects[nObj]; m_pParentWnd->WndProc(WND_N_RIGHT_CLICK_ITEM, (unsigned int)&Obj, (int)(KWndWindow*)this); } } break; case WM_MOUSEHOVER: case WM_MOUSEMOVE: m_Style |= OBJCONT_F_MOUSE_HOVER; { int x = GET_X_LPARAM(nParam); int y = GET_Y_LPARAM(nParam); int nObj = GetObjectAt(x, y); m_nMouseOverObj = nObj; if (nObj >= 0) { if (g_MouseOver.IsMoseHoverWndObj(this, nObj) == 0) { SetMouseHoverObjectDesc(this, nObj, m_pObjects[nObj].uGenre, m_pObjects[nObj].uId, m_nContainerId, x, y); } } else g_MouseOver.CancelMouseHoverInfo(); if ((m_Style & OBJCONT_S_TRACE_PUT_POS) && Wnd_GetDragObj(NULL)) { DropObject(GET_X_LPARAM(nParam), GET_Y_LPARAM(nParam), true); } } break; case WND_M_MOUSE_LEAVE: m_nPutPosX = NO_MATCHED_PUT_POS; m_Style &= ~OBJCONT_F_MOUSE_HOVER; KWndWindow::WndProc(uMsg, uParam, nParam); break; default: return KWndWindow::WndProc(uMsg, uParam, nParam); } return 0; }
void ObjectsManager::DeleteAt(int x, int y) { Object* collision=GetObjectAt(x,y); if (collision!=NULL) { DeleteObject(collision); }; };