29d93c0 - change raid frame position as mage
[wowui.git] / OmaTMW / TirnaHelper.lua
index dc5192f..77bffbb 100644 (file)
@@ -3,6 +3,7 @@ local _;
 local frame = CreateFrame("Frame", "OmaTirna", UIParent);
 
 local function init()
+    local frames = {};
     frame:UnregisterAllEvents();
     frame:SetPoint("TOP", UIParent, "TOP", -300, -250);
     frame:SetWidth(1);
@@ -11,18 +12,69 @@ local function init()
         for j = 0,3 do
             local button = CreateFrame("CheckButton", "OmaTirna"..i..j, frame);
             button:SetPoint("TOPLEFT", frame, "TOPLEFT", i*52, j*42);
-            button:SetWidth(50);
-            button:SetHeight(40);
-            button.normal = button:CreateTexture(nil, "BACKGROUND");
-            button.normal:SetAllPoints();
-            button.normal:SetColorTexture(0.4, 0.4, 0.4);
+            button:SetWidth(52);
+            button:SetHeight(42);
+            button.bg = button:CreateTexture(nil, "BACKGROUND");
+            button.bg:SetAllPoints();
+            button.bg:SetColorTexture(1, 1, 1);
+            button.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3);
+            button.normal = button:CreateTexture(nil, "BORDER");
+            button.normal:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2);
+            button.normal:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2);
+            button.normal:SetColorTexture(0.5, 0.5, 0.5);
             button:SetNormalTexture(button.normal);
-            button.check = button:CreateTexture(nil, "BACKGROUND");
-            button.check:SetAllPoints();
+            button.check = button:CreateTexture(nil, "BORDER");
+            button.check:SetPoint("TOPLEFT", button, "TOPLEFT", 2, -2);
+            button.check:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -2, 2);
             button.check:SetColorTexture(0.9, 0.9, 0.9);
             button:SetCheckedTexture(button.check);
+            button:SetScript("OnClick", function(self)
+                for i = 0,2 do
+                    local x = 0;
+                    local check, notcheck;
+                    for j = 0,3 do
+                        local f = frames[i*4+j+1];
+                        f.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3);
+                        if f:GetChecked() then
+                            x = x + 1;
+                            check = f;
+                        else
+                            notcheck = f;
+                        end
+                    end
+                    if x == 1 then
+                        check.bg:SetVertexColor(1, 0.2, 0.1, 0.9);
+                    elseif x == 3 then
+                        notcheck.bg:SetVertexColor(1, 0.2, 0.1, 0.9);
+                    end
+                end
+            end);
+            frames[i*4+j+1] = button;
         end
     end
+    local button = CreateFrame("Button", "OmaTirnaReset", frame);
+    button:SetPoint("TOPRIGHT", frame, "TOPLEFT", -2, 0);
+    button:SetWidth(52);
+    button:SetHeight(42);
+    button.normal = button:CreateTexture(nil, "BACKGROUND");
+    button.normal:SetAllPoints();
+    button.normal:SetColorTexture(0.4, 0.4, 0.4);
+    button:SetNormalTexture(button.normal);
+    button:SetScript("OnClick", function()
+        for _, f in ipairs(frames) do
+            f:SetChecked(false);
+            f.bg:SetVertexColor(0.2, 0.2, 0.2, 0.3);
+        end
+    end);
+    frame.leaf = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
+    frame.leaf:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 0, 42*3);
+    frame.leaf:SetText("Lehti");
+    frame.fill = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
+    frame.fill:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 52, 42*3);
+    frame.fill:SetText("Täysi");
+    frame.circle = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
+    frame.circle:SetPoint("BOTTOMLEFT", frame, "TOPLEFT", 104, 42*3);
+    frame.circle:SetText("Kehä");
     frame:Hide();
 end