UIChildLayout.cpp 1.2 KB

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