Here's another function like you're wanting.. give it a try
Code:
function core:CreateCastbar2(self)
if(self.mystyle ~= "target") then return end
local castbar = CreateFrame("StatusBar", "oUF_LumenCastBar2", self)
castbar:SetStatusBarTexture(m.textures.status_texture)
castbar:GetStatusBarTexture():SetHorizTile(false)
castbar:SetFrameStrata("BACKGROUND")
castbar:SetFrameLevel(13)
-- castbar:SetFrameStrata("HIGH")
-- castbar:SetToplevel(true)
castbar.bg = castbar:CreateTexture(nil, 'BORDER')
castbar.bg:SetAllPoints()
castbar.bg:SetAlpha(0.3)
castbar.bg:SetTexture(m.textures.bg_texture)
castbar.bg:SetColorTexture(1/3, 1/3, 1/3)
castbar.Text = castbar:CreateFontString(nil, "OVERLAY")
castbar.Text:SetTextColor(1, 1, 1)
castbar.Text:SetShadowOffset(1, -1)
castbar.Text:SetJustifyH("LEFT")
castbar.Text:SetHeight(12)
castbar.Time = castbar:CreateFontString(nil, "OVERLAY")
castbar.Time:SetTextColor(1, 1, 1)
castbar.Time:SetJustifyH("RIGHT")
castbar.Icon = castbar:CreateTexture(nil, 'ARTWORK')
castbar.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
core:setBackdrop(castbar, cfg.units.target.castbar.height + 4, 2, 2, 2)
castbar:SetBackdropColor(unpack(cfg.elements.castbar.backdrop.color))
-- castbar:SetStatusBarColor(unpack(cfg.units.target.castbar.color))
-- castbar:SetWidth(cfg.units.target.castbar.width - cfg.units.target.castbar.height + 6)
-- castbar:SetHeight(cfg.units.target.castbar.height)
castbar:SetWidth(126)
castbar:SetHeight(15)
-- castbar:SetPoint("CENTER", "UIParent", "CENTER", 0, 350)
castbar:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
castbar.Text:SetFont(font, cfg.fontsize +1, "THINOUTLINE")
castbar.Text:SetWidth(cfg.units.target.castbar.width - 20)
castbar.Text:SetPoint("RIGHT", castbar, -1, 0)
castbar.Time:SetFont(font, cfg.fontsize -1, "THINOUTLINE")
castbar.Time:SetJustifyH("CENTER")
castbar.Time:SetPoint("CENTER", castbar, 102, 0)
castbar.CustomTimeText = CustomCastTimeText
castbar.Icon:SetHeight(cfg.units.target.castbar.height)
castbar.Icon:SetWidth(cfg.units.target.castbar.height)
-- castbar.Icon:SetPoint("RIGHT", castbar, -(cfg.units.target.castbar.height + 2), 0)
castbar.Icon:SetPoint("RIGHT", castbar, 17, 0)
-- Interrupt
core:setglowBorder(castbar)
castbar.Glowborder:SetPoint("TOPLEFT", castbar, "TOPLEFT", - (cfg.units.target.castbar.height + 2) - 6, 6) -- Resize to include icon
castbar.PostCastStart = myPostCastStart
castbar.PostChannelStart = myPostChannelStart
castbar.PostCastStart = PostUpdateCastColor
castbar.PostChannelStart = PostUpdateCastColor
castbar.PostCastInterruptible = PostUpdateCastColor
castbar.PostCastNotInterruptible = PostUpdateCastColor
castbar.PostCastFailed = PostCastFailedOrInterrupted
castbar.PostCastInterrupted = PostCastFailedOrInterrupted
self.Castbar = castbar -- register with oUF
end