InstalledPage.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include "InstalledPage.h"
  2. #include "KeyVar.h"
  3. InstalledPage::InstalledPage(CPaintManagerUI* m_pm)
  4. {
  5. this->m_pm = m_pm;
  6. InitControls();
  7. InitLanguage();
  8. }
  9. InstalledPage::~InstalledPage()
  10. {
  11. LayoutInstalled = NULL;
  12. LbInstalledPath = NULL;
  13. BtnOpenApp = NULL;
  14. BtnOpenApp = NULL;
  15. }
  16. void InstalledPage::InitControls()
  17. {
  18. LayoutInstalled = static_cast<CVerticalLayoutUI*>(m_pm->FindControl(UI_LayoutInstalled));
  19. LbInstalledPath = static_cast<CLabelUI*>(m_pm->FindControl(UI_LbInstalledPath));
  20. BtnOpenApp = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnOpenApp));
  21. }
  22. void InstalledPage::InitLanguage()
  23. {
  24. BtnOpenApp->SetText(CLanguage::GetDuiText(TextType::Btn_OpenApp));
  25. std::wstring ss = CLanguage::GetText(TextType::Btn_GoToFilesPath) + PathCore::smPath_Install;
  26. LbInstalledPath->SetText(ss.c_str());
  27. }
  28. void InstalledPage::InitValue()
  29. {
  30. }
  31. void InstalledPage::RefreshInstalledPath(wstring sFolder)
  32. {
  33. LbInstalledPath->SetToolTipWidth(720);
  34. //路径超过一定的长度,字符串末尾显示省略号
  35. if (sFolder.length() > 55)
  36. {
  37. wstring str = sFolder.substr(0, 55) + L"...";
  38. LbInstalledPath->SetToolTip(sFolder.c_str());
  39. LbInstalledPath->SetText(str.c_str());
  40. }
  41. else
  42. {
  43. LbInstalledPath->SetToolTip(L"");
  44. LbInstalledPath->SetText(sFolder.c_str());
  45. }
  46. }