View Single Post
05-28-18, 09:42 PM   #14
galvin
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 265
Finally did it without taint. Basically had to recreate the bar. But not as hard as I thought it would be.
Someone else can make it movable or what not.

UPDATE: Now handles enter/leaving a vehicle.

Code:
local function CreateBagsBar()

  -- Create a new frame and set the frame to the left of the mainmenubar frame
  local BagsBarFrame = CreateFrame('Frame', nil, MainMenuBar)

  BagsBarFrame:SetPoint('TOPRIGHT', MainMenuBarArtFrame.LeftEndCap, 'TOPLEFT', 40, 30)
  BagsBarFrame:Show()

  -- Load bags bar texture
  local BagsBarTexture = BagsBarFrame:CreateTexture()
  BagsBarTexture:SetAtlas('hud-MicroBagBar', true)
  BagsBarTexture:SetPoint('CENTER')
  BagsBarTexture:Show()

  local Width, Height = BagsBarTexture:GetSize()
  BagsBarFrame:SetSize(Width, Height)

  -- Attach blizzard bags and micro buttons to the frame
  MainMenuBarBackpackButton:SetParent(BagsBarFrame)
  CharacterBag0Slot:SetParent(BagsBarFrame)
  CharacterBag1Slot:SetParent(BagsBarFrame)
  CharacterBag2Slot:SetParent(BagsBarFrame)
  CharacterBag3Slot:SetParent(BagsBarFrame)

  MainMenuBarBackpackButton:ClearAllPoints()
  MainMenuBarBackpackButton:SetPoint('TOPRIGHT', -4, -4)

  -- Hide the orginal frame
  MicroButtonAndBagsBar:Hide()

  -- Hide the gryphons on the main menu bar
  MainMenuBarArtFrame.LeftEndCap:Hide()
  MainMenuBarArtFrame.RightEndCap:Hide()

  -- Handle placing the buttons back when ever the main menu bar gets hidden/shown.
  -- Such as enter vehicle then leaving
  local function MoveButtons()
    -- Move the micro buttons using blizzards function
    MoveMicroButtons('BOTTOMLEFT', BagsBarFrame, 'BOTTOMLEFT', 6, 3, false)
  end

  MoveButtons()

  -- Delay the move buttons call, so this happens after blizzards placement
  -- of the micro buttons.
  BagsBarFrame:SetScript('OnShow', function()
    C_Timer.After(0.30, MoveButtons)
  end)
end

Last edited by galvin : 05-29-18 at 05:40 PM.
  Reply With Quote