#include "InstallPage.h"

InstallationPage::InstallationPage(CPaintManagerUI* m_pm)
{
	this->m_pm = m_pm;
	InitControls();
	InitLanguage();
 }
InstallationPage::~InstallationPage()
{
	LayoutHome = NULL;
	Btninstall = NULL;
	BtnIconSelectFolder = NULL;
	BtnTextSelectFolder = NULL;
	TextShowContentLink = NULL;
	CheckInstallSetting = NULL;
	EdFilepath = NULL;
}

void InstallationPage::InitControls()
{
	LayoutHome = static_cast<CVerticalLayoutUI*>(m_pm->FindControl(UI_LayoutHome));
	Btninstall = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnInstall));
	BtnIconSelectFolder = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnIconSelectFolder));
	BtnTextSelectFolder = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnTextSelectFolder));

	TxtByClickInstall = static_cast<CTextUI*>(m_pm->FindControl(UI_TxtByClickInstall));
	BtnTermsService = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnTermsService));
	TxtAnd = static_cast<CTextUI*>(m_pm->FindControl(UI_TxtAnd));
	BtnPrivacyPolicy = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnPrivacyPolicy));

	InstallationfolderTitle = static_cast<CLabelUI*>(m_pm->FindControl(UI_LbInstallationfolderTitle));

	TextShowContentLink = static_cast<CTextUI*>(m_pm->FindControl(UI_TextShowContentLink));//因无法修改超链颜色，所以暂时停用
	CheckInstallSetting = static_cast<CCheckBoxUI*>(m_pm->FindControl(UI_CheckInstallSetting));
	EdFilepath = static_cast<CRichEditUI*>(m_pm->FindControl(UI_EdFilepath));
	EdFilepath->SetContextMenuUsed(true);

	Lbicon = static_cast<CButtonUI*>(m_pm->FindControl(UI_Lbicon));

	BtnClose = static_cast<CButtonUI*>(m_pm->FindControl(UI_BtnClose));
}

void InstallationPage::InitLanguage()
{
	InstallationfolderTitle->SetText(UIstr(TextType::Text_InstallPath));
	Btninstall->SetText(UIstr(TextType::Btn_Install));
	BtnTextSelectFolder->SetText(UIstr(TextType::Btn_FilePath));
	EdFilepath->SetText(PathCore::smPath_Install.c_str());
	FolderCore::GetOrCreateFolderPath(PathCore::smPath_Install);
	TextShowContentLink->SetText(UIstr(TextType::Link_Install));

	CheckInstallSetting->SetText(UIstr(TextType::Btn_CutomInstall));
	Lbicon->SetText(L"▼");

	TxtByClickInstall->SetText(UIstr(TextType::Txt_ByClickInstall));
	BtnTermsService->SetText(UIstr(TextType::Btn_TermsService));
	TxtAnd->SetText(UIstr(TextType::Txt_And));
	BtnPrivacyPolicy->SetText(UIstr(TextType::Btn_PrivacyPolicy));
}

CDuiString InstallationPage::UIstr(TextType textType)
{
	CDuiString duiStr(CLanguage::GetText(textType).c_str());
	return duiStr;
}

void InstallationPage::InitValue()
{
}