annotate Libs/DF/dropdown.lua @ 22:dbd417f413a8

- framework update.
author Tercio
date Tue, 08 Sep 2015 13:16:49 -0300
parents dc1c77254f80
children 5da06cb420d4
rev   line source
Tercio@11 1
Tercio@11 2 local DF = _G ["DetailsFramework"]
Tercio@20 3 if (not DF or not DetailsFrameworkCanLoad) then
Tercio@20 4 return
Tercio@20 5 end
Tercio@20 6
Tercio@11 7 local _
Tercio@11 8 local _rawset = rawset --> lua local
Tercio@11 9 local _rawget = rawget --> lua local
Tercio@11 10 local _setmetatable = setmetatable --> lua local
Tercio@11 11 local _unpack = unpack --> lua local
Tercio@11 12 local _type = type --> lua local
Tercio@11 13 local _math_floor = math.floor --> lua local
Tercio@11 14 local loadstring = loadstring --> lua local
Tercio@11 15 local _string_len = string.len --> lua local
Tercio@11 16
Tercio@11 17 local cleanfunction = function() end
Tercio@11 18 local APIDropDownFunctions = false
Tercio@11 19 local DropDownMetaFunctions = {}
Tercio@11 20
Tercio@11 21 ------------------------------------------------------------------------------------------------------------
Tercio@11 22 --> metatables
Tercio@11 23
Tercio@11 24 DropDownMetaFunctions.__call = function (_table, value)
Tercio@11 25 --> unknow
Tercio@11 26 end
Tercio@11 27
Tercio@11 28 ------------------------------------------------------------------------------------------------------------
Tercio@11 29 --> members
Tercio@11 30
Tercio@11 31 --> selected value
Tercio@11 32 local gmember_value = function (_object)
Tercio@11 33 return _object:GetValue()
Tercio@11 34 end
Tercio@11 35 --> tooltip
Tercio@11 36 local gmember_tooltip = function (_object)
Tercio@11 37 return _object:GetTooltip()
Tercio@11 38 end
Tercio@11 39 --> shown
Tercio@11 40 local gmember_shown = function (_object)
Tercio@11 41 return _object:IsShown()
Tercio@11 42 end
Tercio@11 43 --> frame width
Tercio@11 44 local gmember_width = function (_object)
Tercio@11 45 return _object.button:GetWidth()
Tercio@11 46 end
Tercio@11 47 --> frame height
Tercio@11 48 local gmember_height = function (_object)
Tercio@11 49 return _object.button:GetHeight()
Tercio@11 50 end
Tercio@11 51 --> current text
Tercio@11 52 local gmember_text = function (_object)
Tercio@11 53 return _object.label:GetText()
Tercio@11 54 end
Tercio@11 55 --> menu creation function
Tercio@11 56 local gmember_function = function (_object)
Tercio@11 57 return _object:GetFunction()
Tercio@11 58 end
Tercio@11 59 --> menu width
Tercio@11 60 local gmember_menuwidth = function (_object)
Tercio@11 61 return _rawget (self, "realsizeW")
Tercio@11 62 end
Tercio@11 63 --> menu height
Tercio@11 64 local gmember_menuheight = function (_object)
Tercio@11 65 return _rawget (self, "realsizeH")
Tercio@11 66 end
Tercio@11 67
Tercio@11 68 local get_members_function_index = {
Tercio@11 69 ["value"] = gmember_value,
Tercio@11 70 ["text"] = gmember_text,
Tercio@11 71 ["shown"] = gmember_shown,
Tercio@11 72 ["width"] = gmember_width,
Tercio@11 73 ["menuwidth"] = gmember_menuwidth,
Tercio@11 74 ["height"] = gmember_height,
Tercio@11 75 ["menuheight"] = gmember_menuheight,
Tercio@11 76 ["tooltip"] = gmember_tooltip,
Tercio@11 77 ["func"] = gmember_function,
Tercio@11 78 }
Tercio@11 79
Tercio@11 80 DropDownMetaFunctions.__index = function (_table, _member_requested)
Tercio@11 81
Tercio@11 82 local func = get_members_function_index [_member_requested]
Tercio@11 83 if (func) then
Tercio@11 84 return func (_table, _member_requested)
Tercio@11 85 end
Tercio@11 86
Tercio@11 87 local fromMe = _rawget (_table, _member_requested)
Tercio@11 88 if (fromMe) then
Tercio@11 89 return fromMe
Tercio@11 90 end
Tercio@11 91
Tercio@11 92 return DropDownMetaFunctions [_member_requested]
Tercio@11 93 end
Tercio@11 94
Tercio@11 95 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tercio@11 96
Tercio@11 97 --> tooltip
Tercio@11 98 local smember_tooltip = function (_object, _value)
Tercio@11 99 return _object:SetTooltip (_value)
Tercio@11 100 end
Tercio@11 101 --> show
Tercio@11 102 local smember_show = function (_object, _value)
Tercio@11 103 if (_value) then
Tercio@11 104 return _object:Show()
Tercio@11 105 else
Tercio@11 106 return _object:Hide()
Tercio@11 107 end
Tercio@11 108 end
Tercio@11 109 --> hide
Tercio@11 110 local smember_hide = function (_object, _value)
Tercio@11 111 if (not _value) then
Tercio@11 112 return _object:Show()
Tercio@11 113 else
Tercio@11 114 return _object:Hide()
Tercio@11 115 end
Tercio@11 116 end
Tercio@11 117 --> frame width
Tercio@11 118 local smember_width = function (_object, _value)
Tercio@11 119 return _object.dropdown:SetWidth (_value)
Tercio@11 120 end
Tercio@11 121 --> frame height
Tercio@11 122 local smember_height = function (_object, _value)
Tercio@11 123 return _object.dropdown:SetHeight (_value)
Tercio@11 124 end
Tercio@11 125 --> menu creation function
Tercio@11 126 local smember_function = function (_object, _value)
Tercio@11 127 return _object:SetFunction (_value)
Tercio@11 128 end
Tercio@11 129 --> menu width
Tercio@11 130 local smember_menuwidth = function (_object, _value)
Tercio@11 131 _object:SetMenuSize (_value, nil)
Tercio@11 132 end
Tercio@11 133 --> menu height
Tercio@11 134 local smember_menuheight = function (_object, _value)
Tercio@11 135 _object:SetMenuSize (nil, _value)
Tercio@11 136 end
Tercio@11 137
Tercio@11 138 local set_members_function_index = {
Tercio@11 139 ["tooltip"] = smember_tooltip,
Tercio@11 140 ["show"] = smember_show,
Tercio@11 141 ["hide"] = smember_hide,
Tercio@11 142 ["width"] = smember_width,
Tercio@11 143 ["menuwidth"] = smember_menuwidth,
Tercio@11 144 ["height"] = smember_height,
Tercio@11 145 ["menuheight"] = smember_menuheight,
Tercio@11 146 ["func"] = smember_function,
Tercio@11 147 }
Tercio@11 148
Tercio@11 149 DropDownMetaFunctions.__newindex = function (_table, _key, _value)
Tercio@11 150 local func = set_members_function_index [_key]
Tercio@11 151 if (func) then
Tercio@11 152 return func (_table, _value)
Tercio@11 153 else
Tercio@11 154 return _rawset (_table, _key, _value)
Tercio@11 155 end
Tercio@11 156 end
Tercio@11 157
Tercio@11 158 ------------------------------------------------------------------------------------------------------------
Tercio@11 159 --> methods
Tercio@11 160 function DropDownMetaFunctions:IsShown()
Tercio@11 161 return self.dropdown:IsShown()
Tercio@11 162 end
Tercio@11 163 function DropDownMetaFunctions:Show()
Tercio@11 164 return self.dropdown:Show()
Tercio@11 165 end
Tercio@11 166 function DropDownMetaFunctions:Hide()
Tercio@11 167 return self.dropdown:Hide()
Tercio@11 168 end
Tercio@11 169
Tercio@11 170 --> menu width and height
Tercio@11 171 function DropDownMetaFunctions:SetMenuSize (w, h)
Tercio@11 172 if (w) then
Tercio@11 173 return _rawset (self, "realsizeW", w)
Tercio@11 174 end
Tercio@11 175 if (h) then
Tercio@11 176 return _rawset (self, "realsizeH", h)
Tercio@11 177 end
Tercio@11 178 end
Tercio@11 179 function DropDownMetaFunctions:GetMenuSize()
Tercio@11 180 return _rawget (self, "realsizeW"), _rawget (self, "realsizeH")
Tercio@11 181 end
Tercio@11 182
Tercio@11 183 --> function
Tercio@11 184 function DropDownMetaFunctions:SetFunction (func)
Tercio@11 185 return _rawset (self, "func", func)
Tercio@11 186 end
Tercio@11 187 function DropDownMetaFunctions:GetFunction()
Tercio@11 188 return _rawget (self, "func")
Tercio@11 189 end
Tercio@11 190
Tercio@11 191 --> value
Tercio@11 192 function DropDownMetaFunctions:GetValue()
Tercio@11 193 return _rawget (self, "myvalue")
Tercio@11 194 end
Tercio@11 195 function DropDownMetaFunctions:SetValue (value)
Tercio@11 196 return _rawset (self, "myvalue", value)
Tercio@11 197 end
Tercio@11 198
Tercio@11 199 --> setpoint
Tercio@11 200 function DropDownMetaFunctions:SetPoint (v1, v2, v3, v4, v5)
Tercio@11 201 v1, v2, v3, v4, v5 = DF:CheckPoints (v1, v2, v3, v4, v5, self)
Tercio@11 202 if (not v1) then
Tercio@11 203 print ("Invalid parameter for SetPoint")
Tercio@11 204 return
Tercio@11 205 end
Tercio@11 206 return self.widget:SetPoint (v1, v2, v3, v4, v5)
Tercio@11 207 end
Tercio@11 208
Tercio@11 209 --> sizes
Tercio@11 210 function DropDownMetaFunctions:SetSize (w, h)
Tercio@11 211 if (w) then
Tercio@11 212 self.dropdown:SetWidth (w)
Tercio@11 213 end
Tercio@11 214 if (h) then
Tercio@11 215 return self.dropdown:SetHeight (h)
Tercio@11 216 end
Tercio@11 217 end
Tercio@11 218
Tercio@11 219 --> tooltip
Tercio@11 220 function DropDownMetaFunctions:SetTooltip (tooltip)
Tercio@11 221 if (tooltip) then
Tercio@11 222 return _rawset (self, "have_tooltip", tooltip)
Tercio@11 223 else
Tercio@11 224 return _rawset (self, "have_tooltip", nil)
Tercio@11 225 end
Tercio@11 226 end
Tercio@11 227 function DropDownMetaFunctions:GetTooltip()
Tercio@11 228 return _rawget (self, "have_tooltip")
Tercio@11 229 end
Tercio@11 230
Tercio@11 231 --> frame levels
Tercio@11 232 function DropDownMetaFunctions:GetFrameLevel()
Tercio@11 233 return self.dropdown:GetFrameLevel()
Tercio@11 234 end
Tercio@11 235 function DropDownMetaFunctions:SetFrameLevel (level, frame)
Tercio@11 236 if (not frame) then
Tercio@11 237 return self.dropdown:SetFrameLevel (level)
Tercio@11 238 else
Tercio@11 239 local framelevel = frame:GetFrameLevel (frame) + level
Tercio@11 240 return self.dropdown:SetFrameLevel (framelevel)
Tercio@11 241 end
Tercio@11 242 end
Tercio@11 243
Tercio@11 244 --> frame stratas
Tercio@11 245 function DropDownMetaFunctions:GetFrameStrata()
Tercio@11 246 return self.dropdown:GetFrameStrata()
Tercio@11 247 end
Tercio@11 248 function DropDownMetaFunctions:SetFrameStrata (strata)
Tercio@11 249 if (_type (strata) == "table") then
Tercio@11 250 self.dropdown:SetFrameStrata (strata:GetFrameStrata())
Tercio@11 251 else
Tercio@11 252 self.dropdown:SetFrameStrata (strata)
Tercio@11 253 end
Tercio@11 254 end
Tercio@11 255
Tercio@11 256 --> enabled
Tercio@11 257 function DropDownMetaFunctions:IsEnabled()
Tercio@11 258 return self.dropdown:IsEnabled()
Tercio@11 259 end
Tercio@11 260
Tercio@11 261 function DropDownMetaFunctions:Enable()
Tercio@11 262
Tercio@11 263 self:SetAlpha (1)
Tercio@11 264 _rawset (self, "lockdown", false)
Tercio@11 265
Tercio@11 266 if (self.OnEnable) then
Tercio@11 267 self.OnEnable (self)
Tercio@11 268 end
Tercio@11 269 --return self.dropdown:Enable()
Tercio@11 270 end
Tercio@11 271
Tercio@11 272 function DropDownMetaFunctions:Disable()
Tercio@11 273
Tercio@11 274 self:SetAlpha (.4)
Tercio@11 275 _rawset (self, "lockdown", true)
Tercio@11 276
Tercio@11 277 if (self.OnDisable) then
Tercio@11 278 self.OnDisable (self)
Tercio@11 279 end
Tercio@11 280 --return self.dropdown:Disable()
Tercio@11 281 end
Tercio@11 282
Tercio@11 283 --> fixed value
Tercio@11 284 function DropDownMetaFunctions:SetFixedParameter (value)
Tercio@11 285 _rawset (self, "FixedValue", value)
Tercio@11 286 end
Tercio@11 287
Tercio@11 288 --> hooks
Tercio@11 289 function DropDownMetaFunctions:SetHook (hookType, func)
Tercio@11 290 if (func) then
Tercio@11 291 _rawset (self, hookType.."Hook", func)
Tercio@11 292 else
Tercio@11 293 _rawset (self, hookType.."Hook", nil)
Tercio@11 294 end
Tercio@11 295 end
Tercio@11 296
Tercio@11 297 ------------------------------------------------------------------------------------------------------------
Tercio@11 298 --> scripts
Tercio@11 299
Tercio@11 300 local last_opened = false
Tercio@11 301
Tercio@11 302 local function isOptionVisible (thisOption)
Tercio@11 303 if (_type (thisOption.shown) == "boolean" or _type (thisOption.shown) == "function") then
Tercio@11 304 if (not thisOption.shown) then
Tercio@11 305 return false
Tercio@11 306 elseif (not thisOption.shown()) then
Tercio@11 307 return false
Tercio@11 308 end
Tercio@11 309 end
Tercio@11 310 return true
Tercio@11 311 end
Tercio@11 312
Tercio@11 313 function DropDownMetaFunctions:Refresh()
Tercio@11 314 local menu = self.func()
Tercio@11 315
Tercio@11 316 if (#menu == 0) then
Tercio@11 317 self:NoOption (true)
Tercio@11 318 self.no_options = true
Tercio@11 319 return false
Tercio@11 320
Tercio@11 321 elseif (self.no_options) then
Tercio@11 322 self.no_options = false
Tercio@11 323 self:NoOption (false)
Tercio@11 324 self:NoOptionSelected()
Tercio@11 325 return true
Tercio@11 326 end
Tercio@11 327
Tercio@11 328 return true
Tercio@11 329 end
Tercio@11 330
Tercio@11 331 function DropDownMetaFunctions:NoOptionSelected()
Tercio@22 332 if (self.no_options) then
Tercio@22 333 return
Tercio@22 334 end
Tercio@11 335 self.label:SetText (self.empty_text or "no option selected")
Tercio@22 336 self.label:SetPoint ("left", self.icon, "right", 2, 0)
Tercio@11 337 self.label:SetTextColor (1, 1, 1, 0.4)
Tercio@11 338 if (self.empty_icon) then
Tercio@11 339 self.icon:SetTexture (self.empty_icon)
Tercio@11 340 else
Tercio@11 341 self.icon:SetTexture ([[Interface\COMMON\UI-ModelControlPanel]])
Tercio@11 342 self.icon:SetTexCoord (0.625, 0.78125, 0.328125, 0.390625)
Tercio@11 343 end
Tercio@11 344 self.icon:SetVertexColor (1, 1, 1, 0.4)
Tercio@11 345
Tercio@11 346 self.last_select = nil
Tercio@11 347 end
Tercio@11 348
Tercio@11 349 function DropDownMetaFunctions:NoOption (state)
Tercio@11 350 if (state) then
Tercio@11 351 self:Disable()
Tercio@11 352 self:SetAlpha (0.5)
Tercio@11 353 self.no_options = true
Tercio@11 354 self.label:SetText ("no options")
Tercio@22 355 self.label:SetPoint ("left", self.icon, "right", 2, 0)
Tercio@11 356 self.label:SetTextColor (1, 1, 1, 0.4)
Tercio@11 357 self.icon:SetTexture ([[Interface\CHARACTERFRAME\UI-Player-PlayTimeUnhealthy]])
Tercio@11 358 self.icon:SetTexCoord (0, 1, 0, 1)
Tercio@11 359 self.icon:SetVertexColor (1, 1, 1, 0.4)
Tercio@11 360 else
Tercio@11 361 self.no_options = false
Tercio@11 362 self:Enable()
Tercio@11 363 self:SetAlpha (1)
Tercio@11 364 end
Tercio@11 365 end
Tercio@11 366
Tercio@11 367 function DropDownMetaFunctions:Select (optionName, byOptionNumber)
Tercio@11 368
Tercio@11 369 if (type (optionName) == "boolean" and not optionName) then
Tercio@11 370 self:NoOptionSelected()
Tercio@11 371 return false
Tercio@11 372 end
Tercio@11 373
Tercio@11 374 local menu = self.func()
Tercio@11 375
Tercio@11 376 if (#menu == 0) then
Tercio@11 377 self:NoOption (true)
Tercio@11 378 return true
Tercio@11 379 else
Tercio@11 380 self:NoOption (false)
Tercio@11 381 end
Tercio@11 382
Tercio@11 383 if (byOptionNumber and type (optionName) == "number") then
Tercio@11 384 if (not menu [optionName]) then --> invalid index
Tercio@11 385 self:NoOptionSelected()
Tercio@11 386 return false
Tercio@11 387 end
Tercio@11 388 self:Selected (menu [optionName])
Tercio@11 389 return true
Tercio@11 390 end
Tercio@11 391
Tercio@11 392 for _, thisMenu in ipairs (menu) do
Tercio@11 393 if ( ( thisMenu.label == optionName or thisMenu.value == optionName ) and isOptionVisible (thisMenu)) then
Tercio@11 394 self:Selected (thisMenu)
Tercio@11 395 return true
Tercio@11 396 end
Tercio@11 397 end
Tercio@11 398
Tercio@11 399 return false
Tercio@11 400 end
Tercio@11 401
Tercio@11 402 function DropDownMetaFunctions:SetEmptyTextAndIcon (text, icon)
Tercio@11 403 if (text) then
Tercio@11 404 self.empty_text = text
Tercio@11 405 end
Tercio@11 406 if (icon) then
Tercio@11 407 self.empty_icon = icon
Tercio@11 408 end
Tercio@11 409
Tercio@11 410 self:Selected (self.last_select)
Tercio@11 411 end
Tercio@11 412
Tercio@11 413 function DropDownMetaFunctions:Selected (_table)
Tercio@11 414
Tercio@11 415 if (not _table) then
Tercio@11 416
Tercio@11 417 --> there is any options?
Tercio@11 418 if (not self:Refresh()) then
Tercio@11 419 self.last_select = nil
Tercio@11 420 return
Tercio@11 421 end
Tercio@11 422
Tercio@11 423 --> exists options but none selected
Tercio@11 424 self:NoOptionSelected()
Tercio@11 425 return
Tercio@11 426 end
Tercio@11 427
Tercio@11 428 self.last_select = _table
Tercio@11 429 self:NoOption (false)
Tercio@11 430
Tercio@11 431 self.label:SetText (_table.label)
Tercio@11 432 self.icon:SetTexture (_table.icon)
Tercio@11 433
Tercio@11 434 if (_table.icon) then
Tercio@11 435 self.label:SetPoint ("left", self.icon, "right", 2, 0)
Tercio@11 436 if (_table.texcoord) then
Tercio@11 437 self.icon:SetTexCoord (unpack (_table.texcoord))
Tercio@11 438 else
Tercio@11 439 self.icon:SetTexCoord (0, 1, 0, 1)
Tercio@11 440 end
Tercio@11 441
Tercio@11 442 if (_table.iconcolor) then
Tercio@11 443 if (type (_table.iconcolor) == "string") then
Tercio@11 444 self.icon:SetVertexColor (DF:ParseColors (_table.iconcolor))
Tercio@11 445 else
Tercio@11 446 self.icon:SetVertexColor (unpack (_table.iconcolor))
Tercio@11 447 end
Tercio@11 448 else
Tercio@11 449 self.icon:SetVertexColor (1, 1, 1, 1)
Tercio@11 450 end
Tercio@11 451
Tercio@22 452 self.icon:SetSize (self:GetHeight()-2, self:GetHeight()-2)
Tercio@11 453 else
Tercio@11 454 self.label:SetPoint ("left", self.label:GetParent(), "left", 4, 0)
Tercio@11 455 end
Tercio@11 456
Tercio@11 457 self.statusbar:SetTexture (_table.statusbar)
Tercio@11 458
Tercio@11 459 if (_table.color) then
Tercio@11 460 local _value1, _value2, _value3, _value4 = DF:ParseColors (_table.color)
Tercio@11 461 self.label:SetTextColor (_value1, _value2, _value3, _value4)
Tercio@11 462 else
Tercio@11 463 self.label:SetTextColor (1, 1, 1, 1)
Tercio@11 464 end
Tercio@11 465
Tercio@11 466 if (_table.font) then
Tercio@11 467 self.label:SetFont (_table.font, 10)
Tercio@11 468 else
Tercio@11 469 self.label:SetFont ("GameFontHighlightSmall", 10)
Tercio@11 470 end
Tercio@11 471
Tercio@11 472 self:SetValue (_table.value)
Tercio@11 473
Tercio@11 474 end
Tercio@11 475
Tercio@11 476 function DetailsFrameworkDropDownOptionClick (button)
Tercio@11 477
Tercio@11 478 --> update name and icon on main frame
Tercio@11 479 button.object:Selected (button.table)
Tercio@11 480
Tercio@11 481 --> close menu frame
Tercio@11 482 button.object:Close()
Tercio@11 483
Tercio@11 484 --> exec function if any
Tercio@11 485 if (button.table.onclick) then
Tercio@11 486 button.table.onclick (button:GetParent():GetParent():GetParent().MyObject, button.object.FixedValue, button.table.value)
Tercio@11 487 end
Tercio@11 488
Tercio@11 489 --> set the value of selected option in main object
Tercio@11 490 button.object.myvalue = button.table.value
Tercio@22 491 button.object.myvaluelabel = button.table.label
Tercio@11 492 end
Tercio@11 493
Tercio@11 494 function DropDownMetaFunctions:Open()
Tercio@11 495 self.dropdown.dropdownframe:Show()
Tercio@11 496 self.dropdown.dropdownborder:Show()
Tercio@11 497 self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down")
Tercio@11 498 self.opened = true
Tercio@11 499 if (last_opened) then
Tercio@11 500 last_opened:Close()
Tercio@11 501 end
Tercio@11 502 last_opened = self
Tercio@11 503 end
Tercio@11 504
Tercio@11 505 function DropDownMetaFunctions:Close()
Tercio@11 506 --> when menu is being close, just hide the border and the script will call back this again
Tercio@11 507 if (self.dropdown.dropdownborder:IsShown()) then
Tercio@11 508 self.dropdown.dropdownborder:Hide()
Tercio@11 509 return
Tercio@11 510 end
Tercio@11 511 self.dropdown.dropdownframe:Hide()
Tercio@11 512 self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up")
Tercio@11 513
Tercio@11 514 local selectedTexture = _G [self:GetName() .. "_ScrollFrame_ScrollChild_SelectedTexture"]
Tercio@11 515 selectedTexture:Hide()
Tercio@11 516
Tercio@11 517 self.opened = false
Tercio@11 518 last_opened = false
Tercio@11 519 end
Tercio@11 520
Tercio@11 521 --> close by escape key
Tercio@11 522 function DetailsFrameworkDropDownOptionsFrameOnHide (frame)
Tercio@11 523 frame:GetParent().MyObject:Close()
Tercio@11 524 end
Tercio@11 525
Tercio@11 526 function DetailsFrameworkDropDownOptionOnEnter (frame)
Tercio@11 527 if (frame.table.desc) then
Tercio@17 528 GameCooltip2:Preset (2)
Tercio@11 529 GameCooltip2:AddLine (frame.table.desc)
Tercio@11 530 if (frame.table.descfont) then
Tercio@11 531 GameCooltip2:SetOption ("TextFont", frame.table.descfont)
Tercio@11 532 end
Tercio@11 533
Tercio@11 534 GameCooltip2:SetHost (frame, "topleft", "topright", 10, 0)
Tercio@11 535
Tercio@11 536 GameCooltip2:ShowCooltip (nil, "tooltip")
Tercio@11 537 frame.tooltip = true
Tercio@11 538 end
Tercio@11 539 frame:GetParent().mouseover:SetPoint ("left", frame)
Tercio@11 540 frame:GetParent().mouseover:Show()
Tercio@11 541 end
Tercio@11 542
Tercio@11 543 function DetailsFrameworkDropDownOptionOnLeave (frame)
Tercio@11 544 if (frame.table.desc) then
Tercio@11 545 GameCooltip2:ShowMe (false)
Tercio@11 546 end
Tercio@11 547 frame:GetParent().mouseover:Hide()
Tercio@11 548 end
Tercio@11 549
Tercio@11 550 function DetailsFrameworkDropDownOnMouseDown (button)
Tercio@11 551
Tercio@11 552 local object = button.MyObject
Tercio@11 553
Tercio@11 554 if (not object.opened and not _rawget (object, "lockdown")) then --> click to open
Tercio@11 555
Tercio@11 556 local menu = object:func()
Tercio@11 557 object.builtMenu = menu
Tercio@11 558
Tercio@11 559 local frame_witdh = object.realsizeW
Tercio@11 560
Tercio@11 561 if (menu [1]) then
Tercio@11 562 --> build menu
Tercio@11 563
Tercio@11 564 local scrollFrame = _G [button:GetName() .. "_ScrollFrame"]
Tercio@11 565 local scrollChild = _G [button:GetName() .. "_ScrollFrame_ScrollChild"]
Tercio@11 566 local scrollBorder = _G [button:GetName() .. "_Border"]
Tercio@11 567 local selectedTexture = _G [button:GetName() .. "_ScrollFrame_ScrollChild_SelectedTexture"]
Tercio@11 568 local mouseOverTexture = _G [button:GetName() .. "_ScrollFrame_ScrollChild_MouseOverTexture"]
Tercio@11 569
Tercio@11 570 local i = 1
Tercio@11 571 local showing = 0
Tercio@11 572 local currentText = button.text:GetText() or ""
Tercio@22 573 local currentIndex
Tercio@11 574
Tercio@11 575 if (object.OnMouseDownHook) then
Tercio@11 576 local interrupt = object.OnMouseDownHook (button, buttontype, menu, scrollFrame, scrollChild, selectedTexture)
Tercio@11 577 if (interrupt) then
Tercio@11 578 return
Tercio@11 579 end
Tercio@11 580 end
Tercio@11 581
Tercio@22 582 for tindex, _table in ipairs (menu) do
Tercio@11 583
Tercio@11 584 local show = isOptionVisible (_table)
Tercio@11 585
Tercio@11 586 if (show) then
Tercio@11 587 local _this_row = object.menus [i]
Tercio@11 588 showing = showing + 1
Tercio@11 589
Tercio@11 590 if (not _this_row) then
Tercio@11 591
Tercio@11 592 local name = button:GetName() .. "Row" .. i
Tercio@11 593 local parent = scrollChild
Tercio@11 594
Tercio@11 595 _this_row = CreateFrame ("Button", name, parent, "DetailsFrameworkDropDownOptionTemplate")
Tercio@11 596 local anchor_i = i-1
Tercio@11 597 _this_row:SetPoint ("topleft", parent, "topleft", 5, (-anchor_i*20)-5)
Tercio@11 598 _this_row:SetPoint ("topright", parent, "topright", -5, (-anchor_i*20)-5)
Tercio@11 599 _this_row.object = object
Tercio@11 600 object.menus [i] = _this_row
Tercio@11 601 end
Tercio@11 602
Tercio@11 603 _this_row.icon:SetTexture (_table.icon)
Tercio@11 604 if (_table.icon) then
Tercio@11 605
Tercio@11 606 _this_row.label:SetPoint ("left", _this_row.icon, "right", 5, 0)
Tercio@11 607
Tercio@11 608 if (_table.texcoord) then
Tercio@11 609 _this_row.icon:SetTexCoord (unpack (_table.texcoord))
Tercio@11 610 else
Tercio@11 611 _this_row.icon:SetTexCoord (0, 1, 0, 1)
Tercio@11 612 end
Tercio@11 613
Tercio@11 614 if (_table.iconcolor) then
Tercio@11 615 if (type (_table.iconcolor) == "string") then
Tercio@11 616 _this_row.icon:SetVertexColor (DF:ParseColors (_table.iconcolor))
Tercio@11 617 else
Tercio@11 618 _this_row.icon:SetVertexColor (unpack (_table.iconcolor))
Tercio@11 619 end
Tercio@11 620 else
Tercio@11 621 _this_row.icon:SetVertexColor (1, 1, 1, 1)
Tercio@11 622 end
Tercio@11 623 else
Tercio@11 624 _this_row.label:SetPoint ("left", _this_row.statusbar, "left", 2, 0)
Tercio@11 625 end
Tercio@11 626
Tercio@11 627 if (_table.iconsize) then
Tercio@11 628 _this_row.icon:SetSize (_table.iconsize[1], _table.iconsize[2])
Tercio@11 629 else
Tercio@11 630 _this_row.icon:SetSize (20, 20)
Tercio@11 631 end
Tercio@11 632
Tercio@11 633 if (_table.font) then
Tercio@11 634 _this_row.label:SetFont (_table.font, 10.5)
Tercio@11 635 else
Tercio@11 636 _this_row.label:SetFont ("GameFontHighlightSmall", 10.5)
Tercio@11 637 end
Tercio@11 638
Tercio@11 639 _this_row.statusbar:SetTexture (_table.statusbar)
Tercio@11 640 _this_row.label:SetText (_table.label)
Tercio@11 641
Tercio@11 642 if (currentText and currentText == _table.label) then
Tercio@11 643 if (_table.icon) then
Tercio@11 644 selectedTexture:SetPoint ("left", _this_row.icon, "left", -3, 0)
Tercio@11 645 else
Tercio@11 646 selectedTexture:SetPoint ("left", _this_row.statusbar, "left", 0, 0)
Tercio@11 647 end
Tercio@11 648
Tercio@11 649 selectedTexture:Show()
Tercio@22 650 selectedTexture:SetVertexColor (1, 1, 1, .3)
Tercio@22 651 selectedTexture:SetTexCoord (0, 29/32, 5/32, 27/32)
Tercio@22 652
Tercio@22 653 currentIndex = tindex
Tercio@11 654 currentText = nil
Tercio@11 655 end
Tercio@11 656
Tercio@11 657 if (_table.color) then
Tercio@11 658 local _value1, _value2, _value3, _value4 = DF:ParseColors (_table.color)
Tercio@11 659 _this_row.label:SetTextColor (_value1, _value2, _value3, _value4)
Tercio@11 660 else
Tercio@11 661 _this_row.label:SetTextColor (1, 1, 1, 1)
Tercio@11 662 end
Tercio@11 663
Tercio@11 664 _this_row.table = _table
Tercio@11 665
Tercio@11 666 local labelwitdh = _this_row.label:GetStringWidth()
Tercio@11 667 if (labelwitdh+40 > frame_witdh) then
Tercio@11 668 frame_witdh = labelwitdh+40
Tercio@11 669 end
Tercio@11 670 _this_row:Show()
Tercio@11 671
Tercio@11 672 i = i + 1
Tercio@11 673 end
Tercio@11 674
Tercio@11 675 end
Tercio@11 676
Tercio@11 677 if (currentText) then
Tercio@11 678 selectedTexture:Hide()
Tercio@11 679 else
Tercio@11 680 selectedTexture:SetWidth (frame_witdh-20)
Tercio@11 681 end
Tercio@11 682
Tercio@11 683 for i = showing+1, #object.menus do
Tercio@11 684 object.menus [i]:Hide()
Tercio@11 685 end
Tercio@11 686
Tercio@11 687 local size = object.realsizeH
Tercio@11 688
Tercio@11 689 if (showing*20 > size) then
Tercio@11 690 --show scrollbar and setup scroll
Tercio@11 691 object:ShowScroll()
Tercio@11 692 scrollFrame:EnableMouseWheel (true)
Tercio@11 693 object.scroll:Altura (size-35)
Tercio@11 694 object.scroll:SetMinMaxValues (0, (showing*20) - size + 20)
Tercio@11 695 --width
Tercio@11 696 scrollBorder:SetWidth (frame_witdh+20)
Tercio@11 697 scrollFrame:SetWidth (frame_witdh+20)
Tercio@11 698 scrollChild:SetWidth (frame_witdh+20)
Tercio@11 699 --height
Tercio@11 700 scrollBorder:SetHeight (size+20)
Tercio@11 701 scrollFrame:SetHeight (size)
Tercio@11 702 scrollChild:SetHeight ((showing*20)+20)
Tercio@11 703 --mouse over texture
Tercio@11 704 mouseOverTexture:SetWidth (frame_witdh-7)
Tercio@11 705 --selected
Tercio@11 706 selectedTexture:SetWidth (frame_witdh - 9)
Tercio@11 707
Tercio@11 708 for index, row in ipairs (object.menus) do
Tercio@11 709 row:SetPoint ("topright", scrollChild, "topright", -22, ((-index-1)*20)-5)
Tercio@11 710 end
Tercio@11 711
Tercio@11 712 else
Tercio@11 713 --hide scrollbar and disable wheel
Tercio@11 714 object:HideScroll()
Tercio@11 715 scrollFrame:EnableMouseWheel (false)
Tercio@11 716 --width
Tercio@11 717 scrollBorder:SetWidth (frame_witdh)
Tercio@11 718 scrollFrame:SetWidth (frame_witdh)
Tercio@11 719 scrollChild:SetWidth (frame_witdh)
Tercio@11 720 --height
Tercio@11 721 scrollBorder:SetHeight ((showing*20) + 25)
Tercio@11 722 scrollFrame:SetHeight ((showing*20) + 25)
Tercio@11 723 --mouse over texture
Tercio@11 724 mouseOverTexture:SetWidth (frame_witdh-10)
Tercio@11 725 --selected
Tercio@11 726 selectedTexture:SetWidth (frame_witdh - 9)
Tercio@11 727
Tercio@11 728 for index, row in ipairs (object.menus) do
Tercio@11 729 row:SetPoint ("topright", scrollChild, "topright", -5, ((-index-1)*20)-5)
Tercio@11 730 end
Tercio@11 731 end
Tercio@11 732
Tercio@22 733 if (object.myvaluelabel and currentIndex and scrollFrame.slider:IsShown()) then
Tercio@22 734 object.scroll:SetValue (max ((currentIndex*20) - 80, 0))
Tercio@22 735 else
Tercio@22 736 object.scroll:SetValue (0)
Tercio@22 737 end
Tercio@22 738
Tercio@11 739 object:Open()
Tercio@11 740
Tercio@11 741 else
Tercio@11 742 --> clear menu
Tercio@11 743
Tercio@11 744 end
Tercio@11 745
Tercio@11 746 else --> click to close
Tercio@11 747
Tercio@11 748 object:Close()
Tercio@11 749 end
Tercio@11 750
Tercio@11 751 end
Tercio@11 752
Tercio@11 753 function DetailsFrameworkDropDownOnEnter (self)
Tercio@11 754
Tercio@11 755 if (self.MyObject.OnEnterHook) then
Tercio@11 756 local interrupt = self.MyObject.OnEnterHook (self)
Tercio@11 757 if (interrupt) then
Tercio@11 758 return
Tercio@11 759 end
Tercio@11 760 end
Tercio@11 761
Tercio@11 762 if (self.MyObject.onenter_backdrop) then
Tercio@11 763 self:SetBackdropColor (unpack (self.MyObject.onenter_backdrop))
Tercio@11 764 else
Tercio@11 765 self:SetBackdropColor (.2, .2, .2, .2)
Tercio@11 766 end
Tercio@11 767
Tercio@22 768 if (self.MyObject.onenter_backdrop_border_color) then
Tercio@22 769 self:SetBackdropBorderColor (unpack (self.MyObject.onenter_backdrop_border_color))
Tercio@22 770 end
Tercio@22 771
Tercio@11 772 self.arrowTexture2:Show()
Tercio@11 773
Tercio@11 774 if (self.MyObject.have_tooltip) then
Tercio@17 775 GameCooltip2:Preset (2)
Tercio@17 776
Tercio@17 777 if (type (self.MyObject.have_tooltip) == "function") then
Tercio@17 778 GameCooltip2:AddLine (self.MyObject.have_tooltip() or "")
Tercio@17 779 else
Tercio@17 780 GameCooltip2:AddLine (self.MyObject.have_tooltip)
Tercio@17 781 end
Tercio@17 782
Tercio@11 783 GameCooltip2:SetOwner (self)
Tercio@11 784 GameCooltip2:ShowCooltip()
Tercio@11 785 end
Tercio@22 786
Tercio@11 787 end
Tercio@11 788
Tercio@11 789 function DetailsFrameworkDropDownOnLeave (self)
Tercio@11 790 if (self.MyObject.OnLeaveHook) then
Tercio@11 791 local interrupt = self.MyObject.OnLeaveHook (self)
Tercio@11 792 if (interrupt) then
Tercio@11 793 return
Tercio@11 794 end
Tercio@11 795 end
Tercio@11 796
Tercio@11 797 if (self.MyObject.onleave_backdrop) then
Tercio@11 798 self:SetBackdropColor (unpack (self.MyObject.onleave_backdrop))
Tercio@11 799 else
Tercio@11 800 self:SetBackdropColor (1, 1, 1, .5)
Tercio@11 801 end
Tercio@11 802
Tercio@22 803 if (self.MyObject.onleave_backdrop_border_color) then
Tercio@22 804 self:SetBackdropBorderColor (unpack (self.MyObject.onleave_backdrop_border_color))
Tercio@22 805 end
Tercio@22 806
Tercio@11 807 self.arrowTexture2:Hide()
Tercio@11 808
Tercio@11 809 if (self.MyObject.have_tooltip) then
Tercio@11 810 GameCooltip2:ShowMe (false)
Tercio@11 811 end
Tercio@11 812 end
Tercio@11 813
Tercio@11 814 function DetailsFrameworkDropDownOnSizeChanged (self, w, h)
Tercio@11 815 self.MyObject.label:SetSize (self:GetWidth()-40, 10)
Tercio@11 816 end
Tercio@11 817
Tercio@11 818 function DetailsFrameworkDropDownOnShow (self)
Tercio@11 819 if (self.MyObject and self.MyObject.OnShowHook) then
Tercio@11 820 local interrupt = self.MyObject.OnShowHook (self)
Tercio@11 821 if (interrupt) then
Tercio@11 822 return
Tercio@11 823 end
Tercio@11 824 end
Tercio@11 825 end
Tercio@11 826
Tercio@11 827 function DetailsFrameworkDropDownOnHide (self)
Tercio@11 828 if (self.MyObject and self.MyObject.OnHideHook) then
Tercio@11 829 local interrupt = self.MyObject.OnHideHook (self)
Tercio@11 830 if (interrupt) then
Tercio@11 831 return
Tercio@11 832 end
Tercio@11 833 end
Tercio@11 834
Tercio@11 835 self.MyObject:Close()
Tercio@11 836 end
Tercio@11 837
Tercio@20 838 function DF:BuildDropDownFontList (on_click, icon, icon_texcoord, icon_size)
Tercio@20 839 local t = {}
Tercio@20 840 local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0")
Tercio@20 841 for name, fontPath in pairs (SharedMedia:HashTable ("font")) do
Tercio@20 842 t[#t+1] = {value = name, label = name, onclick = on_click, icon = icon, iconsize = icon_size, texcoord = icon_texcoord, font = fontPath, descfont = "abcdefg ABCDEFG"}
Tercio@20 843 end
Tercio@20 844 table.sort (t, function (t1, t2) return t1.label < t2.label end)
Tercio@20 845 return t
Tercio@20 846 end
Tercio@11 847
Tercio@11 848 ------------------------------------------------------------------------------------------------------------
Tercio@22 849 function DropDownMetaFunctions:SetTemplate (template)
Tercio@22 850
Tercio@22 851 if (template.width) then
Tercio@22 852 self:SetWidth (template.width)
Tercio@22 853 end
Tercio@22 854 if (template.height) then
Tercio@22 855 self:SetHeight (template.height)
Tercio@22 856 end
Tercio@22 857
Tercio@22 858 if (template.backdrop) then
Tercio@22 859 self:SetBackdrop (template.backdrop)
Tercio@22 860 end
Tercio@22 861 if (template.backdropcolor) then
Tercio@22 862 local r, g, b, a = DF:ParseColors (template.backdropcolor)
Tercio@22 863 self:SetBackdropColor (r, g, b, a)
Tercio@22 864 self.onleave_backdrop = {r, g, b, a}
Tercio@22 865 end
Tercio@22 866 if (template.backdropbordercolor) then
Tercio@22 867 local r, g, b, a = DF:ParseColors (template.backdropbordercolor)
Tercio@22 868 self:SetBackdropBorderColor (r, g, b, a)
Tercio@22 869 self.onleave_backdrop_border_color = {r, g, b, a}
Tercio@22 870 end
Tercio@22 871
Tercio@22 872 if (template.onentercolor) then
Tercio@22 873 local r, g, b, a = DF:ParseColors (template.onentercolor)
Tercio@22 874 self.onenter_backdrop = {r, g, b, a}
Tercio@22 875 end
Tercio@22 876
Tercio@22 877 if (template.onleavecolor) then
Tercio@22 878 local r, g, b, a = DF:ParseColors (template.onleavecolor)
Tercio@22 879 self.onleave_backdrop = {r, g, b, a}
Tercio@22 880 end
Tercio@22 881
Tercio@22 882 if (template.onenterbordercolor) then
Tercio@22 883 local r, g, b, a = DF:ParseColors (template.onenterbordercolor)
Tercio@22 884 self.onenter_backdrop_border_color = {r, g, b, a}
Tercio@22 885 end
Tercio@22 886
Tercio@22 887 if (template.onleavebordercolor) then
Tercio@22 888 local r, g, b, a = DF:ParseColors (template.onleavebordercolor)
Tercio@22 889 self.onleave_backdrop_border_color = {r, g, b, a}
Tercio@22 890 end
Tercio@22 891
Tercio@22 892 end
Tercio@22 893
Tercio@22 894 ------------------------------------------------------------------------------------------------------------
Tercio@11 895 --> object constructor
Tercio@11 896
Tercio@22 897 function DF:CreateDropDown (parent, func, default, w, h, member, name, template)
Tercio@22 898 return DF:NewDropDown (parent, parent, name, member, w, h, func, default, template)
Tercio@11 899 end
Tercio@11 900
Tercio@22 901 function DF:NewDropDown (parent, container, name, member, w, h, func, default, template)
Tercio@11 902
Tercio@11 903 if (not name) then
Tercio@11 904 name = "DetailsFrameworkDropDownNumber" .. DF.DropDownCounter
Tercio@11 905 DF.DropDownCounter = DF.DropDownCounter + 1
Tercio@11 906
Tercio@11 907 elseif (not parent) then
Tercio@11 908 return nil
Tercio@11 909 end
Tercio@11 910 if (not container) then
Tercio@11 911 container = parent
Tercio@11 912 end
Tercio@11 913
Tercio@11 914 if (name:find ("$parent")) then
Tercio@11 915 name = name:gsub ("$parent", parent:GetName())
Tercio@11 916 end
Tercio@11 917
Tercio@11 918 local DropDownObject = {type = "dropdown", dframework = true}
Tercio@11 919
Tercio@11 920 if (member) then
Tercio@11 921 parent [member] = DropDownObject
Tercio@11 922 end
Tercio@11 923
Tercio@11 924 if (parent.dframework) then
Tercio@11 925 parent = parent.widget
Tercio@11 926 end
Tercio@11 927 if (container.dframework) then
Tercio@11 928 container = container.widget
Tercio@11 929 end
Tercio@11 930
Tercio@11 931 if (default == nil) then
Tercio@11 932 default = 1
Tercio@11 933 end
Tercio@11 934
Tercio@11 935 --> default members:
Tercio@11 936 --> hooks
Tercio@11 937 DropDownObject.OnEnterHook = nil
Tercio@11 938 DropDownObject.OnLeaveHook = nil
Tercio@11 939 DropDownObject.OnHideHook = nil
Tercio@11 940 DropDownObject.OnShowHook = nil
Tercio@11 941 DropDownObject.OnMouseDownHook = nil
Tercio@11 942 --> misc
Tercio@11 943 DropDownObject.container = container
Tercio@11 944 DropDownObject.have_tooltip = nil
Tercio@11 945
Tercio@11 946 DropDownObject.dropdown = CreateFrame ("Button", name, parent, "DetailsFrameworkDropDownTemplate")
Tercio@11 947 DropDownObject.widget = DropDownObject.dropdown
Tercio@11 948
Tercio@11 949 DropDownObject.__it = {nil, nil}
Tercio@11 950 --_G [name] = DropDownObject
Tercio@11 951
Tercio@11 952 if (not APIDropDownFunctions) then
Tercio@11 953 APIDropDownFunctions = true
Tercio@11 954 local idx = getmetatable (DropDownObject.dropdown).__index
Tercio@11 955 for funcName, funcAddress in pairs (idx) do
Tercio@11 956 if (not DropDownMetaFunctions [funcName]) then
Tercio@11 957 DropDownMetaFunctions [funcName] = function (object, ...)
Tercio@20 958 local x = loadstring ( "return _G['"..object.dropdown:GetName().."']:"..funcName.."(...)")
Tercio@11 959 return x (...)
Tercio@11 960 end
Tercio@11 961 end
Tercio@11 962 end
Tercio@11 963 end
Tercio@11 964
Tercio@11 965 DropDownObject.dropdown.MyObject = DropDownObject
Tercio@11 966
Tercio@11 967 DropDownObject.dropdown:SetWidth (w)
Tercio@11 968 DropDownObject.dropdown:SetHeight (h)
Tercio@11 969
Tercio@11 970 DropDownObject.func = func
Tercio@11 971 DropDownObject.realsizeW = 150
Tercio@11 972 DropDownObject.realsizeH = 150
Tercio@11 973 DropDownObject.FixedValue = nil
Tercio@11 974 DropDownObject.opened = false
Tercio@11 975 DropDownObject.menus = {}
Tercio@11 976 DropDownObject.myvalue = nil
Tercio@11 977
Tercio@11 978 DropDownObject.label = _G [name .. "_Text"]
Tercio@11 979
Tercio@11 980 DropDownObject.icon = _G [name .. "_IconTexture"]
Tercio@11 981 DropDownObject.statusbar = _G [name .. "_StatusBarTexture"]
Tercio@11 982 DropDownObject.select = _G [name .. "_SelectedTexture"]
Tercio@11 983
Tercio@11 984 local scroll = _G [DropDownObject.dropdown:GetName() .. "_ScrollFrame"]
Tercio@11 985
Tercio@11 986 DropDownObject.scroll = DF:NewScrollBar (scroll, _G [DropDownObject.dropdown:GetName() .. "_ScrollFrame".."_ScrollChild"], -25, -18)
Tercio@11 987
Tercio@11 988 function DropDownObject:HideScroll()
Tercio@11 989 scroll.baixo:Hide()
Tercio@11 990 scroll.cima:Hide()
Tercio@11 991 scroll.slider:Hide()
Tercio@11 992 end
Tercio@11 993 function DropDownObject:ShowScroll()
Tercio@11 994 scroll.baixo:Show()
Tercio@11 995 scroll.cima:Show()
Tercio@11 996 scroll.slider:Show()
Tercio@11 997 end
Tercio@11 998
Tercio@11 999 --button_down_scripts (DropDownObject, scroll.slider, scroll.baixo)
Tercio@11 1000
Tercio@11 1001 DropDownObject:HideScroll()
Tercio@11 1002 DropDownObject.label:SetSize (DropDownObject.dropdown:GetWidth()-40, 10)
Tercio@11 1003
Tercio@11 1004 --> setup class
Tercio@11 1005 _setmetatable (DropDownObject, DropDownMetaFunctions)
Tercio@11 1006
Tercio@11 1007 --> initialize first menu selected
Tercio@11 1008
Tercio@11 1009 if (type (default) == "string") then
Tercio@11 1010 DropDownObject:Select (default)
Tercio@11 1011
Tercio@11 1012 elseif (type (default) == "number") then
Tercio@11 1013 if (not DropDownObject:Select (default)) then
Tercio@11 1014 DropDownObject:Select (default, true)
Tercio@11 1015 end
Tercio@11 1016 end
Tercio@11 1017
Tercio@22 1018 if (template) then
Tercio@22 1019 DropDownObject:SetTemplate (template)
Tercio@22 1020 end
Tercio@22 1021
Tercio@11 1022 return DropDownObject
Tercio@11 1023
Tercio@11 1024 end