annotate 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
rev   line source
Asa@0 1 local AceGUI = LibStub("AceGUI-3.0")
Asa@0 2
Asa@0 3 -- WoW APIs
Asa@0 4 local CreateFrame, UIParent = CreateFrame, UIParent
Asa@0 5
Asa@0 6 -------------
Asa@0 7 -- Widgets --
Asa@0 8 -------------
Asa@0 9 --[[
Asa@0 10 Widgets must provide the following functions
Asa@0 11 Acquire() - Called when the object is aquired, should set everything to a default hidden state
Asa@0 12 Release() - Called when the object is Released, should remove any anchors and hide the Widget
Asa@0 13
Asa@0 14 And the following members
Asa@0 15 frame - the frame or derivitive object that will be treated as the widget for size and anchoring purposes
Asa@0 16 type - the type of the object, same as the name given to :RegisterWidget()
Asa@0 17
Asa@0 18 Widgets contain a table called userdata, this is a safe place to store data associated with the wigdet
Asa@0 19 It will be cleared automatically when a widget is released
Asa@0 20 Placing values directly into a widget object should be avoided
Asa@0 21
Asa@0 22 If the Widget can act as a container for other Widgets the following
Asa@0 23 content - frame or derivitive that children will be anchored to
Asa@0 24
Asa@0 25 The Widget can supply the following Optional Members
Asa@0 26
Asa@0 27
Asa@0 28 ]]
Asa@0 29
Asa@0 30 --------------------------
Asa@0 31 -- Simple Group --
Asa@0 32 --------------------------
Asa@0 33 --[[
Asa@0 34 This is a simple grouping container, no selection, no borders
Asa@0 35 It will resize automatically to the height of the controls added to it
Asa@0 36 ]]
Asa@0 37
Asa@0 38 do
Asa@0 39 local Type = "SimpleGroup"
Asa@0 40 local Version = 5
Asa@0 41
Asa@0 42 local function OnAcquire(self)
Asa@0 43 self:SetWidth(300)
Asa@0 44 self:SetHeight(100)
Asa@0 45 end
Asa@0 46
Asa@0 47 local function OnRelease(self)
Asa@0 48 self.frame:ClearAllPoints()
Asa@0 49 self.frame:Hide()
Asa@0 50 end
Asa@0 51
Asa@0 52 local function LayoutFinished(self, width, height)
Asa@0 53 if self.noAutoHeight then return end
Asa@0 54 self:SetHeight(height or 0)
Asa@0 55 end
Asa@0 56
Asa@0 57 local function OnWidthSet(self, width)
Asa@0 58 local content = self.content
Asa@0 59 content:SetWidth(width)
Asa@0 60 content.width = width
Asa@0 61 end
Asa@0 62
Asa@0 63 local function OnHeightSet(self, height)
Asa@0 64 local content = self.content
Asa@0 65 content:SetHeight(height)
Asa@0 66 content.height = height
Asa@0 67 end
Asa@0 68
Asa@0 69 local function Constructor()
Asa@0 70 local frame = CreateFrame("Frame",nil,UIParent)
Asa@0 71 local self = {}
Asa@0 72 self.type = Type
Asa@0 73
Asa@0 74 self.OnRelease = OnRelease
Asa@0 75 self.OnAcquire = OnAcquire
Asa@0 76 self.frame = frame
Asa@0 77 self.LayoutFinished = LayoutFinished
Asa@0 78 self.OnWidthSet = OnWidthSet
Asa@0 79 self.OnHeightSet = OnHeightSet
Asa@0 80
Asa@0 81 frame.obj = self
Asa@0 82
Asa@0 83 frame:SetHeight(100)
Asa@0 84 frame:SetWidth(100)
Asa@0 85 frame:SetFrameStrata("FULLSCREEN_DIALOG")
Asa@0 86
Asa@0 87 --Container Support
Asa@0 88 local content = CreateFrame("Frame",nil,frame)
Asa@0 89 self.content = content
Asa@0 90 content.obj = self
Asa@0 91 content:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0)
Asa@0 92 content:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,0)
Asa@0 93
Asa@0 94 AceGUI:RegisterAsContainer(self)
Asa@0 95 return self
Asa@0 96 end
Asa@0 97
Asa@0 98 AceGUI:RegisterWidgetType(Type,Constructor,Version)
Asa@0 99 end