@@ -134,6 +134,9 @@ void CLuaGUIDefs::LoadFunctions(void)
134
134
CLuaCFunctions::AddFunction (" guiMemoGetCaretIndex" , GUIMemoGetCaretIndex);
135
135
CLuaCFunctions::AddFunction (" guiMemoSetReadOnly" , GUIMemoSetReadOnly);
136
136
CLuaCFunctions::AddFunction (" guiMemoIsReadOnly" , GUIMemoIsReadOnly);
137
+ CLuaCFunctions::AddFunction (" guiMemoSetVerticalScrollPosition" , GUIMemoSetVerticalScrollPosition);
138
+ CLuaCFunctions::AddFunction (" guiMemoGetVerticalScrollPosition" , GUIMemoGetVerticalScrollPosition);
139
+ CLuaCFunctions::AddFunction (" guiMemoGetMaxVerticalScrollPosition" , GUIMemoGetMaxVerticalScrollPosition);
137
140
138
141
CLuaCFunctions::AddFunction (" guiLabelSetColor" , GUILabelSetColor);
139
142
CLuaCFunctions::AddFunction (" guiLabelGetColor" , GUILabelGetColor);
@@ -320,9 +323,17 @@ void CLuaGUIDefs::AddGuiMemoClass(lua_State* luaVM)
320
323
lua_classfunction (luaVM, " setCaretIndex" , " guiMemoSetCaretIndex" );
321
324
lua_classfunction (luaVM, " setReadOnly" , " guiMemoSetReadOnly" );
322
325
326
+ lua_classfunction (luaVM, " getVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
327
+ lua_classfunction (luaVM, " getMaxVerticalScrollPosition" , " guiMemoGetMaxVerticalScrollPosition" );
328
+
329
+ lua_classfunction (luaVM, " setVerticalScrollPosition" , " guiMemoSetVerticalScrollPosition" );
330
+
323
331
lua_classvariable (luaVM, " caretIndex" , " guiMemoSetCaretIndex" , " guiMemoGetCaretIndex" );
324
332
lua_classvariable (luaVM, " readOnly" , " guiMemoSetReadOnly" , " guiMemoIsReadOnly" );
325
333
334
+ lua_classvariable (luaVM, " verticalScrollPosition" , " guiMemoSetVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
335
+ lua_classvariable (luaVM, " maxVerticalScrollPosition" , NULL , " guiMemoGetMaxVerticalScrollPosition" );
336
+
326
337
lua_registerclass (luaVM, " GuiMemo" , " GuiElement" );
327
338
}
328
339
@@ -3132,6 +3143,29 @@ int CLuaGUIDefs::GUIMemoSetCaretIndex(lua_State* luaVM)
3132
3143
return 1 ;
3133
3144
}
3134
3145
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
+
3135
3169
int CLuaGUIDefs::GUIMemoGetCaretIndex (lua_State* luaVM)
3136
3170
{
3137
3171
// bool guiMemoGetCaretIndex ( gui-memo theMemo )
@@ -3153,6 +3187,51 @@ int CLuaGUIDefs::GUIMemoGetCaretIndex(lua_State* luaVM)
3153
3187
return 1 ;
3154
3188
}
3155
3189
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
+
3156
3235
int CLuaGUIDefs::GUIWindowSetMovable (lua_State* luaVM)
3157
3236
{
3158
3237
// bool guiWindowSetMovable ( element theElement, bool status )
0 commit comments