📄 minisite.cpp
字号:
}
#endif
AddRef();
if (HXR_OK == m_pUser->DetachSite())
{
HX_RELEASE(m_pUser);
}
Release();
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::GetUser
*/
STDMETHODIMP CMiniBaseSite::GetUser(REF(IHXSiteUser*) /*OUT*/ pUser)
{
if (!m_pUser)
return HXR_UNEXPECTED;
pUser = m_pUser;
pUser->AddRef();
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::CreateChild
*/
STDMETHODIMP CMiniBaseSite::CreateChild(REF(IHXSite*) /*OUT*/ pChildSite)
{
HRESULT result = HXR_NOTIMPL;
#if defined (HELIX_FEATURE_SMIL_SITE)
// Create an instance of CMiniBaseSite, let it know it's in child
// window mode.
CMiniBaseSite* pChildSiteWindowless =
CMiniBaseSite::CreateSite(m_pContext, NULL, m_ChildrenInZOrder.GetCount());
pChildSiteWindowless->SetParentSite(this);
pChildSiteWindowless->SetTopLevelSite(m_pTopLevelSite);
pChildSiteWindowless->SetParentWindow(&m_TopLevelWindow);
// Get the IHXSite interface from the child to return to the
// outside world.
pChildSiteWindowless->QueryInterface(IID_IHXSite, (void**)&pChildSite);
//Add it to our children list
m_ChildrenInZOrder.AddTail(pChildSite);
//Make sure it has the lowest z-order.
pChildSiteWindowless->SetInternalZOrder(m_ChildrenInZOrder.GetCount());
//Set the child's origin
pChildSiteWindowless->SetOrigin(&m_topleft);
//Let subclasses do any platform specific work.
_ChildCreated();
result = HXR_OK;
#endif
return result;
}
/************************************************************************
* Method:
* IHXSite::DestroyChild
*/
STDMETHODIMP CMiniBaseSite::DestroyChild(IHXSite* /*IN*/ pChildSite)
{
HX_RESULT res = HXR_FAIL;
#ifdef HELIX_FEATURE_SMIL_SITE
//Find this child and remove it from our list
LISTPOSITION pos = m_ChildrenInZOrder.Find((void*)pChildSite);
if(pos)
{
res = HXR_OK;
CMiniBaseSite* pSite = (CMiniBaseSite*)m_ChildrenInZOrder.GetAt(pos);
m_ChildrenInZOrder.RemoveAt(pos);
}
#endif
return res;
}
/************************************************************************
* Method:
* IHXSite::AttachWatcher
*/
STDMETHODIMP CMiniBaseSite::AttachWatcher(IHXSiteWatcher* /*IN*/ pWatcher)
{
if (m_pWatcher)
return HXR_UNEXPECTED;
m_pWatcher = pWatcher;
if (m_pWatcher)
{
m_pWatcher->AddRef();
m_pWatcher->AttachSite(this);
}
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::DetachWatcher
*/
STDMETHODIMP CMiniBaseSite::DetachWatcher()
{
if (!m_pWatcher)
return HXR_UNEXPECTED;
m_pWatcher->DetachSite();
HX_RELEASE(m_pWatcher);
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::SetSize
*/
STDMETHODIMP CMiniBaseSite::SetSize(HXxSize size)
{
HRESULT hres = HXR_OK;
#if defined (HELIX_FEATURE_SMIL_SITE)
CHXSimpleList::Iterator i;
size.cx = size.cx<0?0:size.cx;
size.cy = size.cy<0?0:size.cy;
//before we do anything, we give the SiteWatcher a chance to
//influence this operation.
if (m_pWatcher)
{
hres = m_pWatcher->ChangingSize(m_size, size);
}
if (HXR_OK == hres )
{
m_size = size;
// iterate child site list
for(i=m_PassiveSiteWatchers.Begin(); i!= m_PassiveSiteWatchers.End(); ++i)
{
((IHXPassiveSiteWatcher*) *i)->SizeChanged(&m_size);
}
if( m_pWindow && m_pWindow->window &&
(m_pTopLevelSite!=this || m_bWindowCreatedByCreate ) )
{
_SetSize(size);
}
}
if (m_pTopLevelSite==this)
{
m_pTopLevelSite->RecomputeClip();
}
else
{
if(m_pTopLevelSite)
m_pTopLevelSite->ScheduleCallback(CLIP, 0);
}
#else
m_size = size;
_SetSize(m_size);
#endif
return hres;
}
/************************************************************************
* Method:
* IHXSite::SetPosition
*/
STDMETHODIMP CMiniBaseSite::SetPosition(HXxPoint position)
{
HRESULT hres = HXR_OK;
#if defined (HELIX_FEATURE_SMIL_SITE)
CHXSimpleList::Iterator i;
CHXMapPtrToPtr::Iterator j;
//Before we do anything, we give the SiteWatcher a chance to
//influence this operation.
if (m_pWatcher)
{
hres = m_pWatcher->ChangingPosition(m_position, position);
}
if (HXR_OK == hres)
{
if(!m_bWindowCreatedByCreate )
{
// if we've created the window we don't want to move the site
// just the window
m_position = position;
}
//fixup our top left
ResetOrigin();
//iterate passive site watcher list
for(i=m_PassiveSiteWatchers.Begin(); i!= m_PassiveSiteWatchers.End(); ++i)
{
((IHXPassiveSiteWatcher*) *i)->PositionChanged(&m_position);
}
if( m_pWindow &&
m_pWindow->window &&
(m_pTopLevelSite!=this || m_bWindowCreatedByCreate )
)
{
_SetPosition(position);
}
}
if (m_pTopLevelSite==this)
{
m_pTopLevelSite->RecomputeClip();
}
else
{
if (m_pTopLevelSite)
{
m_pTopLevelSite->ScheduleCallback(CLIP, 0);
}
}
#else
m_position = position;
_SetPosition(m_position);
#endif
return hres;
}
/************************************************************************
* Method:
* IHXSite::GetSize
*/
STDMETHODIMP CMiniBaseSite::GetSize(REF(HXxSize) size)
{
size = m_size;
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::GetPosition
*/
STDMETHODIMP CMiniBaseSite::GetPosition(REF(HXxPoint) position)
{
position = m_position;
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::DamageRect
*/
STDMETHODIMP CMiniBaseSite::DamageRect(HXxRect rect)
{
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::DamageRegion
*/
STDMETHODIMP CMiniBaseSite::DamageRegion(HXxRegion region)
{
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite::ForceRedraw
*/
STDMETHODIMP CMiniBaseSite::ForceRedraw()
{
if(m_pUser)
{
HXxEvent event;
HXxWindow* hxxWin = GetWindow();
event.event = HX_SURFACE_UPDATE;
event.window = m_pWindow ? m_pWindow->window : NULL;
event.param1 = m_pVideoSurface;
event.param2 = NULL;
event.result = 0;
event.handled = 0;
m_pUser->HandleEvent(&event);
}
return HXR_OK;
}
#if defined (HELIX_FEATURE_SMIL_SITE)
STDMETHODIMP CMiniBaseSite::ForceRedrawAll()
{
HX_RESULT retVal = HXR_OK;
_ForceRedrawAll();
return retVal;
}
/************************************************************************
* Method:
* IHXSite2::UpdateSiteWindow
*
* Not used on Windows platform
*/
STDMETHODIMP CMiniBaseSite::UpdateSiteWindow
(
HXxWindow* /*IN*/ pWindow
)
{
return HXR_NOTIMPL;
}
/************************************************************************
* Method:
* IHXSite2::ShowSite
*/
STDMETHODIMP CMiniBaseSite::ShowSite(BOOL bShow)
{
HX_RESULT res = HXR_OK;
#ifdef HELIX_FEATURE_SMIL_SITE
if(m_bIsVisible != bShow)
{
m_bIsVisible = bShow;
if( this == m_pTopLevelSite )
{
RecomputeClip();
}
else
{
if(m_pTopLevelSite)
m_pTopLevelSite->ScheduleCallback(CLIP, 0);
}
}
res = HXR_OK;
#endif
return res;
}
/************************************************************************
* Method:
* IHXSite2::MoveSiteToTop
*/
STDMETHODIMP CMiniBaseSite::MoveSiteToTop()
{
SetZOrder(-1); //-1 means the top.
return HXR_OK;
}
/************************************************************************
* Method:
* IHXSite2::GetVideoSurface
*/
STDMETHODIMP CMiniBaseSite::GetVideoSurface(REF(IHXVideoSurface*) pSurface)
{
HX_RESULT res = HXR_FAIL;
if (m_pVideoSurface)
{
res = m_pVideoSurface->QueryInterface(IID_IHXVideoSurface,
(void**)&pSurface);
}
return res;
}
/************************************************************************
* Method:
* IHXSite2::AddPassiveSiteWatcher
*/
STDMETHODIMP CMiniBaseSite::AddPassiveSiteWatcher(IHXPassiveSiteWatcher* pWatcher)
{
pWatcher->AddRef();
m_PassiveSiteWatchers.AddTail(pWatcher);
return HXR_OK;
}
/************************************************************************
* Method:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -