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

PlaceObj('XTemplate', {
	__is_kind_of = "XListItem",
	group = "GedControls",
	id = "GedTextPickerItem",
	save_in = "Ged",
	PlaceObj('XTemplateWindow', {
		'__class', "XListItem",
		'BorderWidth', 0,
		'OnContextUpdate', function (self, context, ...)
			self.selectable = context.selectable
		end,
	}, {
		PlaceObj('XTemplateWindow', {
			'__class', "XText",
			'RolloverTemplate', "GedPropRollover",
			'RolloverAnchor', "bottom",
			'Padding', box(2, 1, 2, 1),
			'ContextUpdateOnOpen', true,
			'OnContextUpdate', function (self, context, ...)
				self:SetText(context.text)
				self:SetRolloverText(context.help)
				self:SetTextStyle(context.font)
				if context.documentation then
					self:SetRolloverText(context.documentation)
					self:SetRolloverTemplate("XEditorToolbarRollover")
					self:SetRolloverAnchor("left")
				end
				XContextControl.OnContextUpdate(self, context)
			end,
		}),
		PlaceObj('XTemplateWindow', {
			'__class', "XTextButton",
			'Id', "idToggleBookmark",
			'Dock', "right",
			'Visible', false,
			'FoldWhenHidden', true,
			'OnContextUpdate', function (self, context, ...)
				if context.bookmarked ~= nil then
					self:SetVisible(true)
					self:SetText(context.bookmarked and
						"<image CommonAssets/UI/Editor/fav_star 450 220 165 18>" or
						"<image CommonAssets/UI/Editor/fav_star 450 128 128 128>")
				end
				self:SetTextStyle(context.font)
				self.idLabel:SetPadding(box(0, 2, 0, 2))
			end,
			'OnPress', function (self, gamepad)
				local item = (GetParentOfKind(self, "XVirtualContent") or GetParentOfKind(self, "XListItem")).item
				item.bookmarked = not item.bookmarked
				self:SetText(item.bookmarked and
					"<image CommonAssets/UI/Editor/fav_star 450 220 165 18>" or
					"<image CommonAssets/UI/Editor/fav_star 450 128 128 128>"
				)
				
				local editor = GetParentOfKind(self, "GedPropListPicker")
				editor.panel:Op("GedInvokeMethod",
					editor.panel.context,
					editor.prop_meta.bookmark_fn,
					item.id,
					item.bookmarked
				)
			end,
			'UseXTextControl', true,
		}),
		}),
})