Mercurial > wow > itemauditor
comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-InlineGroup.lua @ 0:169f5211fc7f
First public revision.
At this point ItemAuditor watches mail for auctions sold or purchased, watches for buy/sell (money and 1 item type change) and conversions/tradeskills. Milling isn't working yet because there is too much time between the first event and the last event.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Thu, 20 May 2010 19:22:19 -0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:169f5211fc7f |
|---|---|
| 1 local AceGUI = LibStub("AceGUI-3.0") | |
| 2 | |
| 3 -- WoW APIs | |
| 4 local CreateFrame, UIParent = CreateFrame, UIParent | |
| 5 | |
| 6 ------------- | |
| 7 -- Widgets -- | |
| 8 ------------- | |
| 9 --[[ | |
| 10 Widgets must provide the following functions | |
| 11 Acquire() - Called when the object is aquired, should set everything to a default hidden state | |
| 12 Release() - Called when the object is Released, should remove any anchors and hide the Widget | |
| 13 | |
| 14 And the following members | |
| 15 frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes | |
| 16 type - the type of the object, same as the name given to :RegisterWidget() | |
| 17 | |
| 18 Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet | |
| 19 It will be cleared automatically when a widget is released | |
| 20 Placing values directly into a widget object should be avoided | |
| 21 | |
| 22 If the Widget can act as a container for other Widgets the following | |
| 23 content - frame or derivitive that children will be anchored to | |
| 24 | |
| 25 The Widget can supply the following Optional Members | |
| 26 | |
| 27 | |
| 28 ]] | |
| 29 | |
| 30 -------------------------- | |
| 31 -- Inline Group -- | |
| 32 -------------------------- | |
| 33 --[[ | |
| 34 This is a simple grouping container, no selection | |
| 35 It will resize automatically to the height of the controls added to it | |
| 36 ]] | |
| 37 | |
| 38 do | |
| 39 local Type = "InlineGroup" | |
| 40 local Version = 6 | |
| 41 | |
| 42 local function OnAcquire(self) | |
| 43 self:SetWidth(300) | |
| 44 self:SetHeight(100) | |
| 45 end | |
| 46 | |
| 47 local function OnRelease(self) | |
| 48 self.frame:ClearAllPoints() | |
| 49 self.frame:Hide() | |
| 50 end | |
| 51 | |
| 52 local PaneBackdrop = { | |
| 53 bgFile = "Interface\\ChatFrame\\ChatFrameBackground", | |
| 54 edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", | |
| 55 tile = true, tileSize = 16, edgeSize = 16, | |
| 56 insets = { left = 3, right = 3, top = 5, bottom = 3 } | |
| 57 } | |
| 58 | |
| 59 local function SetTitle(self,title) | |
| 60 self.titletext:SetText(title) | |
| 61 end | |
| 62 | |
| 63 | |
| 64 local function LayoutFinished(self, width, height) | |
| 65 if self.noAutoHeight then return end | |
| 66 self:SetHeight((height or 0) + 40) | |
| 67 end | |
| 68 | |
| 69 local function OnWidthSet(self, width) | |
| 70 local content = self.content | |
| 71 local contentwidth = width - 20 | |
| 72 if contentwidth < 0 then | |
| 73 contentwidth = 0 | |
| 74 end | |
| 75 content:SetWidth(contentwidth) | |
| 76 content.width = contentwidth | |
| 77 end | |
| 78 | |
| 79 | |
| 80 local function OnHeightSet(self, height) | |
| 81 local content = self.content | |
| 82 local contentheight = height - 20 | |
| 83 if contentheight < 0 then | |
| 84 contentheight = 0 | |
| 85 end | |
| 86 content:SetHeight(contentheight) | |
| 87 content.height = contentheight | |
| 88 end | |
| 89 | |
| 90 local function Constructor() | |
| 91 local frame = CreateFrame("Frame",nil,UIParent) | |
| 92 local self = {} | |
| 93 self.type = Type | |
| 94 | |
| 95 self.OnRelease = OnRelease | |
| 96 self.OnAcquire = OnAcquire | |
| 97 self.SetTitle = SetTitle | |
| 98 self.frame = frame | |
| 99 self.LayoutFinished = LayoutFinished | |
| 100 self.OnWidthSet = OnWidthSet | |
| 101 self.OnHeightSet = OnHeightSet | |
| 102 | |
| 103 frame.obj = self | |
| 104 | |
| 105 frame:SetHeight(100) | |
| 106 frame:SetWidth(100) | |
| 107 frame:SetFrameStrata("FULLSCREEN_DIALOG") | |
| 108 | |
| 109 local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal") | |
| 110 titletext:SetPoint("TOPLEFT",frame,"TOPLEFT",14,0) | |
| 111 titletext:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-14,0) | |
| 112 titletext:SetJustifyH("LEFT") | |
| 113 titletext:SetHeight(18) | |
| 114 | |
| 115 self.titletext = titletext | |
| 116 | |
| 117 local border = CreateFrame("Frame",nil,frame) | |
| 118 self.border = border | |
| 119 border:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-17) | |
| 120 border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-1,3) | |
| 121 | |
| 122 border:SetBackdrop(PaneBackdrop) | |
| 123 border:SetBackdropColor(0.1,0.1,0.1,0.5) | |
| 124 border:SetBackdropBorderColor(0.4,0.4,0.4) | |
| 125 | |
| 126 --Container Support | |
| 127 local content = CreateFrame("Frame",nil,border) | |
| 128 self.content = content | |
| 129 content.obj = self | |
| 130 content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-10) | |
| 131 content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,10) | |
| 132 | |
| 133 AceGUI:RegisterAsContainer(self) | |
| 134 return self | |
| 135 end | |
| 136 | |
| 137 AceGUI:RegisterWidgetType(Type,Constructor,Version) | |
| 138 end |
