diff Main.lua @ 10:f93b554bb7cf

class implementation, Icon class for Raid Target Icons
author Jay Bird <a4blank@yahoo.com>
date Sun, 28 Nov 2010 18:59:31 +0300
parents 6e160ec1ef0f
children d2cbfe498c4d
line wrap: on
line diff
--- a/Main.lua	Mon Nov 22 08:40:26 2010 -0500
+++ b/Main.lua	Sun Nov 28 18:59:31 2010 +0300
@@ -6,6 +6,7 @@
 
 local LDB = LibStub("LibDataBroker-1.1", true)
 local LDBIcon = LibStub("LibDBIcon-1.0", true)
+local AceGUI = LibStub("AceGUI-3.0")
 
 local RTTIcon = LibStub("LibDataBroker-1.1"):NewDataObject("RTTIcon", {
     type = "data source",
@@ -32,7 +33,7 @@
 
     LDBIcon:Register("RTTIcon", RTTIcon, self.db.profile.minimap)
     self:InitFrame()
-    if self.f:IsShown() != self.db.profile.visible then
+    if self.f:IsShown() ~= self.db.profile.visible then
         if self.db.profile.visible then
             self:ShowFrame()
         else
@@ -43,9 +44,66 @@
 
 function RTT:InitFrame()
     self.f = CreateFrame("Frame", nil, UIParent)
-    self.f:SetWidth(100)
+    self.f:SetWidth(300)
     self.f:SetHeight(200)
+    self.f:SetAlpha(0.8)
     self.f:SetPoint("LEFT", UIParent, "LEFT", 10, 0)
+    --[[self.f:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
+                        edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
+                        tile = true, tileSize = 16, edgeSize = 16,
+                        insets = { left = 4, right = 4, top = 4, bottom = 4 }})
+    ]]
+    local backdrop = {
+      -- path to the background texture
+      bgFile = "Interface\\FrameGeneral\\UI-Background-Marble",
+      -- path to the border texture
+      edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Gold-Border",
+      -- true to repeat the background texture to fill the frame, false to scale it
+      tile = true,
+      -- size (width or height) of the square repeating background tiles (in pixels)
+      tileSize = 256,
+      -- thickness of edge segments and square size of edge corners (in pixels)
+      edgeSize = 32,
+      -- distance from the edges of the frame to those of the background texture (in pixels)
+      insets = {
+        left = 11,
+        right = 12,
+        top = 12,
+        bottom = 11
+      }
+    }
+    self.f:SetBackdrop(backdrop)
+    self.f:SetFrameStrata("HIGH")
+    --self.f:SetBackdropColor(0, 0, 0, 0.5)
+
+    self.fields = {}
+    self.selects = {}
+    for num, icon in ipairs(RaidIcons) do
+        icon:draw(self.f, 20, num * -20)
+
+        local field = CreateFrame("EditBox", "__RTT_EditBox_" .. tostring(num), self.f, "InputBoxTemplate")
+        field:SetAutoFocus(false)
+        field:SetFontObject(ChatFontNormal)
+        field:SetWidth(100)
+        field:SetHeight(16)
+        field:SetTextInsets(0, 0, 3, 3)
+        field:SetPoint("TOPLEFT", 40, num * -20)
+        table.insert(self.fields, field)
+        field:Show()
+
+        local userSelect = AceGUI:Create("Dropdown")
+        userSelect.frame:SetParent(self.f)
+        local raid = {}
+        for i=1, GetNumRaidMembers() do
+            raid[i] = UnitName("raid" .. i)
+        end
+        userSelect:SetList(raid)
+        userSelect:SetWidth(100)
+        userSelect:SetHeight(16)
+        userSelect:SetPoint("TOPLEFT", 160, num * -20)
+        table.insert(self.selects, userSelect)
+        userSelect.frame:Show()
+    end
 end
 
 function RTT:OnIconClick()
@@ -54,7 +112,7 @@
     else
         self:ShowFrame()
     end
-    self.db.profile.visible = !self.db.profile.visible
+    self.db.profile.visible = not self.db.profile.visible
 end
 
 function RTT:HideFrame()