mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
LUA-Api: add alignment parameter for text in window header
Possible modes are : * "DEFAULT" (left) * "CENTER" * "RIGHT" TODO: doc
This commit is contained in:
@@ -4,4 +4,4 @@
|
|||||||
* to luainstance.h changes
|
* to luainstance.h changes
|
||||||
*/
|
*/
|
||||||
#define LUA_API_VERSION_MAJOR 1
|
#define LUA_API_VERSION_MAJOR 1
|
||||||
#define LUA_API_VERSION_MINOR 70
|
#define LUA_API_VERSION_MINOR 71
|
||||||
|
@@ -220,7 +220,10 @@ int CLuaInstCCWindow::CCWindowSetCaption(lua_State *L)
|
|||||||
std::string name = "";
|
std::string name = "";
|
||||||
tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name);
|
tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name);
|
||||||
|
|
||||||
D->w->setWindowCaption(name);
|
lua_Integer alignment = (lua_Integer)CTextBox::NO_AUTO_LINEBREAK;
|
||||||
|
tableLookup(L, "alignment", alignment);
|
||||||
|
|
||||||
|
D->w->setWindowCaption(name, alignment | (lua_Integer)CTextBox::NO_AUTO_LINEBREAK);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -383,22 +383,35 @@ static void set_lua_variables(lua_State *L)
|
|||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* possible text allignment modes usable for window header caption
|
||||||
|
* API: >= v1.71
|
||||||
|
*/
|
||||||
|
table_key text_alignment[] =
|
||||||
|
{
|
||||||
|
{ "DEFAULT", (lua_Integer)CTextBox::NO_AUTO_LINEBREAK},
|
||||||
|
{ "CENTER", (lua_Integer)CTextBox::CENTER},
|
||||||
|
{ "RIGHT", (lua_Integer)CTextBox::RIGHT},
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
/* list of environment variable arrays to be exported */
|
/* list of environment variable arrays to be exported */
|
||||||
lua_envexport e[] =
|
lua_envexport e[] =
|
||||||
{
|
{
|
||||||
{ "RC", keyname },
|
{ "RC", keyname },
|
||||||
{ "SCREEN", screenopts },
|
{ "SCREEN", screenopts },
|
||||||
{ "FONT", fontlist },
|
{ "FONT", fontlist },
|
||||||
{ "CORNER", corners },
|
{ "CORNER", corners },
|
||||||
{ "OFFSET", offsets },
|
{ "OFFSET", offsets },
|
||||||
{ "MENU_RETURN", menureturn },
|
{ "MENU_RETURN", menureturn },
|
||||||
{ "APIVERSION", apiversion },
|
{ "APIVERSION", apiversion },
|
||||||
{ "PLAYSTATE", playstate },
|
{ "PLAYSTATE", playstate },
|
||||||
{ "CC", ccomponents },
|
{ "CC", ccomponents },
|
||||||
{ "DYNFONT", dynfont },
|
{ "DYNFONT", dynfont },
|
||||||
{ "CURL", curl_status },
|
{ "CURL", curl_status },
|
||||||
{ "NMODE", neutrino_mode },
|
{ "NMODE", neutrino_mode },
|
||||||
{ "POSTMSG", post_msg },
|
{ "POSTMSG", post_msg },
|
||||||
|
{ "TEXT_ALIGNMENT", text_alignment },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user