diff --git a/src/types/statusbar.lua b/src/types/statusbar.lua index 1393689..2bb9ff0 100644 --- a/src/types/statusbar.lua +++ b/src/types/statusbar.lua @@ -20,19 +20,22 @@ local types = omi.GetModule("types") types.StatusBar = types.CreateClass("StatusBar") local StatusBar = types.StatusBar -function StatusBar:Init(parent, width, height) +function StatusBar:Init(parent, width, height, level, top) + if top == nil then top = true end + level = level or 0 -- parent: the parent frame - -- pct: nil if no percent value is shown, otherwise "left", "right" or "center" - -- value: nil if no value is shown, otherwise "left", "right" or "center" - -- text: nil if no text is shown, otherwise "left", "right" or "center" - -- stack: another StatusBar we will stack under self.parent = parent local parentFrame = parent.secureFrame local bar = CreateFrame("StatusBar", nil, parentFrame) bar:SetFrameStrata("MEDIUM") - bar:SetFrameLevel(10) - bar:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0) + bar:SetFrameLevel(level) + + if top then + bar:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0) + else + bar:SetPoint("BOTTOMLEFT", parentFrame, "BOTTOMLEFT", 0, 0) + end bar:SetSize(width, height) bar:SetStatusBarTexture("Interface\\Addons\\OmicronFrames\\media\\textures\\bar_subtle_diagonal") @@ -58,6 +61,14 @@ function StatusBar:SetValue(value) self.bar:SetValue(value) end +function StatusBar:Show() + self.bar:Show() +end + +function StatusBar:Hide() + self.bar:Hide() +end + function StatusBar:SetInterpolatedColor(start, stop, progress) local r = start[1] + (stop[1] - start[1])*progress local g = start[2] + (stop[2] - start[2])*progress