Tercio@11: Tercio@11: local DF = _G ["DetailsFramework"] Tercio@20: if (not DF or not DetailsFrameworkCanLoad) then Tercio@20: return Tercio@20: end Tercio@20: Tercio@11: local _ Tercio@11: local _rawset = rawset --> lua local Tercio@11: local _rawget = rawget --> lua local Tercio@11: local _setmetatable = setmetatable --> lua local Tercio@11: local _unpack = unpack --> lua local Tercio@11: local _type = type --> lua local Tercio@11: local _math_floor = math.floor --> lua local Tercio@11: Tercio@11: local cleanfunction = function() end Tercio@11: local SplitBarMetaFunctions = {} Tercio@11: local APISplitBarFunctions Tercio@11: Tercio@11: ------------------------------------------------------------------------------------------------------------ Tercio@11: --> metatables Tercio@11: Tercio@11: SplitBarMetaFunctions.__call = function (_table, value) Tercio@11: if (not value) then Tercio@11: return _table.statusbar:GetValue() Tercio@11: else Tercio@11: _table.div:SetPoint ("left", _table.statusbar, "left", value * (_table.statusbar:GetWidth()/100) - 18, 0) Tercio@11: return _table.statusbar:SetValue (value) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: SplitBarMetaFunctions.__add = function (v1, v2) Tercio@11: if (_type (v1) == "table") then Tercio@11: local v = v1.statusbar:GetValue() Tercio@11: v = v + v2 Tercio@11: v1.div:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0) Tercio@11: v1.statusbar:SetValue (v) Tercio@11: else Tercio@11: local v = v2.statusbar:GetValue() Tercio@11: v = v + v1 Tercio@11: v2.div:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0) Tercio@11: v2.statusbar:SetValue (v) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: SplitBarMetaFunctions.__sub = function (v1, v2) Tercio@11: if (_type (v1) == "table") then Tercio@11: local v = v1.statusbar:GetValue() Tercio@11: v = v - v2 Tercio@11: v1.div:SetPoint ("left", v1.statusbar, "left", value * (v1.statusbar:GetWidth()/100) - 18, 0) Tercio@11: v1.statusbar:SetValue (v) Tercio@11: else Tercio@11: local v = v2.statusbar:GetValue() Tercio@11: v = v - v1 Tercio@11: v2.div:SetPoint ("left", v2.statusbar, "left", value * (v2.statusbar:GetWidth()/100) - 18, 0) Tercio@11: v2.statusbar:SetValue (v) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: ------------------------------------------------------------------------------------------------------------ Tercio@11: --> members Tercio@11: Tercio@11: --> tooltip Tercio@11: local function gmember_tooltip (_object) Tercio@11: return _object:GetTooltip() Tercio@11: end Tercio@11: --> shown Tercio@11: local gmember_shown = function (_object) Tercio@11: return _object.statusbar:IsShown() Tercio@11: end Tercio@11: --> frame width Tercio@11: local gmember_width = function (_object) Tercio@11: return _object.statusbar:GetWidth() Tercio@11: end Tercio@11: --> frame height Tercio@11: local gmember_height = function (_object) Tercio@11: return _object.statusbar:GetHeight() Tercio@11: end Tercio@11: --> value Tercio@11: local gmember_value = function (_object) Tercio@11: return _object.statusbar:GetValue() Tercio@11: end Tercio@11: --> right text Tercio@11: local gmember_rtext = function (_object) Tercio@11: return _object.textright:GetText() Tercio@11: end Tercio@11: --> left text Tercio@11: local gmember_ltext = function (_object) Tercio@11: return _object.textleft:GetText() Tercio@11: end Tercio@11: --> right color Tercio@11: local gmember_rcolor = function (_object) Tercio@11: return _object.background.original_colors Tercio@11: end Tercio@11: --> left color Tercio@11: local gmember_lcolor = function (_object) Tercio@11: return _object.texture.original_colors Tercio@11: end Tercio@11: --> right icon Tercio@11: local gmember_ricon = function (_object) Tercio@11: return _object.iconright:GetTexture() Tercio@11: end Tercio@11: --> left icon Tercio@11: local gmember_licon = function (_object) Tercio@11: return _object.iconleft:GetTexture() Tercio@11: end Tercio@11: --> texture Tercio@11: local gmember_texture = function (_object) Tercio@11: return _object.texture:GetTexture() Tercio@11: end Tercio@11: --> font size Tercio@11: local gmember_textsize = function (_object) Tercio@11: local _, fontsize = _object.textleft:GetFont() Tercio@11: return fontsize Tercio@11: end Tercio@11: --> font face Tercio@11: local gmember_textfont = function (_object) Tercio@11: local fontface = _object.textleft:GetFont() Tercio@11: return fontface Tercio@11: end Tercio@11: --> font color Tercio@11: local gmember_textcolor = function (_object) Tercio@11: return _object.textleft:GetTextColor() Tercio@11: end Tercio@11: Tercio@11: local get_members_function_index = { Tercio@11: ["tooltip"] = gmember_tooltip, Tercio@11: ["shown"] = gmember_shown, Tercio@11: ["width"] = gmember_width, Tercio@11: ["height"] = gmember_height, Tercio@11: ["value"] = gmember_value, Tercio@11: ["righttext"] = gmember_rtext, Tercio@11: ["lefttext"] = gmember_ltext, Tercio@11: ["rightcolor"] = gmember_rcolor, Tercio@11: ["leftcolor"] = gmember_lcolor, Tercio@11: ["righticon"] = gmember_ricon, Tercio@11: ["lefticon"] = gmember_licon, Tercio@11: ["texture"] = gmember_texture, Tercio@11: ["fontsize"] = gmember_textsize, Tercio@11: ["fontface"] = gmember_textfont, Tercio@11: ["fontcolor"] = gmember_textcolor, Tercio@11: ["textsize"] = gmember_textsize, --alias Tercio@11: ["textfont"] = gmember_textfont, --alias Tercio@11: ["textcolor"] = gmember_textcolor --alias Tercio@11: } Tercio@11: Tercio@11: SplitBarMetaFunctions.__index = function (_table, _member_requested) Tercio@11: Tercio@11: local func = get_members_function_index [_member_requested] Tercio@11: if (func) then Tercio@11: return func (_table, _member_requested) Tercio@11: end Tercio@11: Tercio@11: local fromMe = _rawget (_table, _member_requested) Tercio@11: if (fromMe) then Tercio@11: return fromMe Tercio@11: end Tercio@11: Tercio@11: return SplitBarMetaFunctions [_member_requested] Tercio@11: end Tercio@11: Tercio@11: --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Tercio@11: Tercio@11: --> tooltip Tercio@11: local smember_tooltip = function (_object, _value) Tercio@11: return _object:SetTooltip (_value) Tercio@11: end Tercio@11: --> show Tercio@11: local smember_shown = function (_object, _value) Tercio@11: if (_value) then Tercio@11: return _object:Show() Tercio@11: else Tercio@11: return _object:Hide() Tercio@11: end Tercio@11: end Tercio@11: --> hide Tercio@11: local smember_hide = function (_object, _value) Tercio@11: if (_value) then Tercio@11: return _object:Hide() Tercio@11: else Tercio@11: return _object:Show() Tercio@11: end Tercio@11: end Tercio@11: --> width Tercio@11: local smember_width = function (_object, _value) Tercio@11: return _object.statusbar:SetWidth (_value) Tercio@11: end Tercio@11: --> height Tercio@11: local smember_height = function (_object, _value) Tercio@11: return _object.statusbar:SetHeight (_value) Tercio@11: end Tercio@11: --> statusbar value Tercio@11: local smember_value = function (_object, _value) Tercio@11: _object.statusbar:SetValue (_value) Tercio@11: return _object.div:SetPoint ("left", _object.statusbar, "left", _value * (_object.statusbar:GetWidth()/100) - 18, 0) Tercio@11: end Tercio@11: --> right text Tercio@11: local smember_rtext = function (_object, _value) Tercio@11: return _object.textright:SetText (_value) Tercio@11: end Tercio@11: --> left text Tercio@11: local smember_ltext = function (_object, _value) Tercio@11: return _object.textleft:SetText (_value) Tercio@11: end Tercio@11: --> right color Tercio@11: local smember_rcolor = function (_object, _value) Tercio@11: local _value1, _value2, _value3, _value4 = DF:ParseColors (_value) Tercio@11: _object.background.original_colors = {_value1, _value2, _value3, _value4} Tercio@11: return _object.background:SetVertexColor (_value1, _value2, _value3, _value4) Tercio@11: end Tercio@11: --> left color Tercio@11: local smember_lcolor = function (_object, _value) Tercio@11: local _value1, _value2, _value3, _value4 = DF:ParseColors (_value) Tercio@11: Tercio@11: _object.statusbar:SetStatusBarColor (_value1, _value2, _value3, _value4) Tercio@11: _object.texture.original_colors = {_value1, _value2, _value3, _value4} Tercio@11: return _object.texture:SetVertexColor (_value1, _value2, _value3, _value4) Tercio@11: end Tercio@11: --> right icon Tercio@11: local smember_ricon = function (_object, _value) Tercio@11: if (type (_value) == "table") then Tercio@11: local _value1, _value2 = _unpack (_value) Tercio@11: _object.iconright:SetTexture (_value1) Tercio@11: if (_value2) then Tercio@11: _object.iconright:SetTexCoord (_unpack (_value2)) Tercio@11: end Tercio@11: else Tercio@11: _object.iconright:SetTexture (_value) Tercio@11: end Tercio@11: return Tercio@11: end Tercio@11: --> left icon Tercio@11: local smember_licon = function (_object, _value) Tercio@11: if (type (_value) == "table") then Tercio@11: local _value1, _value2 = _unpack (_value) Tercio@11: _object.iconleft:SetTexture (_value1) Tercio@11: if (_value2) then Tercio@11: _object.iconleft:SetTexCoord (_unpack (_value2)) Tercio@11: end Tercio@11: else Tercio@11: _object.iconleft:SetTexture (_value) Tercio@11: end Tercio@11: return Tercio@11: end Tercio@11: --> texture Tercio@11: local smember_texture = function (_object, _value) Tercio@11: if (type (_value) == "table") then Tercio@11: local _value1, _value2 = _unpack (_value) Tercio@11: _object.texture:SetTexture (_value1) Tercio@11: _object.background:SetTexture (_value1) Tercio@11: if (_value2) then Tercio@11: _object.texture:SetTexCoord (_unpack (_value2)) Tercio@11: _object.background:SetTexCoord (_unpack (_value2)) Tercio@11: end Tercio@11: else Tercio@11: _object.texture:SetTexture (_value) Tercio@11: _object.background:SetTexture (_value) Tercio@11: end Tercio@11: return Tercio@11: end Tercio@11: --> font face Tercio@11: local smember_textfont = function (_object, _value) Tercio@11: DF:SetFontFace (_object.textleft, _value) Tercio@11: return DF:SetFontFace (_object.textright, _value) Tercio@11: end Tercio@11: --> font size Tercio@11: local smember_textsize = function (_object, _value) Tercio@11: DF:SetFontSize (_object.textleft, _value) Tercio@11: return DF:SetFontSize (_object.textright, _value) Tercio@11: end Tercio@11: --> font color Tercio@11: local smember_textcolor = function (_object, _value) Tercio@11: local _value1, _value2, _value3, _value4 = DF:ParseColors (_value) Tercio@11: _object.textleft:SetTextColor (_value1, _value2, _value3, _value4) Tercio@11: return _object.textright:SetTextColor (_value1, _value2, _value3, _value4) Tercio@11: end Tercio@11: Tercio@11: local set_members_function_index = { Tercio@11: ["tooltip"] = smember_tooltip, Tercio@11: ["shown"] = smember_shown, Tercio@11: ["width"] = smember_width, Tercio@11: ["height"] = smember_height, Tercio@11: ["value"] = smember_value, Tercio@11: ["righttext"] = smember_rtext, Tercio@11: ["lefttext"] = smember_ltext, Tercio@11: ["rightcolor"] = smember_rcolor, Tercio@11: ["leftcolor"] = smember_lcolor, Tercio@11: ["righticon"] = smember_ricon, Tercio@11: ["lefticon"] = smember_licon, Tercio@11: ["texture"] = smember_texture, Tercio@11: ["fontsize"] = smember_textsize, Tercio@11: ["fontface"] = smember_textfont, Tercio@11: ["fontcolor"] = smember_textcolor, Tercio@11: ["textsize"] = smember_textsize, --alias Tercio@11: ["textfont"] = smember_textfont, --alias Tercio@11: ["textcolor"] = smember_textcolor --alias Tercio@11: } Tercio@11: Tercio@11: SplitBarMetaFunctions.__newindex = function (_table, _key, _value) Tercio@11: local func = set_members_function_index [_key] Tercio@11: if (func) then Tercio@11: return func (_table, _value) Tercio@11: else Tercio@11: return _rawset (_table, _key, _value) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: ------------------------------------------------------------------------------------------------------------ Tercio@11: --> methods Tercio@11: Tercio@11: --> show & hide Tercio@11: function SplitBarMetaFunctions:Show() Tercio@11: return self.statusbar:Show() Tercio@11: end Tercio@11: function SplitBarMetaFunctions:Hide() Tercio@11: return self.statusbar:Hide() Tercio@11: end Tercio@11: Tercio@11: -- set split Tercio@11: function SplitBarMetaFunctions:SetSplit (value) Tercio@11: if (not value) then Tercio@11: value = self.statusbar:GetValue() Tercio@11: elseif (value < 0 or value > 100) then Tercio@11: return Tercio@11: end Tercio@11: self.statusbar:SetValue (value) Tercio@11: self.div:SetPoint ("left", self.statusbar, "left", value * (self.statusbar:GetWidth()/100) - 18, 0) Tercio@11: end Tercio@11: Tercio@11: -- setpoint Tercio@11: function SplitBarMetaFunctions:SetPoint (v1, v2, v3, v4, v5) Tercio@11: v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self) Tercio@11: if (not v1) then Tercio@11: print ("Invalid parameter for SetPoint") Tercio@11: return Tercio@11: end Tercio@11: return self.widget:SetPoint (v1, v2, v3, v4, v5) Tercio@11: end Tercio@11: Tercio@11: -- sizes Tercio@11: function SplitBarMetaFunctions:SetSize (w, h) Tercio@11: if (w) then Tercio@11: self.statusbar:SetWidth (w) Tercio@11: end Tercio@11: if (h) then Tercio@11: self.statusbar:SetHeight (h) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: -- texture Tercio@11: function SplitBarMetaFunctions:SetTexture (texture) Tercio@11: self.background:SetTexture (texture) Tercio@11: self.texture:SetTexture (texture) Tercio@11: end Tercio@11: Tercio@11: -- texts Tercio@11: function SplitBarMetaFunctions:SetLeftText (text) Tercio@11: self.textleft:SetText (text) Tercio@11: end Tercio@11: function SplitBarMetaFunctions:SetRightText (text) Tercio@11: self.textright:SetText (text) Tercio@11: end Tercio@11: Tercio@11: -- colors Tercio@11: function SplitBarMetaFunctions:SetLeftColor (r, g, b, a) Tercio@11: r, g, b, a = DF:ParseColors (r, g, b, a) Tercio@11: self.texture:SetVertexColor (r, g, b, a) Tercio@11: self.texture.original_colors = {r, g, b, a} Tercio@11: end Tercio@11: function SplitBarMetaFunctions:SetRightColor (r, g, b, a) Tercio@11: r, g, b, a = DF:ParseColors (r, g, b, a) Tercio@11: self.background:SetVertexColor (r, g, b, a) Tercio@11: self.background.original_colors = {r, g, b, a} Tercio@11: end Tercio@11: Tercio@11: -- icons Tercio@11: function SplitBarMetaFunctions:SetLeftIcon (texture, ...) Tercio@11: self.iconleft:SetTexture (texture) Tercio@11: if (...) then Tercio@11: local L, R, U, D = unpack (...) Tercio@11: self.iconleft:SetTexCoord (L, R, U, D) Tercio@11: end Tercio@11: end Tercio@11: function SplitBarMetaFunctions:SetRightIcon (texture, ...) Tercio@11: self.iconright:SetTexture (texture) Tercio@11: if (...) then Tercio@11: local L, R, U, D = unpack (...) Tercio@11: self.iconright:SetTexCoord (L, R, U, D) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: -- tooltip Tercio@11: function SplitBarMetaFunctions:SetTooltip (tooltip) Tercio@11: if (tooltip) then Tercio@11: return _rawset (self, "have_tooltip", tooltip) Tercio@11: else Tercio@11: return _rawset (self, "have_tooltip", nil) Tercio@11: end Tercio@11: end Tercio@11: function SplitBarMetaFunctions:GetTooltip() Tercio@11: return _rawget (self, "have_tooltip") Tercio@11: end Tercio@11: Tercio@11: -- frame levels Tercio@11: function SplitBarMetaFunctions:GetFrameLevel() Tercio@11: return self.statusbar:GetFrameLevel() Tercio@11: end Tercio@11: function SplitBarMetaFunctions:SetFrameLevel (level, frame) Tercio@11: if (not frame) then Tercio@11: return self.statusbar:SetFrameLevel (level) Tercio@11: else Tercio@11: local framelevel = frame:GetFrameLevel (frame) + level Tercio@11: return self.statusbar:SetFrameLevel (framelevel) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: -- frame stratas Tercio@11: function SplitBarMetaFunctions:SetFrameStrata() Tercio@11: return self.statusbar:GetFrameStrata() Tercio@11: end Tercio@11: function SplitBarMetaFunctions:SetFrameStrata (strata) Tercio@11: if (_type (strata) == "table") then Tercio@11: self.statusbar:SetFrameStrata (strata:GetFrameStrata()) Tercio@11: else Tercio@11: self.statusbar:SetFrameStrata (strata) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: --> hooks Tercio@11: function SplitBarMetaFunctions:SetHook (hookType, func) Tercio@11: if (func) then Tercio@11: _rawset (self, hookType.."Hook", func) Tercio@11: else Tercio@11: _rawset (self, hookType.."Hook", nil) Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: ------------------------------------------------------------------------------------------------------------ Tercio@11: --> scripts Tercio@11: local OnEnter = function (frame) Tercio@11: if (frame.MyObject.OnEnterHook) then Tercio@11: local interrupt = frame.MyObject.OnEnterHook (frame) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local oc = frame.MyObject.texture.original_colors --original colors Tercio@11: DF:GradientEffect ( frame.MyObject.texture, "texture", oc[1], oc[2], oc[3], oc[4], oc[1]+0.2, oc[2]+0.2, oc[3]+0.2, oc[4], .2) Tercio@11: frame.MyObject.div:SetPoint ("left", frame, "left", frame:GetValue() * (frame:GetWidth()/100) - 18, 0) Tercio@11: Tercio@11: if (frame.MyObject.have_tooltip) then Tercio@11: GameCooltip2:Reset() Tercio@11: GameCooltip2:AddLine (frame.MyObject.have_tooltip) Tercio@11: GameCooltip2:ShowCooltip (frame, "tooltip") Tercio@11: end Tercio@11: Tercio@11: local parent = frame:GetParent().MyObject Tercio@11: if (parent and parent.type == "panel") then Tercio@11: if (parent.GradientEnabled) then Tercio@11: parent:RunGradient() Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnLeave = function (frame) Tercio@11: if (frame.MyObject.OnLeaveHook) then Tercio@11: local interrupt = frame.MyObject.OnLeaveHook (frame) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local oc = frame.MyObject.texture.original_colors --original colors Tercio@11: local r, g, b, a = frame.MyObject.texture:GetVertexColor() Tercio@11: DF:GradientEffect ( frame.MyObject.texture, "texture", r, g, b, a, oc[1], oc[2], oc[3], oc[4], .2) Tercio@11: Tercio@11: if (frame.MyObject.have_tooltip) then Tercio@11: DF.popup:ShowMe (false) Tercio@11: end Tercio@11: Tercio@11: local parent = frame:GetParent().MyObject Tercio@11: if (parent and parent.type == "panel") then Tercio@11: if (parent.GradientEnabled) then Tercio@11: parent:RunGradient (false) Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnHide = function (frame) Tercio@11: if (frame.MyObject.OnHideHook) then Tercio@11: local interrupt = frame.MyObject.OnHideHook (frame) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnShow = function (frame) Tercio@11: if (frame.MyObject.OnShowHook) then Tercio@11: local interrupt = frame.MyObject.OnShowHook (frame) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnMouseDown = function (frame, button) Tercio@11: if (frame.MyObject.OnMouseDownHook) then Tercio@11: local interrupt = frame.MyObject.OnMouseDownHook (frame, button) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: if (not frame.MyObject.container.isLocked and frame.MyObject.container:IsMovable()) then Tercio@11: if (not frame.isLocked and frame:IsMovable()) then Tercio@11: frame.MyObject.container.isMoving = true Tercio@11: frame.MyObject.container:StartMoving() Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnMouseUp = function (frame, button) Tercio@11: if (frame.MyObject.OnMouseUpHook) then Tercio@11: local interrupt = frame.MyObject.OnMouseUpHook (frame, button) Tercio@11: if (interrupt) then Tercio@11: return Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: if (frame.MyObject.container.isMoving) then Tercio@11: frame.MyObject.container:StopMovingOrSizing() Tercio@11: frame.MyObject.container.isMoving = false Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: local OnSizeChanged = function (statusbar) Tercio@11: statusbar.MyObject.div:SetPoint ("left", statusbar, "left", statusbar:GetValue() * (statusbar:GetWidth()/100) - 18, 0) Tercio@11: end Tercio@11: Tercio@11: ------------------------------------------------------------------------------------------------------------ Tercio@11: --> object constructor Tercio@11: Tercio@11: function DetailsFrameworkSplitlBar_OnCreate (self) Tercio@11: self.texture.original_colors = {1, 1, 1, 1} Tercio@11: self.background.original_colors = {.5, .5, .5, 1} Tercio@11: self.spark:SetPoint ("left", self, "left", self:GetValue() * (self:GetWidth()/100) - 18, 0) Tercio@11: return true Tercio@11: end Tercio@11: Tercio@11: function DF:CreateSplitBar (parent, parent, w, h, member, name) Tercio@11: return DF:NewSplitBar (parent, container, name, member, w, h) Tercio@11: end Tercio@11: Tercio@11: function DF:NewSplitBar (parent, container, name, member, w, h) Tercio@11: Tercio@11: if (not name) then Tercio@11: name = "DetailsFrameworkSplitbar" .. DF.SplitBarCounter Tercio@11: DF.SplitBarCounter = DF.SplitBarCounter + 1 Tercio@11: end Tercio@11: if (not parent) then Tercio@11: return nil Tercio@11: end Tercio@11: if (not container) then Tercio@11: container = parent Tercio@11: end Tercio@11: Tercio@11: if (name:find ("$parent")) then Tercio@11: name = name:gsub ("$parent", parent:GetName()) Tercio@11: end Tercio@11: Tercio@11: local SplitBarObject = {type = "barsplit", dframework = true} Tercio@11: Tercio@11: if (member) then Tercio@11: parent [member] = SplitBarObject Tercio@11: end Tercio@11: Tercio@11: if (parent.dframework) then Tercio@11: parent = parent.widget Tercio@11: end Tercio@11: if (container.dframework) then Tercio@11: container = container.widget Tercio@11: end Tercio@11: Tercio@11: --> default members: Tercio@11: --> hooks Tercio@11: SplitBarObject.OnEnterHook = nil Tercio@11: SplitBarObject.OnLeaveHook = nil Tercio@11: SplitBarObject.OnHideHook = nil Tercio@11: SplitBarObject.OnShowHook = nil Tercio@11: SplitBarObject.OnMouseDownHook = nil Tercio@11: SplitBarObject.OnMouseUpHook = nil Tercio@11: --> misc Tercio@11: SplitBarObject.tooltip = nil Tercio@11: SplitBarObject.locked = false Tercio@11: SplitBarObject.have_tooltip = nil Tercio@11: SplitBarObject.container = container Tercio@11: Tercio@11: --> create widgets Tercio@11: SplitBarObject.statusbar = CreateFrame ("statusbar", name, parent, "DetailsFrameworkSplitBarTemplate") Tercio@11: SplitBarObject.widget = SplitBarObject.statusbar Tercio@11: Tercio@11: if (not APISplitBarFunctions) then Tercio@11: APISplitBarFunctions = true Tercio@11: local idx = getmetatable (SplitBarObject.statusbar).__index Tercio@11: for funcName, funcAddress in pairs (idx) do Tercio@11: if (not SplitBarMetaFunctions [funcName]) then Tercio@11: SplitBarMetaFunctions [funcName] = function (object, ...) Tercio@20: local x = loadstring ( "return _G['"..object.statusbar:GetName().."']:"..funcName.."(...)") Tercio@11: return x (...) Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: end Tercio@11: Tercio@11: SplitBarObject.statusbar:SetHeight (h or 200) Tercio@11: SplitBarObject.statusbar:SetWidth (w or 14) Tercio@11: Tercio@11: SplitBarObject.statusbar.MyObject = SplitBarObject Tercio@11: Tercio@11: SplitBarObject.textleft = _G [name .. "_TextLeft"] Tercio@11: SplitBarObject.textright = _G [name .. "_TextRight"] Tercio@11: Tercio@11: SplitBarObject.iconleft = _G [name .. "_IconLeft"] Tercio@11: SplitBarObject.iconright = _G [name .. "_IconRight"] Tercio@11: Tercio@11: SplitBarObject.background = _G [name .. "_StatusBarBackground"] Tercio@11: SplitBarObject.texture = _G [name .. "_StatusBarTexture"] Tercio@11: Tercio@11: SplitBarObject.div = _G [name .. "_Spark"] Tercio@11: Tercio@11: Tercio@11: --> hooks Tercio@11: SplitBarObject.statusbar:SetScript ("OnEnter", OnEnter) Tercio@11: SplitBarObject.statusbar:SetScript ("OnLeave", OnLeave) Tercio@11: SplitBarObject.statusbar:SetScript ("OnHide", OnHide) Tercio@11: SplitBarObject.statusbar:SetScript ("OnShow", OnShow) Tercio@11: SplitBarObject.statusbar:SetScript ("OnMouseDown", OnMouseDown) Tercio@11: SplitBarObject.statusbar:SetScript ("OnMouseUp", OnMouseUp) Tercio@11: SplitBarObject.statusbar:SetScript ("OnSizeChanged", OnSizeChanged) Tercio@11: Tercio@11: _setmetatable (SplitBarObject, SplitBarMetaFunctions) Tercio@11: Tercio@11: return SplitBarObject Tercio@11: end