本文整理汇总了C++中Icon::SetStream方法的典型用法代码示例。如果您正苦于以下问题:C++ Icon::SetStream方法的具体用法?C++ Icon::SetStream怎么用?C++ Icon::SetStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Icon
的用法示例。
在下文中一共展示了Icon::SetStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: icons
FX_BOOL Document::icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError)
{
if (vp.IsSetting()) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
return FALSE;
}
if (!m_pIconTree)
{
vp.SetNull();
return TRUE;
}
CJS_Array Icons(m_isolate);
IconElement* pIconElement = NULL;
int iIconTreeLength = m_pIconTree->GetLength();
CJS_Context* pContext = (CJS_Context *)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
for (int i = 0; i < iIconTreeLength; i++)
{
pIconElement = (*m_pIconTree)[i];
JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Icon"));
if (pObj.IsEmpty()) return FALSE;
CJS_Icon * pJS_Icon = (CJS_Icon *)JS_GetPrivate(pObj);
if (!pJS_Icon) return FALSE;
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
if (!pIcon)return FALSE;
pIcon->SetStream(pIconElement->IconStream->GetStream());
pIcon->SetIconName(pIconElement->IconName);
Icons.SetElement(i, CJS_Value(m_isolate,pJS_Icon));
}
vp << Icons;
return TRUE;
}
示例2: getIcon
FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
CJS_Context* pContext = (CJS_Context *)cc;
if (params.size() != 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
return FALSE;
}
if(!m_pIconTree)
return FALSE;
CFX_WideString swIconName = params[0].ToCFXWideString();
int iIconCounts = m_pIconTree->GetLength();
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
for (int i = 0; i < iIconCounts; i++)
{
if ((*m_pIconTree)[i]->IconName == swIconName)
{
Icon* pRetIcon = (*m_pIconTree)[i]->IconStream;
JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Icon"));
if (pObj.IsEmpty()) return FALSE;
CJS_Icon * pJS_Icon = (CJS_Icon *)JS_GetPrivate(pObj);
if (!pJS_Icon) return FALSE;
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
if (!pIcon)return FALSE;
pIcon->SetIconName(swIconName);
pIcon->SetStream(pRetIcon->GetStream());
vRet = pJS_Icon;
return TRUE;
}
}
return FALSE;
}