UIChildLayout.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "stdafx.h"
  2. #include "UIChildLayout.h"
  3. namespace DuiLib
  4. {
  5. CChildLayoutUI::CChildLayoutUI (IDialogBuilderCallback* pParentBuilder) :m_pParentBuilder (pParentBuilder)
  6. {
  7. }
  8. void CChildLayoutUI::Init()
  9. {
  10. if (!m_pstrXMLFile.IsEmpty())
  11. {
  12. CDialogBuilder builder;
  13. CContainerUI* pChildWindow = static_cast<CContainerUI*>(builder.Create(m_pstrXMLFile.GetData(), (UINT)0, m_pParentBuilder, m_pManager));
  14. if (pChildWindow)
  15. {
  16. this->Add(pChildWindow);
  17. }
  18. else
  19. {
  20. this->RemoveAll();
  21. }
  22. }
  23. }
  24. void CChildLayoutUI::SetAttribute( LPCTSTR pstrName, LPCTSTR pstrValue )
  25. {
  26. if( _tcscmp(pstrName, _T("xmlfile")) == 0 )
  27. SetChildLayoutXML(pstrValue);
  28. else
  29. CContainerUI::SetAttribute(pstrName,pstrValue);
  30. }
  31. void CChildLayoutUI::SetChildLayoutXML( CDuiString pXML )
  32. {
  33. m_pstrXMLFile=pXML;
  34. }
  35. CDuiString CChildLayoutUI::GetChildLayoutXML()
  36. {
  37. return m_pstrXMLFile;
  38. }
  39. LPVOID CChildLayoutUI::GetInterface( LPCTSTR pstrName )
  40. {
  41. if( _tcscmp(pstrName, DUI_CTR_CHILDLAYOUT) == 0 ) return static_cast<CChildLayoutUI*>(this);
  42. return CControlUI::GetInterface(pstrName);
  43. }
  44. LPCTSTR CChildLayoutUI::GetClass() const
  45. {
  46. return _T("ChildLayoutUI");
  47. }
  48. } // namespace DuiLib