Skip to content

Commit 7a7b67d

Browse files
committed
+Added list:setTheme(...).
1 parent 850d984 commit 7a7b67d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,9 @@ Shortcut to create `Percent` object.
637637
* `list:setScrollableHorizontally(val)`: sets whether allow scrolling horizontally
638638
* `val`: `true` for allowing scrolling horizontally, otherwise `false`
639639
* returns `self`
640+
* `list:setTheme(theme)`: sets the theme
641+
* `theme`: the custom theme
642+
* returns `self`
640643

641644
### beGUI.Draggable
642645

src/libs/beGUI/beGUI_Containers.lua

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ local List = beClass.class({
4141
_maxX = 0, _maxY = 0,
4242
_scrollableHorizontally = false,
4343
_childrenCount = 0,
44+
_theme = nil,
4445

4546
-- Constructs a List.
4647
-- `withScrollBar`: whether to draw scroll bar(s)
@@ -65,6 +66,12 @@ local List = beClass.class({
6566
return self
6667
end,
6768

69+
setTheme = function (self, theme)
70+
self._theme = theme
71+
72+
return self
73+
end,
74+
6875
navigatable = function (self)
6976
return 'content'
7077
end,
@@ -125,7 +132,7 @@ local List = beClass.class({
125132
end
126133
end
127134

128-
local elem = theme['list']
135+
local elem = theme[self._theme or 'list']
129136
beUtils.tex9Grid(elem, x, y, w, h, nil, self.transparency, nil)
130137

131138
local scrollBarTransparency = nil
@@ -200,7 +207,7 @@ local List = beClass.class({
200207
if count ~= self._childrenCount then
201208
self._childrenCount = count
202209
end
203-
if scrollBarTransparency then
210+
if elem.color and scrollBarTransparency then
204211
local widgetPos = y + 1
205212
local widgetSize = h - 2
206213
local limit = 0

0 commit comments

Comments
 (0)