diff State.lua @ 71:3d2cef5dc459

Implemented state anchoring and scaling
author Flick <flickerstreak@gmail.com>
date Wed, 04 Jun 2008 21:46:51 +0000
parents 2c12e2b1752e
children aa88aed52124
line wrap: on
line diff
--- a/State.lua	Tue Jun 03 23:24:03 2008 +0000
+++ b/State.lua	Wed Jun 04 21:46:51 2008 +0000
@@ -236,33 +236,34 @@
     bar:SetStateKeybindOverrideMap(map)
   end
 
-  function propertyFuncs.enableanchor( bar, states )
-
+  local function updateAnchor(bar, states)
+    local map = { }
+    for state, c in pairs(states) do
+      if c.enableAnchor then
+        map[state] = { point = c.anchorPoint, relpoint = c.anchorRelPoint, x = c.anchorX, y = c.anchorY }
+      end
+    end
+    bar:SetStateAnchorMap(map)
   end
 
-  function propertyFuncs.anchorPoint( bar, states )
+  propertyFuncs.enableAnchor   = updateAnchor
+  propertyFuncs.anchorPoint    = updateAnchor
+  propertyFuncs.anchorRelPoint = updateAnchor
+  propertyFuncs.anchorX        = updateAnchor
+  propertyFuncs.anchorY        = updateAnchor
 
+  local function updateScale( bar, states )
+    local map = { }
+    for state, c in pairs(states) do
+      if c.enablescale then
+        map[state] = c.scale
+      end
+    end
+    bar:SetStateScaleMap(map)
   end
 
-  function propertyFuncs.anchorRelPoint( bar, states )
-
-  end
-
-  function propertyFuncs.anchorX( bar, states )
-
-  end
-
-  function propertyFuncs.anchorY( bar, states )
-
-  end
-
-  function propertyFuncs.enablescale( bar, states )
-
-  end
-
-  function propertyFuncs.scale( bar, states )
-
-  end
+  propertyFuncs.enablescale = updateScale
+  propertyFuncs.scale       = updateScale
 
 end
 
@@ -466,7 +467,7 @@
     end
 
     local function anchordisable()
-      return not GetProperty(bar, opts.name, "enableanchor")
+      return not GetProperty(bar, opts.name, "enableAnchor")
     end
 
     tbuild(states, name)
@@ -616,7 +617,7 @@
             type  = "group",
             inline = true,
             args = {
-              enableanchor = {
+              enableAnchor = {
                 name  = L["Set New Position"],
                 order = 1,
                 type  = "toggle",