Mercurial > wow > askmrrobot
comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua @ 106:e635cd648e01 v49
7.2 update
author | yellowfive |
---|---|
date | Tue, 28 Mar 2017 16:10:00 -0700 |
parents | 01b63b8ed811 |
children |
comparison
equal
deleted
inserted
replaced
105:3ce266c86bd3 | 106:e635cd648e01 |
---|---|
1 --[[----------------------------------------------------------------------------- | 1 --[[----------------------------------------------------------------------------- |
2 Label Widget | 2 Label Widget |
3 Displays text and optionally an icon. | 3 Displays text and optionally an icon. |
4 -------------------------------------------------------------------------------]] | 4 -------------------------------------------------------------------------------]] |
5 local Type, Version = "Label", 23 | 5 local Type, Version = "Label", 24 |
6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) | 6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end | 7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
8 | 8 |
9 -- Lua APIs | 9 -- Lua APIs |
10 local max, select, pairs = math.max, select, pairs | 10 local max, select, pairs = math.max, select, pairs |
76 self:SetText() | 76 self:SetText() |
77 self:SetImage(nil) | 77 self:SetImage(nil) |
78 self:SetImageSize(16, 16) | 78 self:SetImageSize(16, 16) |
79 self:SetColor() | 79 self:SetColor() |
80 self:SetFontObject() | 80 self:SetFontObject() |
81 self:SetJustifyH("LEFT") | |
82 self:SetJustifyV("TOP") | |
81 | 83 |
82 -- reset the flag | 84 -- reset the flag |
83 self.resizing = nil | 85 self.resizing = nil |
84 -- run the update explicitly | 86 -- run the update explicitly |
85 UpdateImageAnchor(self) | 87 UpdateImageAnchor(self) |
132 ["SetImageSize"] = function(self, width, height) | 134 ["SetImageSize"] = function(self, width, height) |
133 self.image:SetWidth(width) | 135 self.image:SetWidth(width) |
134 self.image:SetHeight(height) | 136 self.image:SetHeight(height) |
135 UpdateImageAnchor(self) | 137 UpdateImageAnchor(self) |
136 end, | 138 end, |
139 | |
140 ["SetJustifyH"] = function(self, justifyH) | |
141 self.label:SetJustifyH(justifyH) | |
142 end, | |
143 | |
144 ["SetJustifyV"] = function(self, justifyV) | |
145 self.label:SetJustifyV(justifyV) | |
146 end, | |
137 } | 147 } |
138 | 148 |
139 --[[----------------------------------------------------------------------------- | 149 --[[----------------------------------------------------------------------------- |
140 Constructor | 150 Constructor |
141 -------------------------------------------------------------------------------]] | 151 -------------------------------------------------------------------------------]] |
142 local function Constructor() | 152 local function Constructor() |
143 local frame = CreateFrame("Frame", nil, UIParent) | 153 local frame = CreateFrame("Frame", nil, UIParent) |
144 frame:Hide() | 154 frame:Hide() |
145 | 155 |
146 local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") | 156 local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") |
147 label:SetJustifyH("LEFT") | |
148 label:SetJustifyV("TOP") | |
149 | |
150 local image = frame:CreateTexture(nil, "BACKGROUND") | 157 local image = frame:CreateTexture(nil, "BACKGROUND") |
151 | 158 |
152 -- create widget | 159 -- create widget |
153 local widget = { | 160 local widget = { |
154 label = label, | 161 label = label, |