forked from thisdp/dgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdgsExportedFunction.lua
More file actions
536 lines (522 loc) · 20.2 KB
/
dgsExportedFunction.lua
File metadata and controls
536 lines (522 loc) · 20.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
dgsExportedFunctionName = {}
dgsResName = getResourceName(getThisResource())
addEventHandler("onClientResourceStart",resourceRoot,function()
triggerEvent("onDgsStart",resourceRoot,dgsResName)
end)
function dgsConfigureTDX()
local tdx = getResourceName(sourceResource)
return [[
---
addEvent("onDgsRenderTDX",true)
local DGSResName = "]]..getResourceName(getThisResource())..[["
exports[DGSResName]:dgsSetRenderSetting("postGUI",false) --for compatibility for TDX
local __addEventHandler = addEventHandler
local __removeEventHandler = removeEventHandler
local DGSTDXRef = {}
local TDXDGSRef = {}
local TDXClassFncRef = {}
local DGSTDXQueue = {
onClientRender={},
onClientPreRender={},
}
local eventRep = {
onClientRender = "DGSI_onClientRender_",
onClientPreRender = "DGSI_onClientPreRender_",
}
DGSConfigured = true
function addEventHandler(eventN,sourceEle,fnc,...)
if eventRep[eventN] then
DGSTDXQueue[eventN][fnc] = true
end
eventN = eventRep[eventN] or eventN
return __addEventHandler(eventN,sourceEle,fnc,...)
end
function removeEventHandler(eventN,sourceEle,fnc,...)
if eventRep[eventN] then
DGSTDXQueue[eventN][fnc] = nil
end
eventN = eventRep[eventN] or eventN
return __addEventHandler(eventN,sourceEle,fnc,...)
end
local _new = new
local _delete = delete
local _getPrivateMethod = getPrivateMethod
local _DxElementBringToFront = DxElement.bringToFront
local _DxElementSendToBack = DxElement.sendToBack
DxElement.bringToFront = function(self,...)
_DxElementBringToFront(self,...)
if TDXDGSRef[self] then
exports[DGSResName]:dgsBringToFront(TDXDGSRef[self])
end
end
DxElement.sendToBack = function(self,...)
_DxElementSendToBack(self,...)
if TDXDGSRef[self] then
exports[DGSResName]:dgsMoveToBack(TDXDGSRef[self])
end
end
new = function(...)
local result = _new(...)
TDXDGSRef[result] = exports[DGSResName]:dgsCreateExternal(_,_,"onDgsRenderTDX")
DGSTDXRef[ TDXDGSRef[result] ] = result
result.dgsElement = TDXDGSRef[result]
return result
end
delete = function(self,...)
if isElement(TDXDGSRef[self]) then
DGSTDXRef[ TDXDGSRef[self] ] = nil
destroyElement(TDXDGSRef[self])
TDXDGSRef[self] = nil
TDXClassFncRef[self] = nil
end
return _delete(self,...)
end
addEventHandler("onDgsRenderTDX",root,function()
local self = DGSTDXRef[source]
local renderFnc = getPrivateMethod(self, "render")
local prerenderFnc = getPrivateMethod(self, "prerender")
if DGSTDXQueue["onClientPreRender"][prerenderFnc] then
prerenderFnc()
end
if DGSTDXQueue["onClientRender"][renderFnc] then
renderFnc()
end
end)
]]
end
function dgsImportFunction(name,nameAs)
if not name then
local allCode = [[
--Check Error Message Above
if not dgsImportHead then
local getResourceRootElement = getResourceRootElement
local call = call
local getResourceFromName = getResourceFromName
local tostring = tostring
local outputDebugString = outputDebugString
local DGSCallMT = {}
local dgsImportHead = {}
dgsImportHead.dgsName = "]]..dgsResName..[["
dgsImportHead.dgsResource = getResourceFromName(dgsImportHead.dgsName)
dgsRoot = getResourceRootElement(dgsImportHead.dgsResource)
addEventHandler("onClientResourceStop",dgsRoot,function()
outputDebugString("[DGS] Alert! DGS has stopped. Everything keeps disconnected from DGS till the next time DGS starts!",2)
function onDgsStart(dResN)
outputDebugString("[DGS] DGS has started, reconnecting to DGS...",3)
dgsImportHead = nil
loadstring(exports[dResN]:dgsImportFunction())()
removeEventHandler("onDgsStart",root,onDgsStart)
end
addEventHandler("onDgsStart",root,onDgsStart)
end)
function DGSCallMT:__index(k)
if type(k) ~= 'string' then k = tostring(k) end
self[k] = function(...)
assert(dgsImportHead,"DGS import data is missing or DGS is not running, please reimport dgs functions("..getResourceName(getThisResource())..")")
if isElement(dgsRoot) then
return call(dgsImportHead.dgsResource, k, ...)
else
dgsImportHead = nil
dgsRoot = nil
return nil
end
end
return self[k]
end
DGS = setmetatable({}, DGSCallMT)
function unloadDGSFunction()
end
end
]]
for i,name in ipairs(getResourceExportedFunctions()) do
allCode = allCode.."\n "..name.." = DGS."..name..";"
end
return allCode
else
assert(dgsExportedFunctionName[name],"Bad Argument @dgsImportFunction at argument 1, the function is undefined")
nameAs = nameAs or name
return nameAs.." = DGS."..name..";"
end
end
function dgsG2DLoadHooker()
return [[
if isGUIGridList then return end
isGUIGridList = {}
loadstring(exports.dgs:dgsImportFunction())()
_guiBringToFront = guiBringToFront
_guiCreateFont = guiCreateFont
_guiBlur = guiBlur
_guiFocus = guiFocus
_guiGetAlpha = guiGetAlpha
_guiGetEnabled = guiGetEnabled
_guiGetFont = guiGetFont
_guiGetInputEnabled = guiGetInputEnabled
_guiGetInputMode = guiGetInputMode
_guiGetPosition = guiGetPosition
_guiGetProperties = guiGetProperties
_guiGetProperty = guiGetProperty
_guiGetScreenSize = guiGetScreenSize
_guiGetSize = guiGetSize
_guiGetText = guiGetText
_guiGetVisible = guiGetVisible
_guiMoveToBack = guiMoveToBack
_guiSetAlpha = guiSetAlpha
_guiSetEnabled = guiSetEnabled
_guiSetFont = guiSetFont
_guiSetInputEnabled = guiSetInputEnabled
_guiSetInputMode = guiSetInputMode
_guiSetPosition = guiSetPosition
_guiSetProperty = guiSetProperty
_guiSetSize = guiSetSize
_guiSetText = guiSetText
_guiSetVisible = guiSetVisible
_guiCreateBrowser = guiCreateBrowser
_guiCreateButton = guiCreateButton
_guiCheckBoxGetSelected = guiCheckBoxGetSelected
_guiCheckBoxSetSelected = guiCheckBoxSetSelected
_guiCreateCheckBox = guiCreateCheckBox
_guiCreateComboBox = guiCreateComboBox
_guiComboBoxAddItem = guiComboBoxAddItem
_guiComboBoxClear = guiComboBoxClear
_guiComboBoxGetItemCount = guiComboBoxGetItemCount
_guiComboBoxGetItemText = guiComboBoxGetItemText
_guiComboBoxGetSelected = guiComboBoxGetSelected
_guiComboBoxIsOpen = guiComboBoxIsOpen
_guiComboBoxRemoveItem = guiComboBoxRemoveItem
_guiComboBoxSetItemText = guiComboBoxSetItemText
_guiComboBoxSetOpen = guiComboBoxSetOpen
_guiComboBoxSetSelected = guiComboBoxSetSelected
_guiCreateEdit = guiCreateEdit
_guiEditGetCaretIndex = guiEditGetCaretIndex
_guiEditGetMaxLength = guiEditGetMaxLength
_guiEditIsMasked = guiEditIsMasked
_guiEditIsReadOnly = guiEditIsReadOnly
_guiEditSetCaretIndex = guiEditSetCaretIndex
_guiEditSetMasked = guiEditSetMasked
_guiEditSetMaxLength = guiEditSetMaxLength
_guiEditSetReadOnly = guiEditSetReadOnly
_guiCreateGridList = guiCreateGridList
_guiGridListAddColumn = guiGridListAddColumn
_guiGridListAddRow = guiGridListAddRow
_guiGridListAutoSizeColumn = guiGridListAutoSizeColumn
_guiGridListClear = guiGridListClear
_guiGridListGetColumnCount = guiGridListGetColumnCount
_guiGridListGetColumnTitle = guiGridListGetColumnTitle
_guiGridListGetColumnWidth = guiGridListGetColumnWidth
_guiGridListGetItemColor = guiGridListGetItemColor
_guiGridListGetItemData = guiGridListGetItemData
_guiGridListGetItemText = guiGridListGetItemText
_guiGridListGetRowCount = guiGridListGetRowCount
_guiGridListGetSelectedCount = guiGridListGetSelectedCount
_guiGridListGetSelectedItem = guiGridListGetSelectedItem
_guiGridListGetSelectedItems = guiGridListGetSelectedItems
_guiGridListGetSelectionMode = guiGridListGetSelectionMode
_guiGridListIsSortingEnabled = guiGridListIsSortingEnabled
_guiGridListRemoveColumn = guiGridListRemoveColumn
_guiGridListRemoveRow = guiGridListRemoveRow
_guiGridListSetColumnTitle = guiGridListSetColumnTitle
_guiGridListSetColumnWidth = guiGridListSetColumnWidth
_guiGridListSetItemColor = guiGridListSetItemColor
_guiGridListSetItemData = guiGridListSetItemData
_guiGridListSetItemText = guiGridListSetItemText
_guiGridListSetScrollBars = guiGridListSetScrollBars
_guiGridListSetSelectedItem = guiGridListSetSelectedItem
_guiGridListSetSelectionMode = guiGridListSetSelectionMode
_guiGridListSetSortingEnabled = guiGridListSetSortingEnabled
_guiCreateMemo = guiCreateMemo
_guiMemoGetCaretIndex = guiMemoGetCaretIndex
_guiMemoIsReadOnly = guiMemoIsReadOnly
_guiMemoSetCaretIndex = guiMemoSetCaretIndex
_guiMemoSetReadOnly = guiMemoSetReadOnly
_guiCreateProgressBar = guiCreateProgressBar
_guiProgressBarGetProgress = guiProgressBarGetProgress
_guiProgressBarSetProgress = guiProgressBarSetProgress
_guiCreateRadioButton = guiCreateRadioButton
_guiRadioButtonGetSelected = guiRadioButtonGetSelected
_guiRadioButtonSetSelected = guiRadioButtonSetSelected
_guiCreateScrollBar = guiCreateScrollBar
_guiScrollBarGetScrollPosition = guiScrollBarGetScrollPosition
_guiScrollBarSetScrollPosition = guiScrollBarSetScrollPosition
_guiCreateScrollPane = guiCreateScrollPane
_guiScrollPaneSetScrollBars = guiScrollPaneSetScrollBars
_guiCreateStaticImage = guiCreateStaticImage
_guiStaticImageGetNativeSize = guiStaticImageGetNativeSize
_guiStaticImageLoadImage = guiStaticImageLoadImage
_guiCreateTabPanel = guiCreateTabPanel
_guiGetSelectedTab = guiGetSelectedTab
_guiSetSelectedTab = guiSetSelectedTab
_guiCreateTab = guiCreateTab
_guiDeleteTab = guiDeleteTab
_guiCreateLabel = guiCreateLabel
_guiLabelGetColor = guiLabelGetColor
_guiLabelGetFontHeight = guiLabelGetFontHeight
_guiLabelGetTextExtent = guiLabelGetTextExtent
_guiLabelSetColor = guiLabelSetColor
_guiLabelSetHorizontalAlign = guiLabelSetHorizontalAlign
_guiLabelSetVerticalAlign = guiLabelSetVerticalAlign
_guiCreateWindow = guiCreateWindow
_guiWindowIsMovable = guiWindowIsMovable
_guiWindowIsSizable = guiWindowIsSizable
_guiWindowSetMovable = guiWindowSetMovable
_guiWindowSetSizable = guiWindowSetSizable
_guiGridListGetHorizontalScrollPosition = guiGridListGetHorizontalScrollPosition
_guiGridListSetHorizontalScrollPosition = guiGridListSetHorizontalScrollPosition
_guiGridListGetVerticalScrollPosition = guiGridListGetVerticalScrollPosition
_guiGridListSetVerticalScrollPosition = guiGridListSetVerticalScrollPosition
_guiMemoGetVerticalScrollPosition = guiMemoGetVerticalScrollPosition
_guiMemoSetVerticalScrollPosition = guiMemoSetVerticalScrollPosition
_guiScrollPaneGetHorizontalScrollPosition = guiScrollPaneGetHorizontalScrollPosition
_guiScrollPaneGetVerticalScrollPosition = guiScrollPaneGetVerticalScrollPosition
_guiScrollPaneSetHorizontalScrollPosition = guiScrollPaneSetHorizontalScrollPosition
_guiScrollPaneSetVerticalScrollPosition = guiScrollPaneSetVerticalScrollPosition
_guiGridListInsertRowAfter = guiGridListInsertRowAfter
_guiGetBrowser = guiGetBrowser
--GUI TO DGS
guiBringToFront = dgsBringToFront
guiCreateFont = dgsCreateFont
guiBlur = dgsBlur
guiFocus = dgsFocus
guiGetAlpha = dgsGetAlpha
guiGetEnabled = dgsGetEnabled
guiGetFont = dgsGetFont
guiGetInputEnabled = dgsGetInputEnabled
guiGetInputMode = dgsGetInputMode
guiGetPosition = dgsGetPosition
guiGetProperties = dgsGetProperties
guiGetProperty = dgsGetProperty
guiGetScreenSize = dgsGetScreenSize
guiGetSize = dgsGetSize
guiGetText = dgsGetText
guiGetVisible = dgsGetVisible
guiMoveToBack = dgsMoveToBack
guiSetAlpha = dgsSetAlpha
guiSetEnabled = dgsSetEnabled
guiSetFont = dgsSetFont
guiSetInputEnabled = dgsSetInputEnabled
guiSetInputMode = dgsSetInputMode
guiSetPosition = dgsSetPosition
guiSetProperty = dgsSetProperty
guiSetSize = dgsSetSize
guiSetText = dgsSetText
guiSetVisible = dgsSetVisible
guiCreateBrowser = dgsCreateBrowser
guiCreateButton = dgsCreateButton
guiCheckBoxGetSelected = dgsCheckBoxGetSelected
guiCheckBoxSetSelected = dgsCheckBoxSetSelected
guiCreateCheckBox = dgsCreateCheckBox
guiCreateComboBox = dgsCreateComboBox
guiComboBoxAddItem = dgsComboBoxAddItem
guiComboBoxClear = dgsComboBoxClear
guiComboBoxGetItemCount = dgsComboBoxGetItemCount
guiComboBoxGetItemText = dgsComboBoxGetItemText
guiComboBoxGetSelected = dgsComboBoxGetSelected
guiComboBoxIsOpen = dgsComboBoxGetState
guiComboBoxRemoveItem = dgsComboBoxRemoveItem
guiComboBoxSetItemText = dgsComboBoxSetItemText
guiComboBoxSetOpen = dgsComboBoxSetState
guiComboBoxSetSelected = dgsComboBoxSetSelected
guiCreateEdit = dgsCreateEdit
guiEditGetCaretIndex = dgsEditGetCaretPosition
guiEditGetMaxLength = dgsEditGetMaxLength
guiEditIsMasked = dgsEditGetMasked
guiEditIsReadOnly = dgsEditGetReadOnly
guiEditSetCaretIndex = dgsEditSetCaretPosition
guiEditSetMasked = dgsEditSetMasked
guiEditSetMaxLength = dgsEditSetMaxLength
guiEditSetReadOnly = dgsEditSetReadOnly
guiCreateGridList = function(...)
local gl = dgsCreateGridList(...)
isGUIGridList[gl] = true
addEventHandler("onDgsDestroy",gl,function()
isGUIGridList[source] = nil
end,false)
return gl
end
guiGridListAddColumn = dgsGridListAddColumn
guiGridListInsertRowAfter = function(gl,row,...)
local rowData = dgsGetProperty(gl,"rowData")
if isGUIGridList[gl] then
row = tonumber(row) or #rowData
return dgsGridListInsertRowAfter(gl,row+1,...)-1
else
row = tonumber(row) or #rowData+1
return dgsGridListInsertRowAfter(gl,row,...)
end
end
guiGridListAddRow = function(gl,row,...)
local rowData = dgsGetProperty(gl,"rowData")
if isGUIGridList[gl] then
row = tonumber(row) or #rowData
return dgsGridListAddRow(gl,row+1,...)-1
else
row = tonumber(row) or #rowData+1
return dgsGridListAddRow(gl,row,...)
end
end
guiGridListGetItemColor = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListGetItemColor(gl,row,...)
end
guiGridListGetItemData = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListGetItemData(gl,row,...)
end
guiGridListSetItemData = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListSetItemData(gl,row,...)
end
guiGridListGetItemText = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListGetItemText(gl,row,...)
end
guiGridListSetItemText = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListSetItemText(gl,row,...)
end
guiGridListGetSelectedCount = dgsGridListGetSelectedCount
guiGridListGetSelectedItem = function(gl)
if isGUIGridList[gl] then
local selected = dgsGridListGetSelectedItem(gl)
if selected == -1 then return -1 end
return selected-1
else
return dgsGridListGetSelectedItem(gl)
end
end
guiGridListGetSelectedItems = function(gl,isOrigin)
local newItems = dgsGridListGetSelectedItems(gl,isOrigin)
if not isOrigin then
for k,v in ipairs(newItems) do
newItems[k].row = newItems[k].row+1
end
else
--To Do
end
return newItems
end
guiGridListRemoveRow = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListRemoveRow(gl,row,...)
end
guiGridListSetItemColor = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListSetItemColor(gl,row,...)
end
guiGridListSetSelectedItem = function(gl,row,...)
row = isGUIGridList[gl] and row+1 or row
return dgsGridListSetSelectedItem(gl,row,...)
end
guiGridListAutoSizeColumn = dgsGridListAutoSizeColumn
guiGridListClear = dgsGridListClear
guiGridListGetColumnCount = dgsGridListGetColumnCount
guiGridListGetColumnTitle = dgsGridListGetColumnTitle
guiGridListGetColumnWidth = dgsGridListGetColumnWidth
guiGridListGetRowCount = dgsGridListGetRowCount
guiGridListGetSelectionMode = dgsGridListGetSelectionMode
guiGridListIsSortingEnabled = dgsGridListGetSortEnabled
guiGridListRemoveColumn = dgsGridListRemoveColumn
guiGridListSetColumnTitle = dgsGridListSetColumnTitle
guiGridListSetColumnWidth = dgsGridListSetColumnWidth
guiGridListSetScrollBars = dgsGridListSetScrollBarState
guiGridListSetSelectionMode = dgsGridListSetSelectionMode
guiGridListSetSortingEnabled = dgsGridListSetSortEnabled
guiCreateMemo = dgsCreateMemo
guiMemoGetCaretIndex = dgsMemoGetCaretIndex
guiMemoIsReadOnly = dgsMemoIsReadOnly
guiMemoSetCaretIndex = dgsMemoSetCaretIndex
guiMemoSetReadOnly = dgsMemoSetReadOnly
guiCreateProgressBar = dgsCreateProgressBar
guiProgressBarGetProgress = dgsProgressBarGetProgress
guiProgressBarSetProgress = dgsProgressBarSetProgress
guiCreateRadioButton = dgsCreateRadioButton
guiRadioButtonGetSelected = dgsRadioButtonGetSelected
guiRadioButtonSetSelected = dgsRadioButtonSetSelected
guiCreateScrollBar = dgsCreateScrollBar
guiScrollBarGetScrollPosition = dgsScrollBarGetScrollPosition
guiScrollBarSetScrollPosition = dgsScrollBarSetScrollPosition
guiCreateScrollPane = dgsCreateScrollPane
guiScrollPaneSetScrollBars = dgsScrollPaneSetScrollBarState
guiCreateStaticImage = dgsCreateImage
guiStaticImageGetNativeSize = dgsImageGetNativeSize
guiStaticImageLoadImage = dgsImageSetImage
guiCreateTabPanel = dgsCreateTabPanel
guiGetSelectedTab = dgsGetSelectedTab
guiSetSelectedTab = dgsSetSelectedTab
guiCreateTab = dgsCreateTab
guiDeleteTab = dgsDeleteTab
guiCreateLabel = dgsCreateLabel
guiLabelGetColor = dgsLabelGetColor
guiLabelGetFontHeight = dgsLabelGetFontHeight
guiLabelGetTextExtent = dgsLabelGetTextExtent
guiLabelSetColor = dgsLabelSetColor
guiLabelSetHorizontalAlign = dgsLabelSetHorizontalAlign
guiLabelSetVerticalAlign = dgsLabelSetVerticalAlign
guiCreateWindow = function(...)
local window = dgsCreateWindow(...)
dgsSetProperty(window,"ignoreTitle",true)
dgsWindowSetCloseButtonEnabled(window,false)
return window
end
guiWindowIsMovable = dgsWindowGetMovable
guiWindowIsSizable = dgsWindowGetSizable
guiWindowSetMovable = dgsWindowSetMovable
guiWindowSetSizable = dgsWindowSetSizable
guiGridListGetHorizontalScrollPosition = dgsGridListGetHorizontalScrollPosition
guiGridListSetHorizontalScrollPosition = dgsGridListSetHorizontalScrollPosition
guiGridListGetVerticalScrollPosition = dgsGridListGetVerticalScrollPosition
guiGridListSetVerticalScrollPosition = dgsGridListSetVerticalScrollPosition
guiMemoGetVerticalScrollPosition = dgsMemoGetVerticalScrollPosition
guiMemoSetVerticalScrollPosition = dgsMemoSetVerticalScrollPosition
guiScrollPaneGetHorizontalScrollPosition = dgsScrollPaneGetHorizontalScrollPosition
guiScrollPaneGetVerticalScrollPosition = dgsScrollPaneGetVerticalScrollPosition
guiScrollPaneSetHorizontalScrollPosition = dgsScrollPaneSetHorizontalScrollPosition
guiScrollPaneSetVerticalScrollPosition = dgsScrollPaneSetVerticalScrollPosition
guiGetBrowser = dgsGetBrowser
addEvent("onDgsEditAccepted-C",true)
addEvent("onDgsTextChange-C",true)
addEvent("onDgsComboBoxSelect-C",true)
addEvent("onDgsTabSelect-C",true)
if not getElementData(root,"__DGSDef") then
setElementData(root,"__DGSDef",true)
function fncTrans(...)
triggerEvent(eventName.."-C",source,source,...)
end
addEventHandler("onDgsEditAccepted",root,fncTrans)
addEventHandler("onDgsTextChange",root,fncTrans)
addEventHandler("onDgsComboBoxSelect",root,fncTrans)
addEventHandler("onDgsTabSelect",root,fncTrans)
end
local eventReplace = {
onClientGUIAccepted="onDgsEditAccepted-C",
onClientGUIBlur="onDgsBlur",
onClientGUIChanged="onDgsTextChange-C",
onClientGUIClick="onDgsMouseClickUp",
onClientGUIComboBoxAccepted="onDgsComboBoxSelect-C",
onClientGUIDoubleClick="onDgsMouseDoubleClick",
onClientGUIFocus="onDgsFocus",
onClientGUIMouseDown="onDgsMouseDown",
onClientGUIMouseUp="onDgsMouseUp",
onClientGUIMove="onDgsElementMove",
onClientGUIScroll="onDgsElementScroll",
onClientGUISize="onDgsElementSize",
onClientGUITabSwitched="onDgsTabSelect-C",
onClientMouseEnter="onDgsMouseEnter",
onClientMouseLeave="onDgsMouseLeave",
onClientMouseMove="onDgsMouseMove",
onClientMouseWheel="onDgsMouseWheel",
}
_addEventHandler = addEventHandler
addEventHandler = function(even,...)
_addEventHandler(eventReplace[even] or even,...)
end
]]
end
-------Inside DGS
setElementData(root,"__DGSRes",getThisResource(),false)
addEventHandler("onClientResourceStop",resourceRoot,function() setElementData(root,"__DGSRes",false,false) end)
function dgsImportOOPClass()
local OOPFile = fileOpen("classlib.lua")
local str = fileRead(OOPFile,fileGetSize(OOPFile))
fileClose(OOPFile)
return str
end