fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

Bkacjios* Added CheckPanel * Renamed Checkbox to CheckBox * Created RadioBox as a subclass of CheckBox * Draw panel background in PrePaint to free up Paint for the super class7d480fc

main
576 B30 linesraw
1local PANEL = class.create("CheckBox", "Button")
2
3PANEL:ACCESSOR("Toggled", "m_bToggled", false)
4
5function PANEL:CheckBox()
6	-- Initialize our baseclass
7	self:super()
8	self:TextMargin(28, 0, 0, 0)
9	self:SetTextAlignmentX("left")
10end
11
12function PANEL:SetToggled(b, force)
13	if self.m_bToggled ~= b or force then
14		self.m_bToggled = b
15		self:OnToggle(b)
16	end
17end
18
19function PANEL:Paint(w, h)
20	gui.skinHook("Paint", "CheckBox", self, w, h)
21	self:PaintLabel(w, h)
22end
23
24function PANEL:OnClick()
25	self:SetToggled(not self:GetToggled())
26end
27
28function PANEL:OnToggle(on)
29	-- Override
30end