1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
--[[
Hooking API (holding off on generalization until we see everything that needs to use it...
--]]
-- Install a handler that will be called before the original function and whose return value will decide if the original even needs to be called.
-- If the hook returns true it means that the hook handled the call entirely, and the original doesn't need calling.
-- ZO_PreHook can be called with or without an objectTable; if the argument is a string (the function name), it just uses _G
existingFunctionName = objectTable
objectTable = _G
end
end
end
end
end
existingFunctionName = objectTable
objectTable = _G
end
end
end
end
end
end
else
end
end
end
else
end
end
--where ... are the handler args after self
-- ZO_PropagateHandler(self:GetParent(), "OnMouseUp", button, upInside)
if propagateTo then
-- TODO: Determine whether handlers of any namespace should be called;
-- new Control methods - GetNumHandlers and GetHandlerByIndex - would be required to do so.
return true
end
end
return false
end
-- Propagates a call to the specified handler name from a control to each ancestor control
-- that defines a corresponding handler function until and excluding the owning window.
-- ZO_PropagateHandlerToAllAncestors("OnMouseUp", ...)
-- No semaphore mechanism is currently required to suppress reentrant calls when
-- ancestor controls also inherit ZO_PropagateMouseOverBehaviorToAllAncestors
-- because, at present, ZO_PropagateHandler only propagates events to handlers
-- that have no namespace. A gating mechanism would be required should this
-- paradigm ever change.
while ancestorControl and ancestorControl ~= owningWindow do
end
end
-- Propagates a call to the specified handler name from a control to the nearest ancestor control
-- that defines a corresponding handler function until and excluding the owning window.
-- ZO_PropagateHandlerToNearestAncestor("OnMouseUp", ...)
while ancestorControl and ancestorControl ~= owningWindow and not ZO_PropagateHandler ( ancestorControl , handlerName , ... ) do
end
end
-- For when you want to propagate to the control's parent without breaking self out of the args
-- ZO_PropagateHandlerToParent("OnMouseUp", ...)
end
-- For when you want to propagate without breaking self out of the args
-- ZO_PropagateHandlerFromControl(self:GetParent():GetParent(), "OnMouseUp", ...)
end |