Quantcast
<Ui xmlns="http://www.blizzard.com/wow/ui/">
    <Script file="src/bag/bag.lua"/>

    <Frame name="DJBagsBagBarTemplate" virtual="true" movable="true" enableMouse="true">
        <Size x="173" y="47" />
        <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8">
            <EdgeSize>
                <AbsValue val="1" />
            </EdgeSize>
            <Color r="0" g="0" b="0" a="0.6" />
            <BorderColor r="0.3" g="0.3" b="0.3" a="1" />
        </Backdrop>
        <Frames>
            <Button name="$parentBag1" parentKey="bag1" inherits="ItemButtonTemplate">
                <Anchors>
                    <Anchor point="TOPLEFT" x="5" y="-5" />
                </Anchors>
                <Scripts>
                    <OnLoad>
                        DJBagsBagItemLoad(self, 1, ContainerIDToInventoryID(1))
                    </OnLoad>
                </Scripts>
            </Button>
            <Button name="$parentBag2" parentKey="bag2" inherits="ItemButtonTemplate">
                <Anchors>
                    <Anchor point="TOPLEFT" relativeTo="$parentBag1" relativePoint="TOPRIGHT" x="5" />
                </Anchors>
                <Scripts>
                    <OnLoad>
                        DJBagsBagItemLoad(self, 2, ContainerIDToInventoryID(2))
                    </OnLoad>
                </Scripts>
            </Button>
            <Button name="$parentBag3" parentKey="bag3" inherits="ItemButtonTemplate">
                <Anchors>
                    <Anchor point="TOPLEFT" relativeTo="$parentBag2" relativePoint="TOPRIGHT" x="5" />
                </Anchors>
                <Scripts>
                    <OnLoad>
                        DJBagsBagItemLoad(self, 3, ContainerIDToInventoryID(3))
                    </OnLoad>
                </Scripts>
            </Button>
            <Button name="$parentBag4" parentKey="bag4" inherits="ItemButtonTemplate">
                <Anchors>
                    <Anchor point="TOPLEFT" relativeTo="$parentBag3" relativePoint="TOPRIGHT" x="5" />
                </Anchors>
                <Scripts>
                    <OnLoad>
                        DJBagsBagItemLoad(self, 4, ContainerIDToInventoryID(4))
                    </OnLoad>
                </Scripts>
            </Button>
        </Frames>
    </Frame>

    <Frame name="DJBagsMainBarTemplate" virtual="true" movable="true" enableMouse="true">
        <Size x="345" y="25"/>
        <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8">
            <EdgeSize>
                <AbsValue val="1"/>
            </EdgeSize>
            <Color r="0" g="0" b="0" a="0.6"/>
            <BorderColor r="0.3" g="0.3" b="0.3" a="1"/>
        </Backdrop>
        <Frames>
            <CheckButton name="$parentBagBtn" inherits="UIRadioButtonTemplate">
                <Anchors>
                    <Anchor point="RIGHT" relativePoint="RIGHT" relativeTo="$parent" x="-5"/>
                </Anchors>
                <Scripts>
                    <OnClick>
                        if self:GetParent().bagBar:IsVisible() then
                            self:GetParent().bagBar:Hide()
                        else
                            self:GetParent().bagBar:Show()
                        end
                    </OnClick>
                </Scripts>
            </CheckButton>
            <Button name="$parentRestackBtn">
                <Size x="16" y="16"/>
                <Anchors>
                    <Anchor point="RIGHT" relativeTo="$parentBagBtn" relativePoint="LEFT" x="-3"/>
                </Anchors>
                <NormalTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Disabled"/>
                <PushedTexture file="Interface\Buttons\UI-GuildButton-OfficerNote-Up"/>
                <HighlightTexture file="Interface\Buttons\UI-GuildButton-PublicNote-Up" alphaMode="ADD"/>
                <Scripts>
                    <OnEnter>
                        GameTooltip:SetOwner(self, 'TOPRIGHT')
                        GameTooltip:SetText(BAG_CLEANUP_BAGS)
                        GameTooltip:Show()
                    </OnEnter>
                    <OnLeave>
                        GameTooltip:Hide()
                    </OnLeave>
                    <OnClick>
                        -- PlaySound("UI_BagSorting_01");
                        SortBags()
                    </OnClick>
                </Scripts>
            </Button>
            <Button name="$parentClearButton">
                <Size x="25" y="25"/>
                <Anchors>
                    <Anchor point="RIGHT" relativeTo="$parentRestackBtn" relativePoint="LEFT" x="-3"/>
                </Anchors>
                <NormalTexture file="Interface\Buttons\UI-RotationLeft-Button-Up"/>
                <PushedTexture file="Interface\Buttons\UI-RotationLeft-Button-Down"/>
                <HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD">
                    <Size x="22" y="23"/>
                    <Anchors>
                        <Anchor point="CENTER" x="0" y="0"/>
                    </Anchors>
                </HighlightTexture>
                <Scripts>
                    <OnEnter>
                        GameTooltip:SetOwner(self, 'TOPRIGHT')
                        --GameTooltip:SetText(DJBags_LOCALE_CLEAR_NEW_ITEMS)
                        GameTooltip:Show()
                    </OnEnter>
                    <OnLeave>
                        GameTooltip:Hide()
                    </OnLeave>
                    <OnClick>
                        self:GetParent():GetParent():ClearNewItems()
                    </OnClick>
                </Scripts>
            </Button>
            <EditBox name="$parentSearchBox" parentKey="search" inherits="BagSearchBoxTemplate" letters="15">
                <Size x="96" y="18"/>
                <Anchors>
                    <Anchor point="RIGHT" relativeTo="$parentClearButton" relativePoint="LEFT" x="-3"/>
                </Anchors>
            </EditBox>
            <Frame name="$parentMoney" parentKey="moneyFrame" inherits="SmallMoneyFrameTemplate" hidden="false">
                <Anchors>
                    <Anchor point="RIGHT" relativeTo="$parentSearchBox" relativePoint="LEFT"/>
                </Anchors>
                <Scripts>
                    <OnLoad>
                        SmallMoneyFrame_OnLoad(self);
                        MoneyFrame_SetType(self, "PLAYER");
                        MoneyFrame_SetMaxDisplayWidth(self, 168);
                    </OnLoad>
                </Scripts>
            </Frame>
            <Frame name="$parentCurrencyDisplay" frameStrata="DIALOG" toplevel="true" frameLevel="10">
                <Anchors>
                    <Anchor point="TOPLEFT"/>
                    <Anchor point="BOTTOMRIGHT" relativeTo="$parentSearchBox" relativePoint="BOTTOMLEFT"/>
                </Anchors>
                <Scripts>
                    <OnEnter>
                        local cnt = GetCurrencyListSize()
                        GameTooltip:SetOwner(self, "ANCHOR_NONE")
                        GameTooltip:SetPoint("BOTTOMLEFT", self, "TOPLEFT")
                        GameTooltip:SetText("Currency")
                        for index = 1, cnt do
                            local name, _, _, _, _, count, texture, _, _, _, _ = GetCurrencyListInfo(index)
                            if count ~= 0 and texture ~= nil then
                                GameTooltip:AddDoubleLine(name, count .. " |T" .. texture .. ":16|t", 1, 1, 1, 1, 1, 1)
                            end
                        end
                        GameTooltip:Show()
                    </OnEnter>
                    <OnLeave>
                            GameTooltip:Hide()
                    </OnLeave>
                    <OnMouseDown>
                            MoneyInputFrame_OpenPopup(self:GetParent().moneyFrame);
                    </OnMouseDown>
                </Scripts>
            </Frame>
            <Frame name="$parentBagBar" parentKey="bagBar" inherits="DJBagsBagBarTemplate" hidden="true">
                <Anchors>
                    <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" y="-5"/>
                </Anchors>
            </Frame>
        </Frames>
    </Frame>

    <Frame name="DJBagsBag" frameStrata="MEDIUM" toplevel="true" movable="true" enableMouse="true"
           hidden="true" parent="UIParent">
        <Backdrop bgFile="Interface\ChatFrame\ChatFrameBackground" edgeFile="Interface\Buttons\WHITE8x8">
            <EdgeSize>
                <AbsValue val="1"/>
            </EdgeSize>
            <Color r="0" g="0" b="0" a="0.6"/>
            <BorderColor r="0.3" g="0.3" b="0.3" a="1"/>
        </Backdrop>
        <Anchors>
            <Anchor point="CENTER" />
        </Anchors>
        <Frames>
            <Frame name="$parentMainBar" parentKey="mainBar" inherits="DJBagsMainBarTemplate">
                <Anchors>
                    <Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT" x="0" y="-5"/>
                </Anchors>
            </Frame>
            <Button name="$parentClose" parentKey="close" inherits="UIPanelCloseButton">
                <Anchors>
                    <Anchor point="CENTER" relativePoint="TOPRIGHT" x="-2" y="-2"/>
                </Anchors>
                <NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Disabled" />
                <Scripts>
                    <OnLoad>
                        self:SetAlpha(0.2)
                    </OnLoad>
                    <OnEnter>
                        self:SetAlpha(1)
                    </OnEnter>
                    <OnLeave>
                        self:SetAlpha(0.2)
                    </OnLeave>
                </Scripts>
            </Button>
        </Frames>
        <Scripts>
            <OnLoad>
                    DJBagsRegisterBagBagContainer(self, {0, 1, 2, 3, 4})
            </OnLoad>
            <OnShow>
                    self:OnShow()
            </OnShow>
            <OnHide>
                    self:OnHide()
            </OnHide>
        </Scripts>
    </Frame>
</Ui>