/trunk/Plink!/Libs/AceGUI-3.0-SharedMediaWidgets
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Border_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.border:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
self.border:Hide() |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Border" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function Frame_OnEnter(this) |
local self = this.obj |
local text = self.text:GetText() |
if text ~= nil and text ~= '' then |
if text ~= nil and text ~= '' then |
self.borderframe:Show() |
end |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.borderframe:Hide() |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Border_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("border") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function SetText(self, text) |
if text and text ~= '' then |
local backdropTable = self.borderframe:GetBackdrop() |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetList = SetList |
self.SetText = SetText |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local borderframe = CreateFrame('Frame') |
borderframe:SetFrameStrata("TOOLTIP") |
borderframe:SetWidth(64) |
insets = { left = 4, right = 4, top = 4, bottom = 4 }}) |
self.borderframe = borderframe |
borderframe:Hide() |
self.dropdown:EnableMouse(true) |
self.dropdown:SetScript("OnEnter", Frame_OnEnter) |
self.dropdown:SetScript("OnLeave", Frame_OnLeave) |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Background_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.texture:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
self.texture:Hide() |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Background" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function Frame_OnEnter(this) |
local self = this.obj |
local text = self.text:GetText() |
if text ~= nil and text ~= '' then |
if text ~= nil and text ~= '' then |
self.textureframe:Show() |
end |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.textureframe:Hide() |
end |
local function SetText(self, text) |
if text and text ~= '' then |
self.texture:SetTexture(Media:Fetch('background',text)) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Background_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("background") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local textureframe = CreateFrame('Frame') |
textureframe:SetFrameStrata("TOOLTIP") |
textureframe:SetWidth(128) |
texture:SetAllPoints(textureframe) |
textureframe:Hide() |
self.texture = texture |
self.dropdown:EnableMouse(true) |
self.dropdown:SetScript("OnEnter", Frame_OnEnter) |
self.dropdown:SetScript("OnLeave", Frame_OnLeave) |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Font_Item_Select" |
local widgetVersion = 1 |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
self.SetText = SetText |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
local widgetType = "LSM30_Font" |
local widgetVersion = 2 |
local function SetText(self, text) |
local widgetVersion = 3 |
local function SetText(self, text) |
if text and text ~= '' then |
local _, size, outline= self.text:GetFont() |
self.text:SetFont(Media:Fetch('font',text),size,outline) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Font_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("font") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
self.SetList = SetList |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
end |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Sound_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.highlight:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
local function SetPullout(self, pullout) |
self.pullout = pullout |
self.frame:SetParent(nil) |
self.frame:SetParent(pullout.itemFrame) |
self.parent = pullout.itemFrame |
local function Hide(self) |
self.frame:Hide() |
end |
local function SetDisabled(self, disabled) |
self.disabled = disabled |
if disabled then |
self.text:SetTextColor(1, 1, 1) |
end |
end |
local function SetOnLeave(self, func) |
self.specialOnLeave = func |
end |
self.check:Hide() |
end |
end |
local function Frame_OnClick(this, button) |
local self = this.obj |
self.value = not self.value |
UpdateToggle(self) |
self:Fire("OnValueChanged", self.value) |
end |
local function Speaker_OnClick(this, button) |
local self = this.obj |
PlaySoundFile(Media:Fetch('sound',self.sound)) |
end |
local function SetValue(self, value) |
self.value = value |
UpdateToggle(self) |
end |
local function Constructor() |
local count = AceGUI:GetNextWidgetNum(type) |
local frame = CreateFrame("Frame", "LSM30_Sound_DropDownItem"..count) |
self.frame = frame |
frame.obj = self |
self.type = type |
self.useHighlight = true |
frame:SetHeight(17) |
frame:SetFrameStrata("FULLSCREEN_DIALOG") |
local button = CreateFrame("Button", nil, frame) |
button:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-22,0) |
button:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
self.button = button |
button.obj = self |
local speakerbutton = CreateFrame("Button", nil, frame) |
speakerbutton:SetWidth(16) |
speakerbutton:SetHeight(16) |
speakerbutton:SetPoint("RIGHT",frame,"RIGHT",-6,0) |
self.speakerbutton = speakerbutton |
speakerbutton.obj = self |
local speaker = frame:CreateTexture(nil, "BACKGROUND") |
speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") |
speaker:SetAllPoints(speakerbutton) |
self.speaker = speaker |
local speakeron = speakerbutton:CreateTexture(nil, "HIGHLIGHT") |
speakeron:SetTexture("Interface\\Common\\VoiceChat-On") |
speakeron:SetAllPoints(speakerbutton) |
self.speakeron = speakeron |
local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") |
text:SetTextColor(1,1,1) |
text:SetJustifyH("LEFT") |
highlight:SetPoint("LEFT",frame,"LEFT",5,0) |
highlight:Hide() |
self.highlight = highlight |
local check = frame:CreateTexture("OVERLAY") |
local check = frame:CreateTexture("OVERLAY") |
check:SetWidth(16) |
check:SetHeight(16) |
check:SetPoint("LEFT",frame,"LEFT",3,-1) |
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1) |
sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow") |
sub:Hide() |
self.sub = sub |
self.sub = sub |
button:SetScript("OnEnter", Frame_OnEnter) |
button:SetScript("OnLeave", Frame_OnLeave) |
self.OnAcquire = OnAcquire |
self.OnRelease = OnRelease |
self.SetPullout = SetPullout |
self.GetText = GetText |
self.SetText = SetText |
self.SetDisabled = SetDisabled |
self.SetPoint = SetPoint |
self.Show = Show |
self.Hide = Hide |
self.SetOnLeave = SetOnLeave |
self.SetOnEnter = SetOnEnter |
self.button:SetScript("OnClick", Frame_OnClick) |
self.speakerbutton:SetScript("OnClick", Speaker_OnClick) |
self.SetValue = SetValue |
AceGUI:RegisterAsWidget(self) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Sound" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Sound_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("sound") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Statusbar_Item_Select" |
local widgetVersion = 1 |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Statusbar" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function SetText(self, text) |
if text and text ~= '' then |
self.texture:SetTexture(Media:Fetch('statusbar',text)) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Statusbar_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("statusbar") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local texture = self.dropdown:CreateTexture(nil, "ARTWORK") |
texture:SetPoint("BOTTOMRIGHT", right, "BOTTOMRIGHT" ,-39, 26) |
texture:SetPoint("TOPLEFT", left, "TOPLEFT", 24, -24) |
self.texture = texture |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |