Example #1
0
int CLuaInstCCText::CCTextScroll(lua_State *L)
{
	lua_assert(lua_istable(L,1));
	CLuaCCText *D = CCTextCheck(L, 1);
	if (!D) return 0;

	std::string tmp = "true";
	tableLookup(L, "dir", tmp);
	bool scrollDown = (tmp == "down" || tmp == "1");
	lua_Integer pages = 1;
	tableLookup(L, "pages", pages);

	//get the textbox instance from lua object and use CTexBbox scroll methods
	CTextBox* ctb = D->ct->getCTextBoxObject();
	if (ctb) {
		if (pages == -1)
			pages = ctb->getPages();
		ctb->enableBackgroundPaint(true);
		if (scrollDown)
			ctb->scrollPageDown(pages);
		else
			ctb->scrollPageUp(pages);
		ctb->enableBackgroundPaint(false);
	}
	return 0;
}
//scroll licens text
void CImageInfo::ScrollLic(bool scrollDown)
{
	if (cc_lic && (cc_lic->cctext)) {
		//get the textbox instance from infobox object and use CTexBbox scroll methods
		CTextBox* ctb = cc_lic->cctext->getCTextBoxObject();
		if (ctb) {
			//ctb->enableBackgroundPaint(true);
			if (scrollDown)
				ctb->scrollPageDown(1);
			else
				ctb->scrollPageUp(1);
			//ctb->enableBackgroundPaint(false);
		}
	}
}