WoWInterface - View Single Post - HOWTO: Integrate your addon with Clique (under Cataclysm/4.x)
View Single Post
10-15-10, 02:02 AM   #8
Cladhaire's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jul 2005
Posts: 1,935
Originally Posted by Bobtehbuildr View Post
OK, I got it mostly working. Here's what I have done.

My Party Frame had to inherit from both SecurePartyHeaderTemplate and SecureHandlerBaseTemplate.
This is actually the only tricky bit. You can't do this, because they both have OnLoad scripts, and only one of them will run. Inherit from SecurePartyHeaderTemplate, and then run the following code after you've created the header:


That adds the methods that we get from SecureHandlerBaseTempate without conflicting!

Now I could do the Frame:SetFrameRef("clickcast_header", ClickCastHeader)";

I updated the initialConfigFunction as an attribute and used the following snippet for the value.

local header = self:GetParent():GetFrameRef("clickcast_header")
-- do not add this conditional in without testing, it will allow for incorrect
-- integration, so you should verify it works before adding this check.
if header then
header:SetAttribute("clickcast_button", self)

My template for my unit button also needed to inherit from both SecureUnitButtonTemplate and SecureHandlerEnterLeaveTemplate.

I added the following attributes to the template also.

<Attribute name="_onenter" type="string" value="local snippet = self:GetAttribute('clickcast_onenter'); if snippet then self:Run(snippet) end"/>
<Attribute name="_onleave" type="string" value="local snippet = self:GetAttribute('clickcast_onleave'); if snippet then self:Run(snippet) end"/>

The only problems I have left are as follows.

How do I get the new buttons that are created into the ClickCastFrames table? The buttons are generated dynamically by SecurePartyHeaderTemplate and I don't get "notified" until the initialConfigFunction snippet is processed. I'm going to try to add it to the snippet but I'm not sure if that will work.
You can't, but you don't need to. You setting clickcast_button and then calling clickcast_register is the group header equivalent of ClickcastFrames[frame] = true.

Also I can't seem to get the menu to work on my buttons. The menu works on the stock UI frames.
Clique uses the WoW standard, where the menu function goes in the frame.menu slot and you use the "menu" attribute. If you use that, it should work.
"There's only one thing that I know how to do well and I've often been told that you only can do what you know how to do well, and that's be you-- be what you're like-- be like yourself. And so I'm having a wonderful time, but I'd rather be whistling in the dark..."
  Reply With Quote