comparison AceGUIWidget-Spacer.lua @ 1:822b6ca3ef89

Import of 2.15, moving to wowace svn.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sat, 16 Apr 2011 06:03:29 +0000
parents
children
comparison
equal deleted inserted replaced
0:0f14a1e5364d 1:822b6ca3ef89
1 --[[-----------------------------------------------------------------------------
2 Spacer Widget
3
4 Spacer API
5
6 :SetImage(path,...)
7 same as Label:SetImage
8
9 :SetImageSize(w,h)
10 same as Label:SetImageSize
11
12 Because the whole point is to take up space, the most-used functions will
13 probably be the sizing routines from the base widget API.
14
15 -farmbuyer
16 -------------------------------------------------------------------------------]]
17 local Type, Version = "Spacer", 2
18 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
19 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
20
21 -- Lua APIs
22
23 -- WoW APIs
24 local CreateFrame = CreateFrame
25
26
27 --[[-----------------------------------------------------------------------------
28 Support functions
29 -------------------------------------------------------------------------------]]
30
31
32 --[[-----------------------------------------------------------------------------
33 Scripts
34 -------------------------------------------------------------------------------]]
35
36
37 --[[-----------------------------------------------------------------------------
38 Methods
39 -------------------------------------------------------------------------------]]
40 local methods = {
41 ["OnAcquire"] = function (self)
42 self:SetHeight(110)
43 self:SetWidth(110)
44 self:SetImage(nil)
45 self.frame:EnableMouse(true) -- needed?
46 end,
47
48 --["OnRelease"] = function (self) end,
49
50 ["SetImage"] = function (self, path, ...)
51 local space = self.space
52
53 space:SetTexture (path or "Interface\\GLUES\\COMMON\\Glue-Tooltip-Background")
54 local n = select('#', ...)
55 if n == 4 or n == 8 then
56 space:SetTexCoord(...)
57 end
58 end,
59
60 ["SetImageSize"] = function (self, width, height)
61 self.frame:SetWidth(width)
62 self.frame:SetHeight(height)
63 end,
64 }
65
66
67 --[[-----------------------------------------------------------------------------
68 Constructor
69 -------------------------------------------------------------------------------]]
70 local function Constructor()
71 local frame = CreateFrame("Frame",nil,UIParent)
72
73 local space = frame:CreateTexture(nil,"BACKGROUND")
74 space:SetAllPoints(frame)
75 space:SetTexture("Interface\\GLUES\\COMMON\\Glue-Tooltip-Background")
76 space:SetBlendMode("ADD")
77
78 local widget = {
79 space = space,
80 frame = frame,
81 type = Type
82 }
83 for method, func in pairs(methods) do
84 widget[method] = func
85 end
86
87 return AceGUI:RegisterAsWidget(widget)
88 end
89
90 AceGUI:RegisterWidgetType(Type,Constructor,Version)
91