DuiDesigner修改:增加对控件CheckBox属性的保存

版权声明:本文为博主原创文章,未经博主允许不得转载。网易内推职位:www.zhupite.com https://blog.csdn.net/asmcvc/article/details/88581385

这次修改主要是DuiDesigner工程,duilib工程无须任何修改。

  1. stdafx.h中enum UIClass枚举增加:classCheckBox,并引用命名空间:using DuiLib::CCheckBoxUI;

  2. stdafx.cpp中gGetUIClass增加:

if( _tcscmp(pstrClass, _T("CheckBoxUI")) == 0 )
    nClass=classCheckBox;

  1. LayoutManager.cpp函数CLayoutManager::NewUI增加:
case classCheckBox:
	pControl=new CCheckBoxUI;
	pExtended->nClass=classCheckBox;
	pControl->SetFloat(true);
	break;

函数CLayoutManager::SaveOptionProperty修改为:

void CLayoutManager::SaveOptionProperty(CControlUI* pControl, TiXmlElement* pNode)
{
    SaveButtonProperty(pControl, pNode);

    TCHAR szBuf[MAX_PATH] = {0};
    CString strClass = pControl->GetClass();
    COptionUI* pOptionUI = static_cast<COptionUI*>(pControl->GetInterface(_T("Option")));
    if ( strClass==_T("OptionUI") ) {
        if(pOptionUI->GetGroup() && _tcslen(pOptionUI->GetGroup()))
            pNode->SetAttribute("group",StringConvertor::WideToUtf8(pOptionUI->GetGroup()));
    }//CheckBoxUI

    if(pOptionUI->IsSelected())
        pNode->SetAttribute("selected", pOptionUI->IsSelected()?"true":"false");

    if(pOptionUI->GetForeImage() && _tcslen(pOptionUI->GetForeImage()) > 0)
        pNode->SetAttribute("foreimage", StringConvertor::WideToUtf8(ConvertImageFileName(pOptionUI->GetForeImage())));

    if(pOptionUI->GetSelectedImage() && _tcslen(pOptionUI->GetSelectedImage()) > 0)
        pNode->SetAttribute("selectedimage", StringConvertor::WideToUtf8(ConvertImageFileName(pOptionUI->GetSelectedImage())));

}

函数CLayoutManager::SaveProperties,增加:

case classOption:
case classCheckBox:
    SaveOptionProperty(pControl, pNode);

没有更多推荐了,返回首页