Exemplo n.º 1
0
ISkinObj* SSkinPool::GetSkin(LPCWSTR strSkinName)
{
    if(!HasKey(strSkinName))
    {
        return NULL;
    }
    return GetKeyObject(strSkinName);
}
Exemplo n.º 2
0
LPCTSTR DuiStringPool::Get( UINT uID )
{
    m_strTmp=_T("");
    if(HasKey(uID))
    {
        m_strTmp=GetKeyObject(uID);
        BuildString(m_strTmp);
    }
    return m_strTmp;
}
Exemplo n.º 3
0
pugi::xml_node SObjDefAttr::_GetDefAttribute(LPCWSTR pszClassName )
{
    if(!HasKey(pszClassName))
    {
        LPCWSTR pszBaseClassName=SApplication::getSingleton().BaseClassNameFromClassName(pszClassName);
        if(!pszBaseClassName) return pugi::xml_node();
        return _GetDefAttribute(pszBaseClassName);
    }else
    {
        return GetKeyObject(pszClassName);
    }
}
Exemplo n.º 4
0
LPCWSTR SWindowFactoryMgr::BaseClassNameFromClassName( LPCWSTR pszClassName )
{
    if(!HasKey(pszClassName))
    {
        STraceW(L"BaseClassNameFromClassName, Warning: no window type:%s in SOUI!!",pszClassName);
        return NULL;
    }
    LPCWSTR pszBaseClassName=GetKeyObject(pszClassName)->SWindowBaseName();
    if(!pszBaseClassName) return NULL;
    //注意,baseClassName可能与ClassName相同,为了避免死循环,这里需要判断一下。
    if(wcscmp(pszBaseClassName,pszClassName)==0) return NULL;
    return pszBaseClassName;
}
Exemplo n.º 5
0
SWindow * SWindowFactoryMgr::CreateWindowByName( LPCWSTR pszClassName )
{
    if(!HasKey(pszClassName))
    {
        STraceW(L"Warning: no window type:%s in SOUI!!",pszClassName);
        return NULL;
    }
    SWindow * pRet = GetKeyObject(pszClassName)->NewWindow();
    SASSERT(pRet);
    if(pRet)
    {
        SetSwndDefAttr(pRet);
    }
    return pRet;
}
Exemplo n.º 6
0
void SObjDefAttr::BuildClassAttribute( pugi::xml_node & xmlNode, LPCWSTR pszClassName)
{
    LPCWSTR pszBaseClassName=SApplication::getSingleton().BaseClassNameFromClassName(pszClassName);
    if(!pszBaseClassName) return;

    if(HasKey(pszBaseClassName))
    {
        pugi::xml_node xmlNodeAttrs = GetKeyObject(pszBaseClassName);
        pugi::xml_attribute attr=xmlNodeAttrs.first_attribute();
        while(attr)
        {
            if(!xmlNode.attribute(attr.name()))
                xmlNode.append_attribute(attr.name()).set_value(attr.value());
            attr=attr.next_attribute();
        }
    }
    BuildClassAttribute(xmlNode,pszBaseClassName);
}
Exemplo n.º 7
0
IFontPtr SFontPool::GetFont(FONTSTYLE style,LPCTSTR pszFaceName)
{
    SStringT strFaceName(pszFaceName);
    if(strFaceName == m_lfDefault.lfFaceName) strFaceName = _T("");
    
    IFontPtr hftRet=0;
    FontKey key(style.dwStyle,strFaceName);
    if(HasKey(key))
    {
        hftRet=GetKeyObject(key);
    }
    else
    {
        if(strFaceName.IsEmpty()) strFaceName = m_lfDefault.lfFaceName;
        hftRet = _CreateFont(style,strFaceName);
        AddKeyObject(key,hftRet);
    }
    return hftRet;
}
Exemplo n.º 8
0
// Load style-pool from xml tree
BOOL DuiStylePool::Init(pugi::xml_node xmlStyleRoot)
{
	DUIASSERT(xmlStyleRoot);

    if (strcmp(xmlStyleRoot.name(), "style") != 0)
	{
		DUIASSERT(FALSE);
		return FALSE;
	}

	LPCSTR lpszClassName = NULL;

	for (pugi::xml_node xmlChild=xmlStyleRoot.child("class"); xmlChild; xmlChild=xmlChild.next_sibling("class"))
    {
        lpszClassName = xmlChild.attribute("name").value();
        if (!lpszClassName)
            continue;

        GetKeyObject(lpszClassName).Load(xmlChild);
    }
	return TRUE;
}
Exemplo n.º 9
0
    // Load style-pool from xml tree
    BOOL SStylePool::Init(pugi::xml_node xmlStyleRoot)
    {
        if(!xmlStyleRoot) return FALSE;

        if (wcscmp(xmlStyleRoot.name(), L"style") != 0)
        {
            SASSERT(FALSE);
            return FALSE;
        }

        LPCWSTR lpszClassName = NULL;

        for (pugi::xml_node xmlChild=xmlStyleRoot.child(L"class"); xmlChild; xmlChild=xmlChild.next_sibling(L"class"))
        {
            lpszClassName = xmlChild.attribute(L"name").value();
            if (!lpszClassName)
                continue;
            xmlChild.attribute(L"name").set_userdata(1);
            GetKeyObject(lpszClassName).InitFromXml(xmlChild);
            xmlChild.attribute(L"name").set_userdata(0);
        }
        return TRUE;
    }
Exemplo n.º 10
0
BOOL DuiStringPool::BuildString(CDuiStringT &strContainer)
{
    BOOL bRet=FALSE;
    int nSubStringStart=-1;
    int nSubStringEnd=0;
    while ((nSubStringStart = strContainer.Find(_T("%str"), nSubStringEnd))!=-1)
    {
        nSubStringEnd = strContainer.Find(_T('%'), nSubStringStart + 4);
        if(nSubStringEnd==-1)
            break;
        nSubStringEnd++;
        int nID = ::StrToInt((LPCTSTR)strContainer + nSubStringStart + 4);
        if (0 >= nID)
            break;
        CDuiStringT strNewSub=GetKeyObject((UINT)nID);
        strContainer = strContainer.Left(nSubStringStart)
                       + strNewSub
                       + strContainer.Mid(nSubStringEnd);
        nSubStringEnd+=strNewSub.GetLength()-(nSubStringEnd-nSubStringStart);
        bRet=TRUE;
    }
    return bRet;
}
Exemplo n.º 11
0
 ISkinObj * SSkinFactoryMgr::CreateSkinByName( LPCWSTR pszClassName )
 {
     if(!HasKey(pszClassName)) return NULL;
     return GetKeyObject(pszClassName)->NewSkin();
 }
Exemplo n.º 12
0
 // Get style object from pool by class name
 BOOL SStylePool::GetStyle(LPCWSTR lpszName, SwndStyle& style)
 {
     if(!HasKey(lpszName)) return FALSE;
     style=GetKeyObject(lpszName);
     return TRUE;
 }