Mercurial > wow > itemauditor
comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-SimpleGroup.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 -- Simple Group -- | |
| 32 -------------------------- | |
| 33 --[[ | |
| 34 This is a simple grouping container, no selection, no borders | |
| 35 It will resize automatically to the height of the controls added to it | |
| 36 ]] | |
| 37 | |
| 38 do | |
| 39 local Type = "SimpleGroup" | |
| 40 local Version = 5 | |
| 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 function LayoutFinished(self, width, height) | |
| 53 if self.noAutoHeight then return end | |
| 54 self:SetHeight(height or 0) | |
| 55 end | |
| 56 | |
| 57 local function OnWidthSet(self, width) | |
| 58 local content = self.content | |
| 59 content:SetWidth(width) | |
| 60 content.width = width | |
| 61 end | |
| 62 | |
| 63 local function OnHeightSet(self, height) | |
| 64 local content = self.content | |
| 65 content:SetHeight(height) | |
| 66 content.height = height | |
| 67 end | |
| 68 | |
| 69 local function Constructor() | |
| 70 local frame = CreateFrame("Frame",nil,UIParent) | |
| 71 local self = {} | |
| 72 self.type = Type | |
| 73 | |
| 74 self.OnRelease = OnRelease | |
| 75 self.OnAcquire = OnAcquire | |
| 76 self.frame = frame | |
| 77 self.LayoutFinished = LayoutFinished | |
| 78 self.OnWidthSet = OnWidthSet | |
| 79 self.OnHeightSet = OnHeightSet | |
| 80 | |
| 81 frame.obj = self | |
| 82 | |
| 83 frame:SetHeight(100) | |
| 84 frame:SetWidth(100) | |
| 85 frame:SetFrameStrata("FULLSCREEN_DIALOG") | |
| 86 | |
| 87 --Container Support | |
| 88 local content = CreateFrame("Frame",nil,frame) | |
| 89 self.content = content | |
| 90 content.obj = self | |
| 91 content:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) | |
| 92 content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0) | |
| 93 | |
| 94 AceGUI:RegisterAsContainer(self) | |
| 95 return self | |
| 96 end | |
| 97 | |
| 98 AceGUI:RegisterWidgetType(Type,Constructor,Version) | |
| 99 end |
