comparison Libs/DF/fw.lua @ 56:7c0f819a85c6 v7.3.5.056

- Framework update.
author Tercio
date Sun, 11 Mar 2018 10:50:12 -0300
parents 307f5af3ad02
children 0682d738499b
comparison
equal deleted inserted replaced
55:307f5af3ad02 56:7c0f819a85c6
1 1
2 local dversion = 62 2 local dversion = 68
3 local major, minor = "DetailsFramework-1.0", dversion 3 local major, minor = "DetailsFramework-1.0", dversion
4 local DF, oldminor = LibStub:NewLibrary (major, minor) 4 local DF, oldminor = LibStub:NewLibrary (major, minor)
5 5
6 if (not DF) then 6 if (not DF) then
7 DetailsFrameworkCanLoad = false 7 DetailsFrameworkCanLoad = false
997 end 997 end
998 998
999 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 999 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1000 --> templates 1000 --> templates
1001 1001
1002 DF.font_templates = {} 1002 --fonts
1003
1004 DF.font_templates = DF.font_templates or {}
1003 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"} 1005 DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
1004 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"} 1006 DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
1005 1007
1006 DF.dropdown_templates = {} 1008 -- dropdowns
1009
1010 DF.dropdown_templates = DF.dropdown_templates or {}
1007 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = { 1011 DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = {
1008 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, 1012 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
1009 backdropcolor = {1, 1, 1, .5}, 1013 backdropcolor = {1, 1, 1, .5},
1010 backdropbordercolor = {0, 0, 0, 1}, 1014 backdropbordercolor = {0, 0, 0, 1},
1011 onentercolor = {1, 1, 1, .5}, 1015 onentercolor = {1, 1, 1, .5},
1012 onenterbordercolor = {1, 1, 1, 1}, 1016 onenterbordercolor = {1, 1, 1, 1},
1013 } 1017 }
1014 1018
1015 DF.switch_templates = {} 1019 -- switches
1020
1021 DF.switch_templates = DF.switch_templates or {}
1016 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = { 1022 DF.switch_templates ["OPTIONS_CHECKBOX_TEMPLATE"] = {
1017 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, 1023 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
1018 backdropcolor = {1, 1, 1, .5}, 1024 backdropcolor = {1, 1, 1, .5},
1019 backdropbordercolor = {0, 0, 0, 1}, 1025 backdropbordercolor = {0, 0, 0, 1},
1020 width = 18, 1026 width = 18,
1032 enabled_backdropcolor = {1, 1, 1, .5}, 1038 enabled_backdropcolor = {1, 1, 1, .5},
1033 disabled_backdropcolor = {1, 1, 1, .5}, 1039 disabled_backdropcolor = {1, 1, 1, .5},
1034 onenterbordercolor = {1, 1, 1, 1}, 1040 onenterbordercolor = {1, 1, 1, 1},
1035 } 1041 }
1036 1042
1037 DF.button_templates = {} 1043 -- buttons
1044
1045 DF.button_templates = DF.button_templates or {}
1038 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = { 1046 DF.button_templates ["OPTIONS_BUTTON_TEMPLATE"] = {
1039 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, 1047 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
1040 backdropcolor = {1, 1, 1, .5}, 1048 backdropcolor = {1, 1, 1, .5},
1041 backdropbordercolor = {0, 0, 0, 1}, 1049 backdropbordercolor = {0, 0, 0, 1},
1042 } 1050 }
1043 1051
1044 DF.slider_templates = {} 1052 -- sliders
1053
1054 DF.slider_templates = DF.slider_templates or {}
1045 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = { 1055 DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
1046 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, 1056 backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
1047 backdropcolor = {1, 1, 1, .5}, 1057 backdropcolor = {1, 1, 1, .5},
1048 backdropbordercolor = {0, 0, 0, 1}, 1058 backdropbordercolor = {0, 0, 0, 1},
1049 onentercolor = {1, 1, 1, .5}, 1059 onentercolor = {1, 1, 1, .5},
1052 thumbwidth = 16, 1062 thumbwidth = 16,
1053 thumbheight = 14, 1063 thumbheight = 14,
1054 thumbcolor = {0, 0, 0, 0.5}, 1064 thumbcolor = {0, 0, 0, 0.5},
1055 } 1065 }
1056 1066
1057 function DF:InstallTemplate (widget_type, template_name, template) 1067 function DF:InstallTemplate (widget_type, template_name, template, parent_name)
1068
1069 local newTemplate = {}
1070
1071 --if has a parent, just copy the parent to the new template
1072 if (parent_name and type (parent_name) == "string") then
1073 local parentTemplate = DF:GetTemplate (widget_type, parent_name)
1074 if (parentTemplate) then
1075 DF.table.copy (newTemplate, parentTemplate)
1076 end
1077 end
1078
1079 --copy the template passed into the new template
1080 DF.table.copy (newTemplate, template)
1081
1058 widget_type = string.lower (widget_type) 1082 widget_type = string.lower (widget_type)
1059 1083
1060 local template_table 1084 local template_table
1061 if (widget_type == "font") then 1085 if (widget_type == "font") then
1062 template_table = DF.font_templates 1086 template_table = DF.font_templates
1068 template_table = DF.switch_templates 1092 template_table = DF.switch_templates
1069 elseif (widget_type == "slider") then 1093 elseif (widget_type == "slider") then
1070 template_table = DF.slider_templates 1094 template_table = DF.slider_templates
1071 end 1095 end
1072 1096
1073 template_table [template_name] = template 1097 template_table [template_name] = newTemplate
1074 1098
1075 return template 1099 return newTemplate
1076 end 1100 end
1077 1101
1078 function DF:GetTemplate (widget_type, template_name) 1102 function DF:GetTemplate (widget_type, template_name)
1079 widget_type = string.lower (widget_type) 1103 widget_type = string.lower (widget_type)
1080 1104