File size: 2,584 Bytes
b6a38d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	group = "ModManager",
	id = "ModManagerPopup",
	save_in = "Common",
	PlaceObj('XTemplateWindow', {
		'__class', "XPopup",
		'Id', "idPopUp",
		'BorderWidth', 0,
		'MinWidth', 225,
		'BorderColor', RGBA(128, 128, 128, 0),
		'Background', RGBA(25, 28, 29, 230),
		'FocusedBackground', RGBA(240, 240, 240, 0),
		'AnchorType', "center-bottom",
	}, {
		PlaceObj('XTemplateFunc', {
			'name', "Open",
			'func', function (self, ...)
				local content = self:ResolveId("idContent")
				content:SetChildrenHandleMouse(false)
				content:SetHandleMouse(true)
				content.OnMouseButtonDown = function(this, pos, button)
					if button == "L" then
						ModsUIToggleSortPC(this:ResolveId("idContentWrapper"))
						local dlg = GetDialog(this)
						local obj = dlg.context
						ObjModified(obj)
						return "break"
					end
				end
				XPopup.Open(self, ...)
			end,
		}),
		PlaceObj('XTemplateFunc', {
			'name', "OnDelete",
			'func', function (self, ...)
				local content = self:ResolveId("idContent")
				content:SetChildrenHandleMouse(true)
				content:SetHandleMouse(false)
				content.OnMouseButtonDown = nil
				XPopup.OnDelete(self, ...)
			end,
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XList",
			'Dock', "box",
		}, {
			PlaceObj('XTemplateForEach', {
				'array', function (parent, context) return GetModsUISortItems(GetDialogMode(parent)) end,
				'run_after', function (child, context, item, i, n, last)
					local dlg = GetDialog(child)
					local mode = dlg.Mode
					child:SetText(item.name)
					if mode == "browse" then
						child:SetCheck(context.set_sort==item.id)
					else
						child:SetCheck(context.set_installed_sort==item.id)
					end
					child.OnChange = function(this, check)
						local obj = dlg.context
						if mode == "browse" then
							obj:SetSortMethod(item.id)
						else
							obj:SetInstalledSortMethod(item.id)
						end
						ObjModified(obj)
						if not GetUIStyleGamepad() then
							local btn = dlg:ResolveId("idSortButton")
							if btn then
								btn:SetText(btn:GetText())
							end
							ModsUIToggleSortPC(dlg.idContentWrapper)
						else
							ModsUIClosePopup(dlg)
						end
					end
				end,
			}, {
				PlaceObj('XTemplateWindow', {
					'__class', "XCheckButton",
					'Translate', true,
				}, {
					PlaceObj('XTemplateFunc', {
						'name', "SetSelected(self, selected)",
						'func', function (self, selected)
							self:SetFocus(selected)
						end,
					}),
					}),
				}),
			}),
		}),
})