Esempio n. 1
0
void CAAlertView::showMessage(std::string title, std::string alertMsg, std::vector<std::string>& vBtnText)
{
	setTitleImage(CAImage::create("source_material/alert_title.png"));
	setContentBackGroundImage(CAImage::create("source_material/alert_content.png"));
	setTitle(title.c_str(), CAColor_white);
	setAlertMessage(alertMsg.c_str());
	
	initAllButton(vBtnText);
	setAllBtnBackGroundImage(CAControlStateNormal, CAImage::create("source_material/alert_btn.png"));
	setAllBtnBackGroundImage(CAControlStateHighlighted, CAImage::create("source_material/alert_btn_sel.png"));
	setAllBtnTextColor();

	calcuCtrlsSize();

	CAApplication* pApplication = CAApplication::getApplication();
	CCAssert(pApplication != NULL, "");
	pApplication->getRootWindow()->insertSubview(this, CAWindowZoderCenter);
	retain();
}
Esempio n. 2
0
bool CAAlertView::initWithText(const char* szTitle, const char* szAlertMsg, const char* pszBtnText, ...)
{
	if (!this->init())
	{
		return false;
	}

	va_list args;
	va_start(args, pszBtnText);

	addButton(pszBtnText);
	const char* pszText = va_arg(args, const char*);
	while (pszText)
	{
		addButton(pszText);
		pszText = va_arg(args, const char*);
	}
	va_end(args);

	setTitle(szTitle, CAColor_black);
	setAlertMessage(szAlertMsg);
	return true;
}