annotate Libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua @ 6:f10c8a083d2a

The ALPHA help request popup should pop when the addon is enabled for every 15th time. I really would like some data to. The timer to start opening mail when you open the mailbox will now use the initial mail opening delay.
author Zerotorescue
date Wed, 08 Sep 2010 00:48:37 +0200
parents 823e33465b6e
children
rev   line source
Zerotorescue@0 1 --[[-----------------------------------------------------------------------------
Zerotorescue@0 2 Heading Widget
Zerotorescue@0 3 -------------------------------------------------------------------------------]]
Zerotorescue@0 4 local Type, Version = "Heading", 20
Zerotorescue@0 5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
Zerotorescue@0 6 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
Zerotorescue@0 7
Zerotorescue@0 8 -- Lua APIs
Zerotorescue@0 9 local pairs = pairs
Zerotorescue@0 10
Zerotorescue@0 11 -- WoW APIs
Zerotorescue@0 12 local CreateFrame, UIParent = CreateFrame, UIParent
Zerotorescue@0 13
Zerotorescue@0 14 --[[-----------------------------------------------------------------------------
Zerotorescue@0 15 Methods
Zerotorescue@0 16 -------------------------------------------------------------------------------]]
Zerotorescue@0 17 local methods = {
Zerotorescue@0 18 ["OnAcquire"] = function(self)
Zerotorescue@0 19 self:SetText()
Zerotorescue@0 20 self:SetFullWidth()
Zerotorescue@0 21 self:SetHeight(18)
Zerotorescue@0 22 end,
Zerotorescue@0 23
Zerotorescue@0 24 -- ["OnRelease"] = nil,
Zerotorescue@0 25
Zerotorescue@0 26 ["SetText"] = function(self, text)
Zerotorescue@0 27 self.label:SetText(text or "")
Zerotorescue@0 28 if text and text ~= "" then
Zerotorescue@0 29 self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0)
Zerotorescue@0 30 self.right:Show()
Zerotorescue@0 31 else
Zerotorescue@0 32 self.left:SetPoint("RIGHT", -3, 0)
Zerotorescue@0 33 self.right:Hide()
Zerotorescue@0 34 end
Zerotorescue@0 35 end
Zerotorescue@0 36 }
Zerotorescue@0 37
Zerotorescue@0 38 --[[-----------------------------------------------------------------------------
Zerotorescue@0 39 Constructor
Zerotorescue@0 40 -------------------------------------------------------------------------------]]
Zerotorescue@0 41 local function Constructor()
Zerotorescue@0 42 local frame = CreateFrame("Frame", nil, UIParent)
Zerotorescue@0 43 frame:Hide()
Zerotorescue@0 44
Zerotorescue@0 45 local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
Zerotorescue@0 46 label:SetPoint("TOP")
Zerotorescue@0 47 label:SetPoint("BOTTOM")
Zerotorescue@0 48 label:SetJustifyH("CENTER")
Zerotorescue@0 49
Zerotorescue@0 50 local left = frame:CreateTexture(nil, "BACKGROUND")
Zerotorescue@0 51 left:SetHeight(8)
Zerotorescue@0 52 left:SetPoint("LEFT", 3, 0)
Zerotorescue@0 53 left:SetPoint("RIGHT", label, "LEFT", -5, 0)
Zerotorescue@0 54 left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
Zerotorescue@0 55 left:SetTexCoord(0.81, 0.94, 0.5, 1)
Zerotorescue@0 56
Zerotorescue@0 57 local right = frame:CreateTexture(nil, "BACKGROUND")
Zerotorescue@0 58 right:SetHeight(8)
Zerotorescue@0 59 right:SetPoint("RIGHT", -3, 0)
Zerotorescue@0 60 right:SetPoint("LEFT", label, "RIGHT", 5, 0)
Zerotorescue@0 61 right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
Zerotorescue@0 62 right:SetTexCoord(0.81, 0.94, 0.5, 1)
Zerotorescue@0 63
Zerotorescue@0 64 local widget = {
Zerotorescue@0 65 label = label,
Zerotorescue@0 66 left = left,
Zerotorescue@0 67 right = right,
Zerotorescue@0 68 frame = frame,
Zerotorescue@0 69 type = Type
Zerotorescue@0 70 }
Zerotorescue@0 71 for method, func in pairs(methods) do
Zerotorescue@0 72 widget[method] = func
Zerotorescue@0 73 end
Zerotorescue@0 74
Zerotorescue@0 75 return AceGUI:RegisterAsWidget(widget)
Zerotorescue@0 76 end
Zerotorescue@0 77
Zerotorescue@0 78 AceGUI:RegisterWidgetType(Type, Constructor, Version)