# HG changeset patch # User Tercio # Date 1441729009 10800 # Node ID dbd417f413a8f5a672e5c43b26efa83deea594ab # Parent 7fef991992f606c0bf220bb006d6d039c904e960 - framework update. diff -r 7fef991992f6 -r dbd417f413a8 Hansgar_And_Franzok_Assist.lua --- a/Hansgar_And_Franzok_Assist.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Hansgar_And_Franzok_Assist.lua Tue Sep 08 13:16:49 2015 -0300 @@ -19,7 +19,7 @@ --local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz", "Hansgar_And_Franzok_Assist", nil, "top", true) f:SetFrameStrata ("DIALOG") -f.version = "v0.15e" +f.version = "v0.15f" f.Close:SetScript ("OnClick", function (self) if (f.StampersPhase) then diff -r 7fef991992f6 -r dbd417f413a8 Libs/DF/button.lua --- a/Libs/DF/button.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/button.lua Tue Sep 08 13:16:49 2015 -0300 @@ -616,6 +616,14 @@ end end + if (button.MyObject.onenter_backdrop_border_color) then + button:SetBackdropBorderColor (unpack (button.MyObject.onenter_backdrop_border_color)) + end + + if (button.MyObject.onenter_backdrop) then + button:SetBackdropColor (unpack (button.MyObject.onenter_backdrop)) + end + if (button.MyObject.have_tooltip) then GameCooltip2:Preset (2) if (type (button.MyObject.have_tooltip) == "function") then @@ -625,13 +633,6 @@ end GameCooltip2:ShowCooltip (button, "tooltip") end - - local parent = button:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end end local OnLeave = function (button) @@ -665,18 +666,19 @@ end end + if (button.MyObject.onleave_backdrop_border_color) then + button:SetBackdropBorderColor (unpack (button.MyObject.onleave_backdrop_border_color)) + end + + if (button.MyObject.onleave_backdrop) then + button:SetBackdropColor (unpack (button.MyObject.onleave_backdrop)) + end + if (button.MyObject.have_tooltip) then if (GameCooltip2:GetText (1) == button.MyObject.have_tooltip or type (button.MyObject.have_tooltip) == "function") then GameCooltip2:Hide() end end - - local parent = button:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end end local OnHide = function (button) @@ -862,13 +864,65 @@ end ------------------------------------------------------------------------------------------------------------ + +function ButtonMetaFunctions:SetTemplate (template) + + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + self.onleave_backdrop = {r, g, b, a} + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.onentercolor) then + local r, g, b, a = DF:ParseColors (template.onentercolor) + self.onenter_backdrop = {r, g, b, a} + end + + if (template.onleavecolor) then + local r, g, b, a = DF:ParseColors (template.onleavecolor) + self.onleave_backdrop = {r, g, b, a} + end + + if (template.onenterbordercolor) then + local r, g, b, a = DF:ParseColors (template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + end + + if (template.onleavebordercolor) then + local r, g, b, a = DF:ParseColors (template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.icon) then + local i = template.icon + self:SetIcon (i.texture, i.width, i.height, i.layout, i.texcoord, i.color, i.textdistance, i.leftpadding) + end + +end + +------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method, text_template) - return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method, text_template) +function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method, button_template, text_template) + return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method, button_template, text_template) end -function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method, template) +function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method, button_template, text_template) if (not name) then name = "DetailsFrameworkButtonNumber" .. DF.ButtonCounter @@ -884,8 +938,7 @@ if (name:find ("$parent")) then name = name:gsub ("$parent", parent:GetName()) end - - + local ButtonObject = {type = "button", dframework = true} if (member) then @@ -917,7 +970,7 @@ ButtonObject.button = CreateFrame ("button", name, parent, "DetailsFrameworkButtonTemplate") ButtonObject.widget = ButtonObject.button - ButtonObject.button:SetBackdrop ({bgFile = DF.folder .. "background", tileSize = 64, edgeFile = DF.folder .. "border_2", edgeSize = 10, insets = {left = 1, right = 1, top = 1, bottom = 1}}) + --ButtonObject.button:SetBackdrop ({bgFile = DF.folder .. "background", tileSize = 64, edgeFile = DF.folder .. "border_2", edgeSize = 10, insets = {left = 1, right = 1, top = 1, bottom = 1}}) ButtonObject.button:SetBackdropColor (0, 0, 0, 0.4) ButtonObject.button:SetBackdropBorderColor (1, 1, 1, 1) @@ -934,6 +987,7 @@ end end + ButtonObject.button:SetWidth (w or 100) ButtonObject.button:SetHeight (h or 20) ButtonObject.button.MyObject = ButtonObject @@ -977,17 +1031,17 @@ ButtonObject.short_method = short_method - if (template) then - if (template.size) then - DF:SetFontSize (ButtonObject.button.text, template.size) + if (text_template) then + if (text_template.size) then + DF:SetFontSize (ButtonObject.button.text, text_template.size) end - if (template.color) then - local r, g, b, a = DF:ParseColors (template.color) + if (text_template.color) then + local r, g, b, a = DF:ParseColors (text_template.color) ButtonObject.button.text:SetTextColor (r, g, b, a) end - if (template.font) then + if (text_template.font) then local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - local font = SharedMedia:Fetch ("font", template.font) + local font = SharedMedia:Fetch ("font", text_template.font) DF:SetFontFace (ButtonObject.button.text, font) end end @@ -1002,6 +1056,10 @@ _setmetatable (ButtonObject, ButtonMetaFunctions) + if (button_template) then + ButtonObject:SetTemplate (button_template) + end + return ButtonObject end @@ -1029,21 +1087,23 @@ ColorPickerFrame:Hide() end -function DF:CreateColorPickButton (parent, name, member, callback, alpha) - return DF:NewColorPickButton (parent, name, member, callback, alpha) +function DF:CreateColorPickButton (parent, name, member, callback, alpha, button_template) + return DF:NewColorPickButton (parent, name, member, callback, alpha, button_template) end -function DF:NewColorPickButton (parent, name, member, callback, alpha) +function DF:NewColorPickButton (parent, name, member, callback, alpha, button_template) --button - local button = DF:NewButton (parent, _, name, member, color_button_width, color_button_height, pickcolor, alpha, "param2") - button:InstallCustomTexture() + local button = DF:NewButton (parent, _, name, member, color_button_width, color_button_height, pickcolor, alpha, "param2", nil, nil, nil, button_template) button.color_callback = callback button.Cancel = colorpick_cancel button.SetColor = set_colorpick_color - button:SetBackdrop ({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 6, - bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], insets = {left = 0, right = 0, top = 0, bottom = 0}}) + if (not button_template) then + button:InstallCustomTexture() + button:SetBackdrop ({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 6, + bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], insets = {left = 0, right = 0, top = 0, bottom = 0}}) + end --textura do fundo local background = DF:NewImage (button, nil, color_button_width, color_button_height, nil, nil, nil, "$parentBck") diff -r 7fef991992f6 -r dbd417f413a8 Libs/DF/dropdown.lua --- a/Libs/DF/dropdown.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/dropdown.lua Tue Sep 08 13:16:49 2015 -0300 @@ -329,7 +329,11 @@ end function DropDownMetaFunctions:NoOptionSelected() + if (self.no_options) then + return + end self.label:SetText (self.empty_text or "no option selected") + self.label:SetPoint ("left", self.icon, "right", 2, 0) self.label:SetTextColor (1, 1, 1, 0.4) if (self.empty_icon) then self.icon:SetTexture (self.empty_icon) @@ -348,6 +352,7 @@ self:SetAlpha (0.5) self.no_options = true self.label:SetText ("no options") + self.label:SetPoint ("left", self.icon, "right", 2, 0) self.label:SetTextColor (1, 1, 1, 0.4) self.icon:SetTexture ([[Interface\CHARACTERFRAME\UI-Player-PlayTimeUnhealthy]]) self.icon:SetTexCoord (0, 1, 0, 1) @@ -444,6 +449,7 @@ self.icon:SetVertexColor (1, 1, 1, 1) end + self.icon:SetSize (self:GetHeight()-2, self:GetHeight()-2) else self.label:SetPoint ("left", self.label:GetParent(), "left", 4, 0) end @@ -482,6 +488,7 @@ --> set the value of selected option in main object button.object.myvalue = button.table.value + button.object.myvaluelabel = button.table.label end function DropDownMetaFunctions:Open() @@ -563,6 +570,7 @@ local i = 1 local showing = 0 local currentText = button.text:GetText() or "" + local currentIndex if (object.OnMouseDownHook) then local interrupt = object.OnMouseDownHook (button, buttontype, menu, scrollFrame, scrollChild, selectedTexture) @@ -571,7 +579,7 @@ end end - for _, _table in ipairs (menu) do + for tindex, _table in ipairs (menu) do local show = isOptionVisible (_table) @@ -639,7 +647,10 @@ end selectedTexture:Show() - selectedTexture:SetVertexColor (1, 1, 1, .3); + selectedTexture:SetVertexColor (1, 1, 1, .3) + selectedTexture:SetTexCoord (0, 29/32, 5/32, 27/32) + + currentIndex = tindex currentText = nil end @@ -719,7 +730,12 @@ end end - object.scroll:SetValue (0) + if (object.myvaluelabel and currentIndex and scrollFrame.slider:IsShown()) then + object.scroll:SetValue (max ((currentIndex*20) - 80, 0)) + else + object.scroll:SetValue (0) + end + object:Open() else @@ -749,6 +765,10 @@ self:SetBackdropColor (.2, .2, .2, .2) end + if (self.MyObject.onenter_backdrop_border_color) then + self:SetBackdropBorderColor (unpack (self.MyObject.onenter_backdrop_border_color)) + end + self.arrowTexture2:Show() if (self.MyObject.have_tooltip) then @@ -763,14 +783,7 @@ GameCooltip2:SetOwner (self) GameCooltip2:ShowCooltip() end - - local parent = self:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end - + end function DetailsFrameworkDropDownOnLeave (self) @@ -787,18 +800,15 @@ self:SetBackdropColor (1, 1, 1, .5) end + if (self.MyObject.onleave_backdrop_border_color) then + self:SetBackdropBorderColor (unpack (self.MyObject.onleave_backdrop_border_color)) + end + self.arrowTexture2:Hide() if (self.MyObject.have_tooltip) then GameCooltip2:ShowMe (false) end - - local parent = self:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end end function DetailsFrameworkDropDownOnSizeChanged (self, w, h) @@ -836,13 +846,59 @@ end ------------------------------------------------------------------------------------------------------------ +function DropDownMetaFunctions:SetTemplate (template) + + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + self.onleave_backdrop = {r, g, b, a} + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.onentercolor) then + local r, g, b, a = DF:ParseColors (template.onentercolor) + self.onenter_backdrop = {r, g, b, a} + end + + if (template.onleavecolor) then + local r, g, b, a = DF:ParseColors (template.onleavecolor) + self.onleave_backdrop = {r, g, b, a} + end + + if (template.onenterbordercolor) then + local r, g, b, a = DF:ParseColors (template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + end + + if (template.onleavebordercolor) then + local r, g, b, a = DF:ParseColors (template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + end + +end + +------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateDropDown (parent, func, default, w, h, member, name) - return DF:NewDropDown (parent, parent, name, member, w, h, func, default) +function DF:CreateDropDown (parent, func, default, w, h, member, name, template) + return DF:NewDropDown (parent, parent, name, member, w, h, func, default, template) end -function DF:NewDropDown (parent, container, name, member, w, h, func, default) +function DF:NewDropDown (parent, container, name, member, w, h, func, default, template) if (not name) then name = "DetailsFrameworkDropDownNumber" .. DF.DropDownCounter @@ -959,6 +1015,10 @@ end end + if (template) then + DropDownObject:SetTemplate (template) + end + return DropDownObject end \ No newline at end of file diff -r 7fef991992f6 -r dbd417f413a8 Libs/DF/dropdown.xml --- a/Libs/DF/dropdown.xml Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/dropdown.xml Tue Sep 08 13:16:49 2015 -0300 @@ -119,8 +119,8 @@ - -