This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

now the button actually looks pressed, yay

  • Loading branch information...
Tuller committed Mar 25, 2013
1 parent 5b83ea9 commit 1443ef7188f282220133bd568233a3abe8f497e8
Showing with 15 additions and 6 deletions.
  1. +15 −6 main.lua
View
@@ -58,7 +58,7 @@ function Addon:GetFrameController()
]])
frameController:SetAttribute('LoadBindings', [[
- print('LoadBindings', ...)
+ -- print('LoadBindings', ...)
self:ClearBindings()
@@ -68,7 +68,7 @@ function Addon:GetFrameController()
]])
frameController:SetAttribute('SetFrameBindings', [[
- print('SetFrameBindings', ...)
+ -- print('SetFrameBindings', ...)
local frameID = (...)
for i = 2, select('#', ...) do
@@ -102,8 +102,21 @@ function Addon:CreateVirtualButton(target)
button:RegisterForClicks('anyDown')
button:SetAttribute('type', 'click')
+
button:SetAttribute('clickbutton', target)
+ button.SetParentButtonPushed = function(self, isPushed)
+ target:SetButtonState(isPushed and 'PUSHED' or 'NORMAL')
+ end
+
+ button:SetScript('OnMouseUp', function(self)
+ self:SetParentButtonPushed(false)
+ end)
+
+ button:SetScript('OnMouseDown', function(self)
+ self:SetParentButtonPushed(true)
+ end)
+
self:RegisterVirtualButton(button, target)
return button
@@ -115,12 +128,8 @@ function Addon:RegisterVirtualButton(vButton, target)
controller:SetFrameRef('frameToAdd', vButton)
controller:SetFrameRef('targetToAdd', target)
controller:Execute([[ self:RunAttribute('AddFrame') ]])
-
- return self
end
function Addon:LoadBindings()
self:GetFrameController():Execute([[ self:RunAttribute('LoadBindings') ]])
-
- return self
end

0 comments on commit 1443ef7

Please sign in to comment.