sfmict / HidingBar

Adds a custom panel for easy add-on management.
GNU General Public License v3.0
8 stars 1 forks source link

Support for AddonCompartmentFrame #18

Closed LenweSaralonde closed 1 year ago

LenweSaralonde commented 1 year ago

Environment

Desired functionality

WoW 10.0 introduced a placeholder for add-on developers to put their add-on buttons: AddonCompartmentFrame. It consists of a small button under the calendar icon, with a number that opens a UIDropdownMenu of add-on launchers (the number being the number of launchers available).

image

DataBroker buttons can be very easily added to this component. HidingBar may allow the user to choose between using the minimap button, the HidingBar tray or AddonCompartmentFrame.

Eventually, the HidingBar tray and the minimap could end up being totally empty of launcher buttons, all of them being moved to the AddonCompartmentFrame.

Since AddonCompartmentFrame is a standard Blizzard component, add-ons can already use it so no new item should be added if it already exists (can be checked by the value of the text field). In addition, existing AddonCompartmentFrame entries could be hidden by HidingBar if the user decided not to show them.

if AddonCompartmentFrame then
    for _, ldbData in LibDataBroker:DataObjectIterator() do
        local item = {
            notCheckable = true,
            text = ldbData.text, -- Should not already exist in AddonCompartmentFrame.registeredAddons
            icon = ldbData.icon,
            registerForRightClick = true,
            func = function(self, _, _, _, button) ldbData.OnClick(nil, button) end
        }
        AddonCompartmentFrame:RegisterAddon(item)
    end
end

Entries could be also added using the LibDBIcon buttons' dataObject table in addition to the LibDataBroker launchers.

Existing items are stored in the AddonCompartmentFrame.registeredAddons table, that can be manipulated. Each item is a UIDropdownMenu "info" table.

sfmict commented 1 year ago

Looks like a new area for capturing buttons... Maybe it's worth capturing the AddonCompartmentFrame button itself.

LenweSaralonde commented 1 year ago

Yes, that's part of what I'm suggesting, capturing the AddonCompartmentFrame buttons using AddonCompartmentFrame.registeredAddons (there you have text, optional icon and func) to handle them as LibDataBroker launcher objects (and using text value to avoid duplicates).

On the other hand, it would be great if HidingBar could turn the minimap buttons and LibDataBroker launcher objects into AddonCompartmentFrame buttons (still, using the text field to avoid duplicates, keeping the existing AddonCompartmentFrame button if it already exists).

In this case, the user could decide for each button whenever to have it on the minimap, in the HidingBar tray or in the AddonCompartmentFrame.

If the HidingBar tray ends up being empty, it's hidden. Same for the AddonCompartmentFrame that will no longer show up if it's hidden.

sfmict commented 1 year ago

AddonCompartmentFrame uses UIDropDownMenu, it has taints and I looked it was not fixed, I don't want to deal with it. I will look in the direction of redirecting buttons to the hidingbar

sfmict commented 1 year ago

Unfortunately I don't think the addon should capture buttons from this menu because it may not have an icon or it may have fields that don't appear on the icon, but most importantly these buttons don't have a unique field. It might make sense to capture the dropdown button itself, but no more.

LenweSaralonde commented 1 year ago

If the icon is missing, maybe you could use a default fallback icon. BTW this still looks like an experimental feature so just capturing the dropdown button (and have it removed from the main UI) could be a first step.

sfmict commented 1 year ago

Added to grab by default buttons. Let's see if Blizzard will change something.