CLuaInstCCText::CCTextScroll: Add Parameter 'pages'

- By pages parameter the number of pages can be specified
 to be scrolled
 - Set Lua api version to 1.30

Example:
	ct = ctext.new{...}
	...
	ct:scroll{dir="down", pages=2};


Origin commit data
------------------
Branch: ni/coolstream
Commit: e3fdcaec99
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-12-14 (Mon, 14 Dec 2015)

Origin message was:
------------------
CLuaInstCCText::CCTextScroll: Add Parameter 'pages'

 - By pages parameter the number of pages can be specified
  to be scrolled
 - Set Lua api version to 1.30

Example:
	ct = ctext.new{...}
	...
	ct:scroll{dir="down", pages=2};


------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2015-12-14 22:33:33 +01:00
parent ce1107420e
commit 2ff8e3d4a8
2 changed files with 7 additions and 3 deletions

View File

@@ -215,15 +215,19 @@ int CLuaInstCCText::CCTextScroll(lua_State *L)
std::string tmp = "true"; std::string tmp = "true";
tableLookup(L, "dir", tmp); tableLookup(L, "dir", tmp);
bool scrollDown = (tmp == "down" || tmp == "1"); 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 //get the textbox instance from lua object and use CTexBbox scroll methods
CTextBox* ctb = m->ct->getCTextBoxObject(); CTextBox* ctb = m->ct->getCTextBoxObject();
if (ctb) { if (ctb) {
if (pages == -1)
pages = ctb->getPages();
ctb->enableBackgroundPaint(true); ctb->enableBackgroundPaint(true);
if (scrollDown) if (scrollDown)
ctb->scrollPageDown(1); ctb->scrollPageDown(pages);
else else
ctb->scrollPageUp(1); ctb->scrollPageUp(pages);
ctb->enableBackgroundPaint(false); ctb->enableBackgroundPaint(false);
} }
return 0; return 0;

View File

@@ -31,7 +31,7 @@ extern "C" {
#include "luainstance_helpers.h" #include "luainstance_helpers.h"
#define LUA_API_VERSION_MAJOR 1 #define LUA_API_VERSION_MAJOR 1
#define LUA_API_VERSION_MINOR 29 #define LUA_API_VERSION_MINOR 30
/* inspired by Steve Kemp http://www.steve.org.uk/ */ /* inspired by Steve Kemp http://www.steve.org.uk/ */
class CLuaInstance class CLuaInstance