📄 vbasernd.cpp
字号:
if (FAILED(retVal)) { HX_RELEASE(m_pSite); } return retVal;}STDMETHODIMP CRNVisualBaseRenderer::DetachSite(){ // Release our IHXSite interface HX_RELEASE(m_pSite); // Now we're done with the MISUS if (m_pMISUS) { m_pMISUS->ReleaseSingleSiteUser(); } HX_RELEASE(m_pMISUS); return HXR_OK;}HX_RESULT CRNVisualBaseRenderer::RMASurfaceUpdate2(IHXSubRectVideoSurface* pSurface, HXxRect* pExtents, HXxBoxRegion* pDirtyRegion){ //Base impl. Should never be called except by those renderers that //subscribe to the sub rect messages and implemnet this themselves. HX_ASSERT( "Should Never be called."==NULL ); return HXR_OK;}STDMETHODIMP CRNVisualBaseRenderer::HandleEvent(HXxEvent *pEvent){ // Check for input error if (!pEvent) { return HXR_FAIL; } // Set the defaults pEvent->handled = FALSE; pEvent->result = 0; switch (pEvent->event) { case HX_SURFACE_UPDATE2: { HXxExposeInfo* pExpose = (HXxExposeInfo*)pEvent->param2; IHXSubRectVideoSurface *pSurface = (IHXSubRectVideoSurface*) (pEvent->param1); if (pSurface) { pSurface->AddRef(); RMASurfaceUpdate2(pSurface, &pExpose->extents, pExpose->pRegion); HX_RELEASE(pSurface); } pEvent->handled = TRUE; } break; case HX_SURFACE_UPDATE: { IHXVideoSurface *pSurface = (IHXVideoSurface *) (pEvent->param1); if (pSurface) { pSurface->AddRef(); RMASurfaceUpdate(pSurface); HX_RELEASE(pSurface); }#if defined(_UNIX) && defined(USE_XWINDOWS) // // Create a "hand" cursor for hyperlinks // { // // free previously allocated cursor // if (m_pDisplay && m_hHyperlinkCursor) { XLockDisplay(m_pDisplay); XFreeCursor(m_pDisplay, m_hHyperlinkCursor); XUnlockDisplay(m_pDisplay); m_hHyperlinkCursor = 0; } // // get new display/window parameters and // allocate a new cursor // HXxWindow *pWnd = (HXxWindow*)pEvent->param2; m_pDisplay = (Display*)pWnd->display; m_Window = (Window)pWnd->window; if (m_pDisplay) m_hHyperlinkCursor = XCreateFontCursor(m_pDisplay, XC_hand2); } #endif pEvent->handled = TRUE; } break; case HX_MOUSE_ENTER: case HX_MOUSE_LEAVE: case HX_MOUSE_MOVE: { HXxPoint* mousePt = (HXxPoint*) pEvent->param1; OnMouseMove(0, (INT16) mousePt->x, (INT16) mousePt->y); pEvent->handled = TRUE; } break; case HX_PRIMARY_BUTTON_UP: { HXxPoint* mousePt = (HXxPoint*) pEvent->param1; HandleClick((INT16) mousePt->x, (INT16) mousePt->y); pEvent->handled = TRUE; } break;#ifdef _WINDOWS case WM_SETCURSOR: { if(m_bSetHyperlinkCursor) { pEvent->handled = TRUE; m_hPreHyperlinkCursor = SetCursor(m_hHyperlinkCursor); } else { // pngui will handle the setting of the cursor (back to arrow cursor) pEvent->handled = FALSE; } } break;#endif default: break; } return HXR_OK;}STDMETHODIMP_(BOOL) CRNVisualBaseRenderer::NeedsWindowedSites(){ return FALSE;}STDMETHODIMP CRNVisualBaseRenderer::OnMouseMove(INT16 fwKeys, INT16 xPos, INT16 yPos){ // Make sure we're up and running if (!m_pPlayer) { return HXR_OK; } // Don't do anything if the x/y coordinates have changed from the // last call to OnMouseMove - this is needed because the call to // IHXStatusMessage::SetStatus() results in a WM_MOUSEMOVE event if(xPos == m_sOldMouseX && yPos == m_sOldMouseY) { return HXR_OK; } m_sOldMouseX = xPos; m_sOldMouseY = yPos;#if defined(_WINDOWS) HCURSOR hCurrentCursor = GetCursor();#endif // Find out from the sub-class if we're over an active hyperlink IHXBuffer* pStatusStr = NULL; BOOL bOverHyperlink = FALSE; HX_RESULT retVal = IsMouseOverActiveLink(xPos, yPos, bOverHyperlink, pStatusStr); if (FAILED(retVal)) { return retVal; } if (bOverHyperlink) { // Set the status bar if (m_pStatusMessage) { m_bStatusMsgWillNeedErasing = TRUE; m_pStatusMessage->SetStatus((const char*) pStatusStr->GetBuffer()); } HX_RELEASE(pStatusStr); // Set the cursor#if defined(_WINDOWS) if(!m_hHyperlinkCursor) { m_hHyperlinkCursor = LoadCursor(g_hInstance, MAKEINTRESOURCE(HANDCURSOR)); if(!m_hHyperlinkCursor) { m_hHyperlinkCursor = LoadCursor(NULL, IDC_UPARROW); } } if(m_hHyperlinkCursor && hCurrentCursor != m_hHyperlinkCursor) { // We're over a link and the cursor is NOT already the hyperlink cursor, // so change it. This will happen when we get a WM_SETCURSOR event m_bSetHyperlinkCursor = TRUE; }#elif defined(_MACINTOSH) if (m_hHyperlinkCursor) { ::SetCursor(*m_hHyperlinkCursor); m_eCurrentCursor = CURSOR_HYPERLINK; }#elif defined(_UNIX) && defined(USE_XWINDOWS) if (m_pDisplay && m_hCurrentCursor != m_hHyperlinkCursor) { XLockDisplay(m_pDisplay); XDefineCursor(m_pDisplay, m_Window, m_hHyperlinkCursor); XUnlockDisplay(m_pDisplay); m_hCurrentCursor = m_hHyperlinkCursor; }#endif } else // if (bOverHyperlink) { // Clear the status bar if (m_pStatusMessage && // /Fixes PR 65008 (JPG, PNG versions): only set this to NULL // if we have recently set the status message, otherwise we // may cause SMIL's setting of the status message to be // overwritten with NULL, i.e., erased: m_bStatusMsgWillNeedErasing) { m_bStatusMsgWillNeedErasing = FALSE; m_pStatusMessage->SetStatus(NULL); } // Reset the cursor#if defined(_WINDOWS) if(hCurrentCursor == m_hHyperlinkCursor) { // We are not over a hyperlink and out cursor IS the hyperlink cursor, // so we need to change it back. This will happen when we get a WM_SETCURSOR event m_bSetHyperlinkCursor = FALSE; }#elif defined(_MACINTOSH) if (m_eCurrentCursor == CURSOR_HYPERLINK) { ::InitCursor(); m_eCurrentCursor = CURSOR_ARROW; }#elif defined(_UNIX) && defined(USE_XWINDOWS) if (m_pDisplay && m_hCurrentCursor == m_hHyperlinkCursor) { XLockDisplay(m_pDisplay); XUndefineCursor(m_pDisplay, m_Window); XUnlockDisplay(m_pDisplay); m_hCurrentCursor = 0; }#endif } return HXR_OK;}BOOL CRNVisualBaseRenderer::_IsValidRendererSurface(){ return m_pSite!=NULL;}void CRNVisualBaseRenderer::_AttachSite(){ //Empty base impl.}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -