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

PlaceObj('XTemplate', {
	group = "Common",
	id = "XComboListItem",
	save_in = "Common",
	PlaceObj('XTemplateWindow', {
		'__class', "XComboListItem",
		'Padding', box(0, 1, 0, 1),
		'OnContextUpdate', function (self, context, ...)
			if type(context) == "table" then
				self:SetFocusOrder(point(1, context.idx))
				self:SetFontProps(context.combo)
				self:SetTranslate(context.translate)
				self:SetMinHeight(MulDivRound(self:GetFontHeight(), 1000, self.scale:y()))
				self.OnPress = context.on_press
				self.AltPress = not not context.on_alt_press
				self.OnAltPress = context.on_alt_press
				
				self.idLabel.CalcTextColor = function(self)
					local r, g, b, a = GetRGBA(XTextButton.CalcTextColor(self))
					if self.context.dimmed then
						a = a * 50 / 100
					end
					return RGBA(r, g, b, a)
				end
				
				local function ItemText(item)
					if type(item) == "table" then
						return item.combo_text or item.name or item.text or item.id
					end
					return tostring(item)
				end
				
				local item = context.item
				self:SetText(ItemText(item))
				self:SetIcon(type(item) == "table" and item.Icon)
				if not self:GetIcon() or self:GetIcon() == "" then
					self:SetLayoutMethod("Box")
				end
				self.RolloverText = type(item) == "table" and item.help or nil
				self.idLabel:SetHAlign("stretch")
			end
			
			XComboListItem.OnContextUpdate(self, context)
		end,
	}),
	PlaceObj('XTemplateProperty', {
		'id', "_RolloverBackground",
		'editor', "color",
		'Set', function (self, value)
			self:SetRolloverBackground(value)
		end,
		'Get', function (self)
			return self:GetRolloverBackground()
		end,
	}),
	PlaceObj('XTemplateProperty', {
		'id', "_UseXTextControl",
		'Set', function (self, value)
			self:SetUseXTextControl(value)
		end,
		'Get', function (self)
			return self:GetUseXTextControl()
		end,
	}),
})