@@ -134,6 +134,9 @@ void CLuaGUIDefs::LoadFunctions(void)
134134 CLuaCFunctions::AddFunction (" guiMemoGetCaretIndex" , GUIMemoGetCaretIndex);
135135 CLuaCFunctions::AddFunction (" guiMemoSetReadOnly" , GUIMemoSetReadOnly);
136136 CLuaCFunctions::AddFunction (" guiMemoIsReadOnly" , GUIMemoIsReadOnly);
137+ CLuaCFunctions::AddFunction (" guiMemoSetVerticalScrollPosition" , GUIMemoSetVerticalScrollPosition);
138+ CLuaCFunctions::AddFunction (" guiMemoGetVerticalScrollPosition" , GUIMemoGetVerticalScrollPosition);
139+ CLuaCFunctions::AddFunction (" guiMemoGetMaxVerticalScrollPosition" , GUIMemoGetMaxVerticalScrollPosition);
137140
138141 CLuaCFunctions::AddFunction (" guiLabelSetColor" , GUILabelSetColor);
139142 CLuaCFunctions::AddFunction (" guiLabelGetColor" , GUILabelGetColor);
@@ -320,9 +323,17 @@ void CLuaGUIDefs::AddGuiMemoClass(lua_State* luaVM)
320323 lua_classfunction (luaVM, " setCaretIndex" , " guiMemoSetCaretIndex" );
321324 lua_classfunction (luaVM, " setReadOnly" , " guiMemoSetReadOnly" );
322325
326+ lua_classfunction (luaVM, " getVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
327+ lua_classfunction (luaVM, " getMaxVerticalScrollPosition" , " guiMemoGetMaxVerticalScrollPosition" );
328+
329+ lua_classfunction (luaVM, " setVerticalScrollPosition" , " guiMemoSetVerticalScrollPosition" );
330+
323331 lua_classvariable (luaVM, " caretIndex" , " guiMemoSetCaretIndex" , " guiMemoGetCaretIndex" );
324332 lua_classvariable (luaVM, " readOnly" , " guiMemoSetReadOnly" , " guiMemoIsReadOnly" );
325333
334+ lua_classvariable (luaVM, " verticalScrollPosition" , " guiMemoSetVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
335+ lua_classvariable (luaVM, " maxVerticalScrollPosition" , NULL , " guiMemoGetMaxVerticalScrollPosition" );
336+
326337 lua_registerclass (luaVM, " GuiMemo" , " GuiElement" );
327338}
328339
@@ -3132,6 +3143,29 @@ int CLuaGUIDefs::GUIMemoSetCaretIndex(lua_State* luaVM)
31323143 return 1 ;
31333144}
31343145
3146+ int CLuaGUIDefs::GUIMemoSetVerticalScrollPosition (lua_State* luaVM)
3147+ {
3148+ // bool guiMemoSetVerticalScrollPosition ( gui-memo theMemo, float fPosition )
3149+ CClientGUIElement* theMemo;
3150+ float fPosition ;
3151+
3152+ CScriptArgReader argStream (luaVM);
3153+ argStream.ReadUserData <CGUIMemo>(theMemo);
3154+ argStream.ReadNumber (fPosition );
3155+
3156+ if (!argStream.HasErrors ())
3157+ {
3158+ CStaticFunctionDefinitions::GUIMemoSetVerticalScrollPosition (*theMemo, fPosition );
3159+ lua_pushboolean (luaVM, true );
3160+ return 1 ;
3161+ }
3162+ else
3163+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
3164+
3165+ lua_pushboolean (luaVM, false );
3166+ return 1 ;
3167+ }
3168+
31353169int CLuaGUIDefs::GUIMemoGetCaretIndex (lua_State* luaVM)
31363170{
31373171 // bool guiMemoGetCaretIndex ( gui-memo theMemo )
@@ -3153,6 +3187,51 @@ int CLuaGUIDefs::GUIMemoGetCaretIndex(lua_State* luaVM)
31533187 return 1 ;
31543188}
31553189
3190+ int CLuaGUIDefs::GUIMemoGetMaxVerticalScrollPosition (lua_State* luaVM)
3191+ {
3192+ // float guiMemoGetMaxVerticalScrollPosition ( gui-memo theMemo )
3193+ CClientGUIElement* theMemo;
3194+
3195+ CScriptArgReader argStream (luaVM);
3196+ argStream.ReadUserData <CGUIMemo>(theMemo);
3197+
3198+ if (!argStream.HasErrors ())
3199+ {
3200+ float fPos = static_cast <CGUIMemo*>(theMemo->GetCGUIElement ())->GetMaxVerticalScrollPosition ();
3201+ lua_pushnumber (luaVM, fPos );
3202+ return 1 ;
3203+ }
3204+ else
3205+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
3206+
3207+ // error: bad arguments
3208+ lua_pushboolean (luaVM, false );
3209+ return 1 ;
3210+ }
3211+
3212+ int CLuaGUIDefs::GUIMemoGetVerticalScrollPosition (lua_State* luaVM)
3213+ {
3214+ // float guiMemoGetVerticalScrollPosition ( gui-memo theMemo )
3215+ CClientGUIElement* theMemo;
3216+
3217+ CScriptArgReader argStream (luaVM);
3218+ argStream.ReadUserData <CGUIMemo>(theMemo);
3219+
3220+ if (!argStream.HasErrors ())
3221+ {
3222+ CGUIMemo* guiMemo = static_cast <CGUIMemo*>(theMemo->GetCGUIElement ());
3223+ float fPos = guiMemo->GetVerticalScrollPosition () / guiMemo->GetMaxVerticalScrollPosition () * 100 .0f ;
3224+ lua_pushnumber (luaVM, fPos );
3225+ return 1 ;
3226+ }
3227+ else
3228+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
3229+
3230+ // error: bad arguments
3231+ lua_pushboolean (luaVM, false );
3232+ return 1 ;
3233+ }
3234+
31563235int CLuaGUIDefs::GUIWindowSetMovable (lua_State* luaVM)
31573236{
31583237 // bool guiWindowSetMovable ( element theElement, bool status )
0 commit comments