Skip to content

Commit 79e7ca2

Browse files
committed
switch drop down to buttons
1 parent 6209d88 commit 79e7ca2

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

src/Classes/ItemDBControl.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local ItemDBClass = newClass("ItemDBControl", "ListControl", function(self, anch
2727
self.leagueList = { "Any league", "No league" }
2828
self.typeList = { "Any type", "Armour", "Jewellery", "One Handed Melee", "Two Handed Melee" }
2929
self.slotList = { "Any slot", "Weapon 1", "Weapon 2", "Helmet", "Body Armour", "Gloves", "Boots", "Amulet", "Ring", "Belt", "Jewel" }
30-
local baseY = dbType == "RARE" and -22 or -62
30+
local baseY = dbType == "RARE" and -22 or -64
3131
self.controls.slot = new("DropDownControl", {"BOTTOMLEFT",self,"TOPLEFT"}, {0, baseY, 179, 18}, self.slotList, function(index, value)
3232
self.listBuildFlag = true
3333
end)

src/Classes/ItemsTab.lua

+19-14
Original file line numberDiff line numberDiff line change
@@ -210,25 +210,30 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
210210
--function()
211211
-- return self.height < 980
212212
--end
213-
self.controls.selectDB = new("DropDownControl", {"LEFT",self.controls.selectDBLabel,"RIGHT"}, {4, 0, 150, 18}, { "Uniques", "Rare Templates" })
213+
self.selectedDB = "UNIQUE"
214214

215+
-- Uniques Button
216+
self.controls.uniqueButton = new("ButtonControl", {"LEFT", self.controls.selectDBLabel, "RIGHT"}, {4, 0, 110, 18}, "Uniques", function()
217+
self.selectedDB = "UNIQUE"
218+
end)
219+
self.controls.uniqueButton.locked = function() return self.selectedDB == "UNIQUE" end
220+
221+
-- Rare Templates Button
222+
self.controls.rareButton = new("ButtonControl", {"LEFT", self.controls.selectDBLabel, "RIGHT"}, {120, 0, 110, 18}, "Rare Templates", function()
223+
self.selectedDB = "RARE"
224+
end)
225+
self.controls.rareButton.locked = function() return self.selectedDB == "RARE" end
226+
215227
-- Unique database
216228
self.controls.uniqueDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(244, self.maxY - select(2, c:GetPos())) end}, self, main.uniqueDB, "UNIQUE")
217-
self.controls.uniqueDB.y = function()
218-
return self.controls.selectDBLabel:IsShown() and 118 or 96
219-
end
220-
self.controls.uniqueDB.shown = function()
221-
return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 1
222-
end
229+
self.controls.uniqueDB.y = 118
230+
self.controls.uniqueDB.shown = function() return not self.selectedDB == "UNIQUE" end
223231

224232
-- Rare template database
225-
self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(260, self.maxY - select(2, c:GetPos())) end}, self, main.rareDB, "RARE")
226-
self.controls.rareDB.y = function()
227-
return self.controls.selectDBLabel:IsShown() and 78 or 396
228-
end
229-
self.controls.rareDB.shown = function()
230-
return not self.controls.selectDBLabel:IsShown() or self.controls.selectDB.selIndex == 2
231-
end
233+
self.controls.rareDB = new("ItemDBControl", {"TOPLEFT",self.controls.itemList,"BOTTOMLEFT"}, {0, 76, 360, function(c) return m_min(286, self.maxY - select(2, c:GetPos())) end}, self, main.rareDB, "RARE")
234+
self.controls.uniqueDB.shown = function() return self.selectedDB == "UNIQUE" end
235+
self.controls.rareDB.shown = function() return self.selectedDB == "RARE" end
236+
232237
-- Create/import item
233238
self.controls.craftDisplayItem = new("ButtonControl", {"TOPLEFT",main.portraitMode and self.controls.setManage or self.controls.itemList,"TOPRIGHT"}, {20, main.portraitMode and 0 or -20, 120, 20}, "Craft item...", function()
234239
self:CraftItem()

0 commit comments

Comments
 (0)