UIDlgBuilder.cpp ( 文件浏览 )
- keepall 发布于 2016-08-23 13:24
- 浏览次数:550
- 下载次数: 1
- 下载需 20 积分
-
- 侵权举报
#include "StdAfx.h" // Download by http://www.codefans.net namespace DuiLib { CDialogBuilder::CDialogBuilder() : m_pCallback(NULL), m_pstrtype(NULL) { } CControlUI* CDialogBuilder::Create(STRINGorID xml, LPCTSTR type, IDialogBuilderCallback* pCallback, CPaintManagerUI* pManager, CControlUI* pParent) { if( HIWORD(xml.m_lpstr) != NULL ) { if( *(xml.m_lpstr) == _T('<') ) { if( !m_xml.Load(xml.m_lpstr) ) return NULL; } else { if( !m_xml.LoadFromFile(xml.m_lpstr) ) return NULL; } } else { HRSRC hResource = ::FindResource(CPaintManagerUI::GetResourceDll(), xml.m_lpstr, type); if( hResource == NULL ) return NULL; HGLOBAL hGlobal = ::LoadResource(CPaintManagerUI::GetResourceDll(), hResource); if( hGlobal == NULL ) { FreeResource(hResource); return NULL; } m_pCallback = pCallback; if( !m_xml.LoadFromMem((BYTE*)::LockResource(hGlobal), ::SizeofResource(CPaintManagerUI::GetResourceDll(), hResource) )) return NULL; ::FreeResource(hResource); m_pstrtype = type; } return Create(pCallback, pManager); } CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback, CPaintManagerUI* pManager, CControlUI* pParent) { m_pCallback = pCallback; CMarkupNode root = m_xml.GetRoot(); if( !root.IsValid() ) return NULL; if( pManager ) { LPCTSTR pstrClass = NULL; int nAttributes = 0; LPCTSTR pstrName = NULL; LPCTSTR pstrValue = NULL; LPTSTR pstr = NULL; for( CMarkupNode node = root.GetChild() ; node.IsValid(); node = node.GetSibling() ) { pstrClass = node.GetName(); if( _tcscmp(pstrClass, _T("Image")) == 0 ) { nAttributes = node.GetAttributeCount(); LPCTSTR pImageName = NULL; LPCTSTR pImageResType = NULL; DWORD mask = 0; for( int i = 0; i < nAttributes; i++ ) { pstrName = node.GetAttributeName(i); pstrValue = node.GetAttributeValue(i); if( _tcscmp(pstrName, _T("name")) == 0 ) { pImageName = pstrValue; } else if( _tcscmp(pstrName, _T("restype")) == 0 ) { pImageResType = pstrValue; } else if( _tcscmp(pstrName, _T("mask")) == 0 ) { if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue); mask = _tcstoul(pstrValue, &pstr, 16); } } if( pImageName ) pManager->AddImage(pImageName, pImageResType, mask); } else if( _tcscmp(pstrClass, _T("Font")) == 0 ) { nAttributes = node.GetAttributeCount(); [!==More==!]
...
展开> <收缩
Sponsored links
源码文件列表
温馨提示: 点击源码文件名可预览文件内容哦 ^_^ Sponsored links