annotate Libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua @ 8:1b2d819b4fa8

Now using the global MailAddonBusy to indicate MailOpener is busy, read comments in Core.lua for more info. Default status is now ?enabled without automatic mail opening? to let first time users look around before MailOpener messes up their heads. A StaticPopupDialog will be added later to ask if they want to auto-enable. When ?enabled without automatic mail opening? is on and you toggle the mail opening checkbox on, mail opening will automatically start.
author Zerotorescue
date Thu, 09 Sep 2010 10:53:19 +0200
parents 823e33465b6e
children
rev   line source
Zerotorescue@0 1 --[[-----------------------------------------------------------------------------
Zerotorescue@0 2 InlineGroup Container
Zerotorescue@0 3 Simple container widget that creates a visible "box" with an optional title.
Zerotorescue@0 4 -------------------------------------------------------------------------------]]
Zerotorescue@0 5 local Type, Version = "InlineGroup", 20
Zerotorescue@0 6 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
Zerotorescue@0 7 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
Zerotorescue@0 8
Zerotorescue@0 9 -- Lua APIs
Zerotorescue@0 10 local pairs = pairs
Zerotorescue@0 11
Zerotorescue@0 12 -- WoW APIs
Zerotorescue@0 13 local CreateFrame, UIParent = CreateFrame, UIParent
Zerotorescue@0 14
Zerotorescue@0 15 --[[-----------------------------------------------------------------------------
Zerotorescue@0 16 Methods
Zerotorescue@0 17 -------------------------------------------------------------------------------]]
Zerotorescue@0 18 local methods = {
Zerotorescue@0 19 ["OnAcquire"] = function(self)
Zerotorescue@0 20 self:SetWidth(300)
Zerotorescue@0 21 self:SetHeight(100)
Zerotorescue@0 22 end,
Zerotorescue@0 23
Zerotorescue@0 24 -- ["OnRelease"] = nil,
Zerotorescue@0 25
Zerotorescue@0 26 ["SetTitle"] = function(self,title)
Zerotorescue@0 27 self.titletext:SetText(title)
Zerotorescue@0 28 end,
Zerotorescue@0 29
Zerotorescue@0 30
Zerotorescue@0 31 ["LayoutFinished"] = function(self, width, height)
Zerotorescue@0 32 if self.noAutoHeight then return end
Zerotorescue@0 33 self:SetHeight((height or 0) + 40)
Zerotorescue@0 34 end,
Zerotorescue@0 35
Zerotorescue@0 36 ["OnWidthSet"] = function(self, width)
Zerotorescue@0 37 local content = self.content
Zerotorescue@0 38 local contentwidth = width - 20
Zerotorescue@0 39 if contentwidth < 0 then
Zerotorescue@0 40 contentwidth = 0
Zerotorescue@0 41 end
Zerotorescue@0 42 content:SetWidth(contentwidth)
Zerotorescue@0 43 content.width = contentwidth
Zerotorescue@0 44 end,
Zerotorescue@0 45
Zerotorescue@0 46 ["OnHeightSet"] = function(self, height)
Zerotorescue@0 47 local content = self.content
Zerotorescue@0 48 local contentheight = height - 20
Zerotorescue@0 49 if contentheight < 0 then
Zerotorescue@0 50 contentheight = 0
Zerotorescue@0 51 end
Zerotorescue@0 52 content:SetHeight(contentheight)
Zerotorescue@0 53 content.height = contentheight
Zerotorescue@0 54 end
Zerotorescue@0 55 }
Zerotorescue@0 56
Zerotorescue@0 57 --[[-----------------------------------------------------------------------------
Zerotorescue@0 58 Constructor
Zerotorescue@0 59 -------------------------------------------------------------------------------]]
Zerotorescue@0 60 local PaneBackdrop = {
Zerotorescue@0 61 bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
Zerotorescue@0 62 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
Zerotorescue@0 63 tile = true, tileSize = 16, edgeSize = 16,
Zerotorescue@0 64 insets = { left = 3, right = 3, top = 5, bottom = 3 }
Zerotorescue@0 65 }
Zerotorescue@0 66
Zerotorescue@0 67 local function Constructor()
Zerotorescue@0 68 local frame = CreateFrame("Frame", nil, UIParent)
Zerotorescue@0 69 frame:SetFrameStrata("FULLSCREEN_DIALOG")
Zerotorescue@0 70
Zerotorescue@0 71 local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
Zerotorescue@0 72 titletext:SetPoint("TOPLEFT", 14, 0)
Zerotorescue@0 73 titletext:SetPoint("TOPRIGHT", -14, 0)
Zerotorescue@0 74 titletext:SetJustifyH("LEFT")
Zerotorescue@0 75 titletext:SetHeight(18)
Zerotorescue@0 76
Zerotorescue@0 77 local border = CreateFrame("Frame", nil, frame)
Zerotorescue@0 78 border:SetPoint("TOPLEFT", 0, -17)
Zerotorescue@0 79 border:SetPoint("BOTTOMRIGHT", -1, 3)
Zerotorescue@0 80 border:SetBackdrop(PaneBackdrop)
Zerotorescue@0 81 border:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
Zerotorescue@0 82 border:SetBackdropBorderColor(0.4, 0.4, 0.4)
Zerotorescue@0 83
Zerotorescue@0 84 --Container Support
Zerotorescue@0 85 local content = CreateFrame("Frame", nil, border)
Zerotorescue@0 86 content:SetPoint("TOPLEFT", 10, -10)
Zerotorescue@0 87 content:SetPoint("BOTTOMRIGHT", -10, 10)
Zerotorescue@0 88
Zerotorescue@0 89 local widget = {
Zerotorescue@0 90 frame = frame,
Zerotorescue@0 91 content = content,
Zerotorescue@0 92 titletext = titletext,
Zerotorescue@0 93 type = Type
Zerotorescue@0 94 }
Zerotorescue@0 95 for method, func in pairs(methods) do
Zerotorescue@0 96 widget[method] = func
Zerotorescue@0 97 end
Zerotorescue@0 98
Zerotorescue@0 99 return AceGUI:RegisterAsContainer(widget)
Zerotorescue@0 100 end
Zerotorescue@0 101
Zerotorescue@0 102 AceGUI:RegisterWidgetType(Type, Constructor, Version)